Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit98712fe

Browse files
committed
small updates
1 parent6ade4a9 commit98712fe

File tree

4 files changed

+5
-145
lines changed

4 files changed

+5
-145
lines changed

‎FriedLiver/FriedLiver.vcxproj‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@
195195
<ClIncludeInclude="Source\PoseHelper.h" />
196196
<ClIncludeInclude="Source\PrimeSenseSensor.h" />
197197
<ClIncludeInclude="Source\RGBDSensor.h" />
198-
<ClIncludeInclude="Source\RunOpt.h" />
199198
<ClIncludeInclude="Source\SBA.h" />
200199
<ClIncludeInclude="Source\SensorDataReader.h" />
201200
<ClIncludeInclude="Source\SiftGPU\CUDATimer.h" />
@@ -228,8 +227,6 @@
228227
<ClIncludeInclude="Source\Solver\SolverBundlingUtil.h" />
229228
<ClIncludeInclude="Source\stdafx.h" />
230229
<ClIncludeInclude="Source\StructureSensor.h" />
231-
<ClIncludeInclude="Source\testMatching.h" />
232-
<ClIncludeInclude="Source\testSIFT.h" />
233230
<ClIncludeInclude="Source\TimingLog.h" />
234231
<ClIncludeInclude="Source\TrajectoryManager.h" />
235232
</ItemGroup>
@@ -307,7 +304,6 @@
307304
<ClCompileInclude="Source\OnlineBundler.cpp" />
308305
<ClCompileInclude="Source\PrimeSenseSensor.cpp" />
309306
<ClCompileInclude="Source\RGBDSensor.cpp" />
310-
<ClCompileInclude="Source\RunOpt.cpp" />
311307
<ClCompileInclude="Source\SBA.cpp" />
312308
<ClCompileInclude="Source\SensorDataReader.cpp" />
313309
<ClCompileInclude="Source\SiftGPU\CuTexImage.cpp" />
@@ -324,8 +320,6 @@
324320
<PrecompiledHeaderCondition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
325321
</ClCompile>
326322
<ClCompileInclude="Source\StructureSensor.cpp" />
327-
<ClCompileInclude="Source\testMatching.cpp" />
328-
<ClCompileInclude="Source\testSIFT.cpp" />
329323
<ClCompileInclude="Source\TimingLog.cpp" />
330324
<ClCompileInclude="Source\TrajectoryManager.cpp" />
331325
<ClCompileInclude="Source\uplink.cpp" />

‎FriedLiver/FriedLiver.vcxproj.filters‎

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,6 @@
138138
<ClCompileInclude="Source\SensorDataReader.cpp">
139139
<Filter>Sensors</Filter>
140140
</ClCompile>
141-
<ClCompileInclude="Source\testMatching.cpp">
142-
<Filter>Testing</Filter>
143-
</ClCompile>
144-
<ClCompileInclude="Source\testSIFT.cpp">
145-
<Filter>Testing</Filter>
146-
</ClCompile>
147-
<ClCompileInclude="Source\RunOpt.cpp">
148-
<Filter>Testing</Filter>
149-
</ClCompile>
150141
<ClCompileInclude="Source\CUDAImageCalibrator.cpp">
151142
<Filter>Sensors</Filter>
152143
</ClCompile>
@@ -390,15 +381,6 @@
390381
<Filter>SolverBundling</Filter>
391382
</ClInclude>
392383
<ClIncludeInclude="Source\CUDACameraUtil.h" />
393-
<ClIncludeInclude="Source\testSIFT.h">
394-
<Filter>Testing</Filter>
395-
</ClInclude>
396-
<ClIncludeInclude="Source\testMatching.h">
397-
<Filter>Testing</Filter>
398-
</ClInclude>
399-
<ClIncludeInclude="Source\RunOpt.h">
400-
<Filter>Testing</Filter>
401-
</ClInclude>
402384
<ClIncludeInclude="Source\CUDAImageCalibrator.h">
403385
<Filter>Sensors</Filter>
404386
</ClInclude>
@@ -428,9 +410,6 @@
428410
<FilterInclude="SBA">
429411
<UniqueIdentifier>{c3dc0052-729c-4526-b930-a469d7d017a9}</UniqueIdentifier>
430412
</Filter>
431-
<FilterInclude="Testing">
432-
<UniqueIdentifier>{59055ef3-aacc-44d4-8dd5-079c7f280f78}</UniqueIdentifier>
433-
</Filter>
434413
</ItemGroup>
435414
<ItemGroup>
436415
<CudaCompileInclude="Source\CUDAImageUtil.cu">

‎FriedLiver/Source/GlobalBundlingState.h‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@
66
#include<string>
77
#include<list>
88

9-
//#define USE_GLOBAL_DENSE_AT_END
9+
#defineUSE_GLOBAL_DENSE_AT_END
1010

1111
//#define EVALUATE_SPARSE_CORRESPONDENCES
1212
//#define PRINT_MEM_STATS
1313

1414

15-
//#define USE_GLOBAL_DENSE_EVERY_FRAME
16-
1715
#defineX_GLOBAL_BUNDLING_APP_STATE_FIELDS \
1816
X(bool, s_enableGlobalTimings) \
1917
X(bool, s_enablePerFrameTimings) \

‎FriedLiver/Source/SBA.cpp‎

Lines changed: 4 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,13 @@ SBA::SBA()
2929
m_localWeightsSparse.resize(maxNumIts,1.0f);
3030
m_localWeightsDenseDepth.resize(maxNumIts);
3131
for (unsignedint i =0; i < maxNumIts; i++) m_localWeightsDenseDepth[i] = (i +1.0f);
32-
m_localWeightsDenseColor.resize(maxNumIts,0.0f);//no color
33-
//for (unsigned int i = 2; i < maxNumIts; i++) m_localWeightsDenseColor[i] = 1.0f;//fr3_nstn
34-
//// for tum data
35-
//std::cout << "using FR2 params" << std::endl;
36-
//m_localWeightsSparse.resize(maxNumIts, 1.0f);
37-
//m_localWeightsDenseDepth.resize(maxNumIts, 1.0f); //for (unsigned int i = 1; i < maxNumIts; i++) m_localWeightsDenseDepth[i] = 1.0f;
38-
//m_localWeightsDenseColor.resize(maxNumIts, 0.0f); //for (unsigned int i = 2; i < maxNumIts; i++) m_localWeightsDenseColor[i] = 1.0f;
39-
////for (unsigned int i = 0; i < 2; i++) m_localWeightsSparse[maxNumIts - i - 1] = 0.0f; // turn off sparse at end
32+
m_localWeightsDenseColor.resize(maxNumIts,0.0f);
4033

4134
m_globalWeightsMutex.lock();
4235
m_globalWeightsSparse.resize(maxNumIts,1.0f);
4336
m_globalWeightsDenseDepth.resize(maxNumIts,1.0f);
44-
m_globalWeightsDenseColor.resize(maxNumIts,0.0f);//off
45-
//// for tum data
46-
//m_globalWeightsSparse.resize(maxNumIts, 1.0f);
47-
//m_globalWeightsDenseDepth.resize(maxNumIts, 0.0f);
48-
//m_globalWeightsDenseColor.resize(maxNumIts, 0.1f); //off
37+
for (unsignedint i =2; i < maxNumIts; i++) m_globalWeightsDenseDepth[i] = i;
38+
m_globalWeightsDenseColor.resize(maxNumIts,0.1f);
4939

5040
m_maxResidual = -1.0f;
5141

@@ -145,7 +135,7 @@ bool SBA::alignCUDA(SIFTImageManager* siftManager, const CUDACache* cudaCache, b
145135
return removed;
146136
}
147137

148-
//!!!debugging
138+
//tododebugging
149139
#include"GlobalAppState.h"
150140

151141
#include"MatrixConversion.h"
@@ -176,78 +166,13 @@ struct std::hash<vec2ui> : public std::unary_function < vec2ui, size_t > {
176166
}
177167
};
178168

179-
//!!!debugging
180169
boolSBA::removeMaxResidualCUDA(SIFTImageManager* siftManager,unsignedint numImages,unsignedint curFrame)
181170
{
182171
ml::vec2ui imageIndices;
183172
bool remove = m_solver->getMaxResidual(curFrame, siftManager->getGlobalCorrespondencesGPU(), imageIndices, m_maxResidual);
184173
if (remove) {
185174
if (GlobalBundlingState::get().s_verbose) std::cout <<"\timages (" << imageIndices <<"): invalid match" << m_maxResidual << std::endl;
186175

187-
/*if (false) {
188-
static SensorData sd;
189-
if (sd.m_frames.empty()) sd.loadFromFile(GlobalAppState::get().s_binaryDumpSensorFile);
190-
//get residual corrs
191-
std::vector<EntryJ> correspondences(siftManager->getNumGlobalCorrespondences());
192-
MLIB_CUDA_SAFE_CALL(cudaMemcpy(correspondences.data(), siftManager->getGlobalCorrespondencesGPU(), sizeof(EntryJ)*correspondences.size(), cudaMemcpyDeviceToHost));
193-
//get transforms
194-
float4x4* d_transforms = NULL;
195-
MLIB_CUDA_SAFE_CALL(cudaMalloc(&d_transforms, sizeof(float4x4)*numImages))
196-
convertPosesToMatricesCU(d_xRot, d_xTrans, numImages, d_transforms, siftManager->getValidImagesGPU());
197-
std::vector<mat4f> transforms(numImages);
198-
MLIB_CUDA_SAFE_CALL(cudaMemcpy(transforms.data(), d_transforms, sizeof(float4x4)*numImages, cudaMemcpyDeviceToHost));
199-
MLIB_CUDA_SAFE_FREE(d_transforms);
200-
//get residuals
201-
std::vector< std::pair<float, vec2ui> > residuals;
202-
for (unsigned int i = 0; i < correspondences.size(); i++) {
203-
const EntryJ& corr = correspondences[i];
204-
if (corr.isValid()) {
205-
vec3f res = transforms[corr.imgIdx_i] * vec3f(corr.pos_i.x, corr.pos_i.y, corr.pos_i.z) - transforms[corr.imgIdx_j] * vec3f(corr.pos_j.x, corr.pos_j.y, corr.pos_j.z);
206-
res = math::abs(res);
207-
float r = std::max(res.x, std::max(res.y, res.z));
208-
residuals.push_back(std::make_pair(r, vec2ui(corr.imgIdx_i, corr.imgIdx_j)));
209-
}
210-
} //correspondences
211-
std::sort(residuals.begin(), residuals.end(), [](const std::pair<float, vec2ui> &left, const std::pair<float, vec2ui> &right) {
212-
return fabs(left.first) > fabs(right.first);
213-
});
214-
//find image-image
215-
const float thresh = 0.05f;
216-
std::unordered_map<vec2ui, float> imageImageResidualsSet;
217-
for (unsigned int i = 0; i < residuals.size(); i++) {
218-
if (residuals[i].first < thresh) break;
219-
auto it = imageImageResidualsSet.find(residuals[i].second);
220-
if (it == imageImageResidualsSet.end()) imageImageResidualsSet[residuals[i].second] = residuals[i].first;
221-
else it->second = std::max(it->second, residuals[i].first);
222-
}//residuals
223-
const unsigned int maxToPrint = 10;
224-
residuals.clear();
225-
for (const auto& a : imageImageResidualsSet) residuals.push_back(std::make_pair(a.second, a.first));
226-
std::sort(residuals.begin(), residuals.end(), [](const std::pair<float, vec2ui> &left, const std::pair<float, vec2ui> &right) {
227-
return fabs(left.first) > fabs(right.first);
228-
});
229-
if (residuals.size() > maxToPrint) residuals.resize(maxToPrint);
230-
std::cout << "printing " << residuals.size() << " high residual" << std::endl;
231-
for (const auto& impair : residuals) {
232-
vec3uc* im1 = sd.decompressColorAlloc(impair.second.x * 10);
233-
vec3uc* im2 = sd.decompressColorAlloc(impair.second.y * 10);
234-
ColorImageR8G8B8 image1(sd.m_colorWidth, sd.m_colorHeight, im1);
235-
ColorImageR8G8B8 image2(sd.m_colorWidth, sd.m_colorHeight, im2);
236-
std::free(im1);std::free(im2);
237-
SiftVisualization::printMatch("debug/maxres/" + std::to_string((int)(100 * impair.first)) + "_" + std::to_string(impair.second.x) + "-" + std::to_string(impair.second.y) + ".png",
238-
impair.second, correspondences, image1, image2, sd.m_calibrationColor.m_intrinsic);
239-
unsigned short* d1 = sd.decompressDepthAlloc(impair.second.x * 10);
240-
unsigned short* d2 = sd.decompressDepthAlloc(impair.second.y * 10);
241-
DepthImage32 depth1(DepthImage16(sd.m_depthWidth, sd.m_depthHeight, d1));
242-
DepthImage32 depth2(DepthImage16(sd.m_depthWidth, sd.m_depthHeight, d2));
243-
std::free(d1);std::free(d2);
244-
image1.resize(depth1.getWidth(), depth1.getHeight());image2.resize(depth2.getWidth(), depth2.getHeight());
245-
SiftVisualization::saveKeyMatchToPointCloud("debug/maxres/" + std::to_string((int)(100 * impair.first)) + "_" + std::to_string(impair.second.x) + "-" + std::to_string(impair.second.y),
246-
impair.second, correspondences, depth1, image1, depth2, image2, transforms, sd.m_calibrationDepth.m_intrinsic.getInverse());
247-
} //print
248-
std::cout << "waiting..." << std::endl;
249-
getchar();
250-
}*/
251176
#ifdef NEW_GUIDED_REMOVE
252177
const std::vector<vec2ui>& imPairsToRemove = m_solver->getGuidedMaxResImagesToRemove();
253178
if (imPairsToRemove.empty()) {
@@ -263,29 +188,6 @@ bool SBA::removeMaxResidualCUDA(SIFTImageManager* siftManager, unsigned int numI
263188
}
264189
}
265190
#else
266-
////!!!debugging
267-
//{
268-
////std::ofstream s("debug/logs/" + std::to_string(siftManager->getNumImages()) + "-" + std::to_string(siftManager->getCurrentFrame()) + ".txt");
269-
////s << imageIndices << " : " << m_maxResidual << std::endl;
270-
////if (siftManager->getCurrentFrame() >= 70) {
271-
////float4x4* d_transforms = NULL;
272-
////MLIB_CUDA_SAFE_CALL(cudaMalloc(&d_transforms, sizeof(float4x4)*numImages));
273-
////convertPosesToMatricesCU(d_xRot, d_xTrans, numImages, d_transforms, siftManager->getValidImagesGPU());
274-
////std::vector<mat4f> transforms(numImages);
275-
////MLIB_CUDA_SAFE_CALL(cudaMemcpy(transforms.data(), d_transforms, sizeof(float4x4)*numImages, cudaMemcpyDeviceToHost));
276-
////const std::vector<int>& valid = siftManager->getValidImages();
277-
////for (unsigned int i = 0; i < numImages; i++) if (valid[i] == 0) transforms[i].setZero(-std::numeric_limits<float>::infinity());
278-
////BinaryDataStreamFile ofs("debug/logs/" + std::to_string(siftManager->getCurrentFrame()) + ".trajectory", true);
279-
////ofs << transforms; ofs.closeStream();
280-
////MLIB_CUDA_SAFE_FREE(d_transforms);
281-
////siftManager->saveToFile("debug/logs/" + std::to_string(siftManager->getCurrentFrame()) + ".sift");
282-
////}
283-
////if (siftManager->getCurrentFrame() == 71) {
284-
////std::cout << "waiting..." << std::endl;
285-
////getchar();
286-
////}
287-
//}
288-
////!!!debugging
289191

290192
// invalidate correspondence
291193
siftManager->InvalidateImageToImageCU(make_uint2(imageIndices.x, imageIndices.y));
@@ -298,24 +200,11 @@ bool SBA::removeMaxResidualCUDA(SIFTImageManager* siftManager, unsigned int numI
298200

299201
returntrue;
300202
}
301-
//else std::cout << "\thighest residual " << m_maxResidual << " from images (" << imageIndices << ")" << std::endl;
302203
returnfalse;
303204
}
304205

305206
voidSBA::printConvergence(const std::string& filename)const
306207
{
307-
//if (m_recordedConvergence.empty()) return;
308-
//std::ofstream s(filename);
309-
//s << m_recordedConvergence.size() << " optimizations" << std::endl;
310-
//s << std::endl;
311-
//for (unsigned int i = 0; i < m_recordedConvergence.size(); i++) {
312-
//s << "[ opt# " << i << " ]" << std::endl;
313-
//for (unsigned int k = 0; k < m_recordedConvergence[i].size(); k++)
314-
//s << "\titer " << k << ": " << m_recordedConvergence[i][k] << std::endl;
315-
//s << std::endl;
316-
//}
317-
//s.close();
318-
319208
if (m_recordedConvergence.empty())return;
320209
std::ofstreams(filename);
321210
for (unsignedint i =0; i < m_recordedConvergence.size(); i++) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp