MCPcopy Create free account
hub / github.com/cdcseacave/openMVS / Execute

Method Execute

apps/Viewer/Scene.cpp:148–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146{
147public:
148 bool Execute() override {
149 const auto& options = pScene->reconstructOptions;
150 MVS::Scene& mvsScene = pScene->scene;
151
152 // Remove point weights if constant weight requested
153 if (options.constantWeight)
154 mvsScene.pointcloud.pointWeights.Release();
155
156 // Reconstruct mesh
157 if (!mvsScene.ReconstructMesh(options.minPointDistance, options.useFreeSpaceSupport, options.useOnlyROI,
158 4, options.thicknessFactor, options.qualityFactor))
159 return false;
160
161 // Crop to ROI if requested
162 if (options.cropToROI && mvsScene.IsBounded()) {
163 const size_t numVertices = mvsScene.mesh.vertices.size();
164 const size_t numFaces = mvsScene.mesh.faces.size();
165 mvsScene.mesh.RemoveFacesOutside(mvsScene.obb);
166 VERBOSE("Mesh trimmed to ROI: %u vertices and %u faces removed",
167 (unsigned)(numVertices - mvsScene.mesh.vertices.size()),
168 (unsigned)(numFaces - mvsScene.mesh.faces.size()));
169 }
170
171 // Decimate mesh
172 float decimate = options.decimateMesh;
173 if (options.targetFaceNum && !mvsScene.mesh.faces.empty())
174 decimate = static_cast<float>(options.targetFaceNum) / mvsScene.mesh.faces.size();
175 decimate = CLAMP(decimate, 0.f, 1.f);
176 if (decimate <= 0.f)
177 decimate = 1.f;
178
179 // Clean mesh
180 mvsScene.mesh.Clean(1.f, options.removeSpurious, options.removeSpikes, options.closeHoles, options.smoothSteps, options.edgeLength, false);
181 mvsScene.mesh.Clean(decimate, 0.f, options.removeSpikes, options.closeHoles, 0u, 0.f, false);
182 mvsScene.mesh.Clean(1.f, 0.f, false, 0u, 0u, 0.f, true);
183
184 return true;
185 }
186 EVTWorkflowReconstructMesh(Scene* _pScene) : EventWorkflow(_pScene) {}
187};
188

Callers

nothing calls this directly

Calls 6

CLAMPFunction · 0.85
RemoveFacesOutsideMethod · 0.80
CleanMethod · 0.80
ReleaseMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected