cdcseacave / openMVS

open Multi-View Stereo reconstruction library
http://cdcseacave.github.io
GNU Affero General Public License v3.0
3.35k stars 908 forks source link

***Buffer overflow detected*** while running PipelineTest on v2.3.0 #1107

Open bouk opened 8 months ago

bouk commented 8 months ago

Describe the bug

Hi, I'm trying to package v2.3.0 for nixpkgs, but I'm running into a 'Buffer overflow detected' during the PipelineTest when running ctest. Strangely this only happens on x86_64-linux and aarch64-linux, not on aarch64-darwin.

I've attached the complete build logs, please let me know if there's more issues.

Expected behavior

There's no crash

Logs

I've pasted the logs in a gist: https://gist.github.com/bouk/a8450bf8d88b9b3f20a33a44ef411d91

Desktop (please complete the following information):

cdcseacave commented 8 months ago

Strange, indeed. Can you pls run the test in Debug mode so we can see where it crashes?

bouk commented 8 months ago

Good suggestion. Here's the log when building in debug:

17:34:24 [App     ] Camera model loaded: platform 0; camera  0; f 1.051x1.051; poses 4
17:34:24 [App     ] Image loaded   0: 00000.jpg
17:34:24 [App     ] Image loaded   1: 00001.jpg
17:34:24 [App     ] Image loaded   2: 00002.jpg
17:34:24 [App     ] Image loaded   3: 00003.jpg
17:34:24 [App     ] Scene loaded from interface format (1ms):
        4 images (4 calibrated) with a total of 1.17 MPixels (0.29 MPixels/image)
        2663 points, 0 vertices, 0 faces
17:34:24 [App     ] K1 =
  672.6200     0.0000   312.1680
    0.0000   672.6200   226.7120
    0.0000     0.0000     1.0000

17:34:24 [App     ] K3 =
  672.6200     0.0000   312.1680
    0.0000   672.6200   226.7120
    0.0000     0.0000     1.0000

17:34:24 [App     ] K2 =
  672.6200     0.0000   312.1680
    0.0000   672.6200   226.7120
    0.0000     0.0000     1.0000

17:34:24 [App     ] K0 =
  672.6200     0.0000   312.1680
    0.0000   672.6200   226.7120
    0.0000     0.0000     1.0000

17:34:24 [App     ] Preparing images for dense reconstruction completed: 4 images (8ms)
17:34:24 [App     ] Reference image   3 sees 3 views:   1(1007pts,0.99scl)   0(763pts,0.97scl)   2(1295pts,1.01scl) (1525 shared points)
17:34:24 [App     ] Reference image   0 sees 3 views:   2(999pts,1.05scl)   3(762pts,1.04scl)   1(1344pts,1.02scl) (1559 shared points)
17:34:24 [App     ] Reference image   1 sees 3 views:   3(1007pts,1.01scl)   2(1431pts,1.02scl)   0(1345pts,0.98scl) (2049 shared points)
17:34:24 [App     ] Reference image   2 sees 3 views:   0(1000pts,0.96scl)   1(1431pts,0.98scl)   3(1295pts,0.99scl) (1999 shared points)
17:34:24 [App     ] Selecting images for dense reconstruction completed: 4 images (5ms)
Estimated depth-maps 1 (25.00%, 9s, ETA 28s)...
Estimated depth-maps 2 (50.00%, 18s, ETA 18s)...
Estimated depth-maps 3 (75.00%, 27s, ETA 9s)... Tests: /build/source/libs/MVS/DepthMap.cpp:648: void MVS::DepthEstimator::ProcessPixel(SEACAVE::IDX): Assertion `ISEQUAL(norm(normalMap0(nx)), 1.f)' failed.
Aborted

void MVS::DepthEstimator::ProcessPixel(SEACAVE::IDX): Assertion ISEQUAL(norm(normalMap0(nx)), 1.f)' failed.

nick0622 commented 5 months ago

I encounter the same problem.

[App ] Selecting images for dense reconstruction completed: 100 images (297ms) DensifyPointCloud: /home/openMVS/libs/MVS/DepthMap.cpp:682: void MVS::DepthEstimator::ProcessPixel(SEACAVE::IDX): Assertion `ISEQUAL(norm(normalMap0(nx)), 1.f)' failed. Aborted (core dumped)

Is this problem solved?

cdcseacave commented 5 months ago

pls build in Release mode

aabrahao commented 2 months ago

The assertion ISEQUAL seems too strict for float point.

Relax the equal tolerance on lib\MVS\Common\Types.h and recompile

define ZERO_TOLERANCE (1e-6) // (1e-7)

define FZERO_TOLERANCE 0.001f // 0.0001f

It works for me!

waqarsqureshi commented 2 months ago

You mean openMVS/libs/Common/Types.h Relax the equal tolerance on lib\MVS\Common\Types.h and recompile

define ZERO_TOLERANCE (1e-6) // (1e-7)

define FZERO_TOLERANCE 0.001f // 0.0001f

This does not solve the buffer overflow detected error occurred during runtime in release mode. Then I changed to debug and compiled again. I did not get the buffer overflow detected error and it went pass through to create scene_dense.ply.

waqarsqureshi commented 2 months ago

The ReconstructMesh fails again with another alert.

waqarsqureshi commented 2 months ago

in order to create the environment and check libraries version I used pixi.sh. Here is the libraries i am using to get the same error. In Debug mode it gives and assert and i the release mode it crashes

python = ">=3.12.5,<4" eigen = ">=3.4.0,<4" opencv = ">=4.10.0,<5" cgal = ">=5.6.1,<6" boost = ">=1.84.0,<2" ceres-solver = ">=2.2.0,<3" libjpeg-turbo = ">=3.0.0,<4" cmake = "3.28.1." cxx-compiler = "1.7.0." libtiff = "4.6.0.*" zlib = ">=1.3.1,<2" libpng = ">=1.6.43,<2" glew = ">=2.1.0,<3" mesa = ">=2.3.0,<3" glfw = ">=3.4,<4" build = ">=0.7.0,<0.8" qt = ">=5.15.8,<6" suitesparse = ">=7.8.1,<8" tbb = ">=2021.12.0,<2022" libgcc = ">=7.2.0,<8" libgcc-ng = ">=14.1.0,<15" libblas = ">=3.9.0,<4" liblapack = ">=3.9.0,<4" binutils = ">=2.40,<3"

waqarsqureshi commented 2 months ago

When you switch to Ubuntu 22.04 and follow the installation step with Eigen 3.4.1 (as mentioned in dockerfile too) then compiled without cuda. The algo run with a breeze.