Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[depthMap] bug fix: use RAII instead of pointers #671

Merged
merged 1 commit into from
Jul 24, 2019
Merged

Conversation

fabiencastan
Copy link
Member

@fabiencastan fabiencastan commented Jul 24, 2019

In particular configurations (failed to find Tc cameras), sgmrc can stop early before allocating the _volumeBestIdVal, which is later used in the refine step.

This bug fix in combination with #616 and #642, should fix the issues reported in alicevision/Meshroom#504, alicevision/Meshroom#481, alicevision/Meshroom#458, alicevision/Meshroom#431, alicevision/Meshroom#425.

In particular configurations (failed to find Tc cameras), sgmrc can stop early before allocating the _volumeBestIdVal, which is later used in refine step.
@fabiencastan fabiencastan added this to the 2019.2 milestone Jul 24, 2019
@fabiencastan fabiencastan requested a review from simogasp July 24, 2019 18:24
@@ -520,13 +519,13 @@ bool SemiGlobalMatchingRc::sgmrc(bool checkIfExists)

if(_sp->exportIntermediateResults)
{
DepthSimMap* depthSimMapFinal = _sp->getDepthSimMapFromBestIdVal(_width, _height, _volumeBestIdVal, _scale, _step, _rc, zborder, _depths);
DepthSimMap* depthSimMapFinal = _sp->getDepthSimMapFromBestIdVal(_width, _height, &_volumeBestIdVal, _scale, _step, _rc, zborder, _depths);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just asking, any chances that it returns a nullptr? In case it would be better to deal with it. Also an assert(depthSimMapFinal) would not kill anyone... ;-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function cannot return null.
The refactoring done here has been started for months now. It's quite close to be merged, but it will be done after the release.
So I would prefer to limit conflicts, as most of these things (like the bug fixed in this PR) are already fixed on the other side.

unsigned char* _volumeStepZPtr = _volumeStepZ->getDataWritable().data();
int* _volumeBestZPtr = _volumeBestZ->getDataWritable().data();
IdValue* volumeBestIdValPtr = volumeBestIdVal->getDataWritable().data();
IdValue* out_volumeBestIdValPtr = out_volumeBestIdVal.getDataWritable().data();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, I'd put an assert and if it is the case deal with the nullptr (but i don't know how the funciton works)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not possible to be null here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants