-
-
Notifications
You must be signed in to change notification settings - Fork 917
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
dense: check and resize the existed dmap file to image #1024
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ | |
#include "Scene.h" | ||
#include "SceneDensify.h" | ||
#include "PatchMatchCUDA.h" | ||
#include "DepthMap.h" | ||
// MRF: view selection | ||
#include "../Math/TRWS/MRFEnergy.h" | ||
|
||
|
@@ -1962,9 +1963,17 @@ void Scene::DenseReconstructionEstimate(void* pData) | |
} | ||
// try to load already compute depth-map for this image | ||
if (depthmapComputed && data.nFusionMode >= 0) { | ||
const std::string depthMapName(ComposeDepthFilePath(data.scene.images[idx].ID, "dmap")); | ||
cv::Size depthMapSize; | ||
if (GetDepthMapHeaderSize(depthMapName, depthMapSize) && depthMapSize != data.scene.images[idx].GetSize()) { | ||
depthData.Load(depthMapName); | ||
DepthMap& depthMap = depthData.depthMap; | ||
cv::resize(depthMap, depthMap, data.scene.images[idx].GetSize(), 0, 0, cv::INTER_NEAREST); | ||
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. resizing only the depth-map is not enough, you should resize all images inside, ex normal-map, etc |
||
depthData.Save(depthMapName); | ||
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 is ok if you use and you can combine this with the next check that loads the depth-map, and if we that check is true we do not release it |
||
} | ||
if (OPTDENSE::nOptimize & OPTDENSE::OPTIMIZE) { | ||
if (!depthData.Load(ComposeDepthFilePath(depthData.GetView().GetID(), "dmap"))) { | ||
VERBOSE("error: invalid depth-map '%s'", ComposeDepthFilePath(depthData.GetView().GetID(), "dmap").c_str()); | ||
if (!depthData.Load(depthMapName)) { | ||
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. to make this compatible with the above change, modify the if like:
|
||
VERBOSE("error: invalid depth-map '%s'", depthMapName.c_str()); | ||
exit(EXIT_FAILURE); | ||
} | ||
// optimize depth-map | ||
|
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.
I think this was a interesting exercise, but function
ImportDepthDataRaw()
already existing could be already used for this if you setflags
param to 0, pls checkThere 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.
if you want you can still let this function, but instead of duplicating the code just call
ImportDepthDataRaw
and return the only the sizes;more useful will be to rename it to
std::optional<std::pair<cv::Size, cv::Size>> GetDepthMapHeaderSizes(const String& fileName)
and return both image and depth-map sizes