-
-
Notifications
You must be signed in to change notification settings - Fork 829
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -271,16 +271,15 @@ void SemiGlobalMatchingVolume::SGMoptimizeVolumeStepZ(int rc, int volStepXY, int | |
mvsUtils::printfElapsedTime(tall, "SemiGlobalMatchingVolume::SGMoptimizeVolumeStepZ"); | ||
} | ||
|
||
StaticVector<IdValue>* SemiGlobalMatchingVolume::getOrigVolumeBestIdValFromVolumeStepZ(int zborder) | ||
void SemiGlobalMatchingVolume::getOrigVolumeBestIdValFromVolumeStepZ(StaticVector<IdValue>& out_volumeBestIdVal, int zborder) | ||
{ | ||
long tall = clock(); | ||
|
||
StaticVector<IdValue>* volumeBestIdVal = new StaticVector<IdValue>(); | ||
volumeBestIdVal->reserve(volDimX * volDimY); | ||
volumeBestIdVal->resize_with(volDimX * volDimY, IdValue(-1, 1.0f)); | ||
out_volumeBestIdVal.reserve(volDimX * volDimY); | ||
out_volumeBestIdVal.resize_with(volDimX * volDimY, IdValue(-1, 1.0f)); | ||
unsigned char* _volumeStepZPtr = _volumeStepZ->getDataWritable().data(); | ||
int* _volumeBestZPtr = _volumeBestZ->getDataWritable().data(); | ||
IdValue* volumeBestIdValPtr = volumeBestIdVal->getDataWritable().data(); | ||
IdValue* out_volumeBestIdValPtr = out_volumeBestIdVal.getDataWritable().data(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not possible to be null here. |
||
for(int z = zborder; z < volDimZ / volStepZ - zborder; z++) | ||
{ | ||
for(int y = 1; y < volDimY - 1; y++) | ||
|
@@ -291,7 +290,7 @@ StaticVector<IdValue>* SemiGlobalMatchingVolume::getOrigVolumeBestIdValFromVolum | |
// value from volumeStepZ converted from (0, 255) to (-1, +1) | ||
float val = (((float)_volumeStepZPtr[volumeIndex]) / 255.0f) * 2.0f - 1.0f; | ||
int bestZ = _volumeBestZPtr[volumeIndex]; // TODO: what is bestZ? | ||
IdValue& idVal = volumeBestIdValPtr[y * volDimX + x]; | ||
IdValue& idVal = out_volumeBestIdValPtr[y * volDimX + x]; | ||
assert(bestZ >= 0); | ||
|
||
if(idVal.id == -1) | ||
|
@@ -312,8 +311,6 @@ StaticVector<IdValue>* SemiGlobalMatchingVolume::getOrigVolumeBestIdValFromVolum | |
|
||
if(sp->mp->verbose) | ||
mvsUtils::printfElapsedTime(tall, "SemiGlobalMatchingVolume::getOrigVolumeBestIdValFromVolumeStepZ "); | ||
|
||
return volumeBestIdVal; | ||
} | ||
|
||
void SemiGlobalMatchingVolume::copyVolume(const StaticVector<unsigned char>* volume, int zFrom, int nZSteps) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 anassert(depthSimMapFinal)
would not kill anyone... ;-)There was a problem hiding this comment.
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.