Open FinalEvilution opened 2 years ago
Thx for the detailed issue. All steps look good, except the one that splits the scene in sub-scenes. The crash is not significant as it seems to be a problem with the printing function (I saw that before on linux, not sure why). So can you pls share the scene.mvs and the undistorted images to debug why it does not create sub-scenes?
Hear you go. openmvs.zip
thank you, I'll try to find some time during the weekend to look at this
I get the same segfault with verbose enabled, with gdb pointing to the formatting functions. Trimmed logs and stack trace:
Switching the size checks to the 'buffer size - 1' fixed the segfault for me, but I'm not familiar enough with vsntprintf
and the like to know if this is correct for Windows et al and/or mangles the logs.
diff --git a/libs/Common/Log.cpp b/libs/Common/Log.cpp
index da19bd1..823b8ef 100644
--- a/libs/Common/Log.cpp
+++ b/libs/Common/Log.cpp
@@ -149,7 +149,7 @@ void Log::_Record(Idx lt, LPCTSTR szFormat, va_list args)
#else
LPCTSTR const logType(lt<m_arrLogTypes.GetSize() ? m_arrLogTypes[lt] : g_appType);
#endif
- if ((size_t)_vsntprintf(szBuffer, 2048, szFormat, args) > 2048) {
+ if ((size_t)_vsntprintf(szBuffer, 2047, szFormat, args) > 2047) {
// not enough space for the full string, reprint dynamically
m_message.FormatSafe("%s [%s] %s" LINE_SEPARATOR_STR, szTime, logType, String::FormatStringSafe(szFormat, args).c_str());
} else {
diff --git a/libs/Common/Strings.h b/libs/Common/Strings.h
index 711d0a5..90f4467 100644
--- a/libs/Common/Strings.h
+++ b/libs/Common/Strings.h
@@ -44,8 +44,8 @@ public:
va_list args;
va_start(args, szFormat);
TCHAR szBuffer[2048];
- const size_t len((size_t)_vsntprintf(szBuffer, 2048, szFormat, args));
- if (len > 2048) {
+ const size_t len((size_t)_vsntprintf(szBuffer, 2047, szFormat, args));
+ if (len > 2047) {
*this = FormatStringSafe(szFormat, args);
va_end(args);
} else {
@@ -70,8 +70,8 @@ public:
va_list args;
va_start(args, szFormat);
TCHAR szBuffer[2048];
- const size_t len((size_t)_vsntprintf(szBuffer, 2048, szFormat, args));
- if (len > 2048) {
+ const size_t len((size_t)_vsntprintf(szBuffer, 2047, szFormat, args));
+ if (len > 2047) {
const String str(FormatStringSafe(szFormat, args));
va_end(args);
return str;
@erikreed that might be a different issue
@FinalEvilution i think i solved your issue, please try the latest develop
I've pulled the latest develop and tried building it, but make fails with the following error. build-error.txt
I'm trying to test DensifyPointCloud clustering on the sheffield_cross dataset using the example commands at https://github.com/cdcseacave/openMVS/issues/438#issuecomment-800972596 but step 2 is not creating any sub-scenes (scene_0000.mvs, scene_0001.mvs, scene_0002.mvs, etc). Also when running step 2 with verbosity level 2 it segfaults.
System Info
The following is the commands, command output, and the directory contents after running the command.
Export from openMVG
../../../openMVG/openMVG_Build/Linux-x86_64-RELEASE/openMVG_main_openMVG2openMVS -i ../sfm_data.bin -o scene.mvs -d ./ -n 1
cmd1.txt cmd1_ls.txtExample step 1
../../../openMVS/openMVS_build/bin/DensifyPointCloud scene.mvs --max-resolution 800 --fusion-mode 1 --max-threads 4
cmd2.txt cmd2_ls.txtExample step 2
../../../openMVS/openMVS_build/bin/DensifyPointCloud scene.mvs --sub-scene-area 165000 --max-threads 4 -v 1
cmd3.txt cmd3_ls.txtI then compiled a build of openMVS with CMAKE_BUILD_TYPE=RelWithDebInfo and ran it in gdb to get a backtrace.
Example step 2 verbosity level 2 segfault
gdb --args ../../../openMVS_debug/openMVS_build/bin/DensifyPointCloud scene.mvs --sub-scene-area 165000 --max-threads 4 -v 2
Backtrace `#0 0x00007ffff3e3fab6 in () at /lib64/libc.so.61 0x00007ffff3e0f5c8 in () at /lib64/libc.so.6
2 0x00007ffff3e1fd06 in () at /lib64/libc.so.6
3 0x0000555555735286 in vsnprintf (ap=0x7fffffffcca0, fmt=0x55555574afa8 "Scene split (%g max-area): %u chunks (%s)", n=2048, s=0x7fffffffc450 "Scene split (0 max-area): 165000 chunks (\262kUUU")
4 SEACAVE::Log::_Record(unsigned int, char const, __va_list_tag)
5 0x0000555555735443 in SEACAVE::Log::Write(char const*, ...)
6 0x00005555556c6298 in MVS::Scene::Split(SEACAVE::cList<MVS::Scene::ImagesChunk, MVS::Scene::ImagesChunk const&, 2, 16, unsigned int>&, unsigned int, int) const
7 0x000055555559d347 in main(int, LPCTSTR*) (argc=, argv=) at /home/jonathan/openMVS_debug/apps/DensifyPointCloud/DensifyPointCloud.cpp:261`
cmd3_segmentation_fault.txt
Screenshots of
If you need any more information please let me know.