robotology / stereo-vision

Repository containing apps for stereo vision
https://robotology.github.io/stereo-vision/
GNU General Public License v2.0
19 stars 19 forks source link

SFM and DisparityModule are not working as expected #27

Closed xEnVrE closed 3 years ago

xEnVrE commented 3 years ago

Today me and @Nicogene, tried to use both SFM and DisparityModule on the iCubGenova01 setup (Ubuntu 18.04, OpenCV 3.4.0 build with CUDA 10.0).

Unfortunately, we were not able to run them as expected (our test consisted in launching the module and check the output disparity from port /DisparityModule/disp:o or /SFM/disp:o depending on the module).

DisparityModule runs but, after connecting the input images, it does not produce any output in /DisparityModule/disp:o.

SFM, instead, stops at runtime with the following error:

OpenCV Error: Bad argument (unrecognized or unsuported array type) in cvPtr2D, file (...)
terminate called after throwing an instance of 'cv::Exception'
what(): /usr/loca/src/robot/opencv/modules/core/src/array.cpp:1839: error: (-5) unrecognized or unsupported array type in function cvPtr2D

A working commit that we found, for SFM, is https://github.com/robotology/stereo-vision/commit/9cbc03ae5d7983bc908d2089abfb5cfae5e55f42. We tried to bisect from there but we were not able to compile halfways commits.

traversaro commented 3 years ago

SFM, instead, stops at runtime with the following error:

That error sounds like you have two version of OpenCV in your system, can you check with opencv are you linking in SFM by running ldd SFM ?

Nicogene commented 3 years ago

SFM, instead, stops at runtime with the following error:

The line triggering that exception is https://github.com/robotology/stereo-vision/blob/4875485f30e3daf7c956f8eda0607442fdead8a7/modules/SFM/SFM.cpp#L1324

That error sounds like you have two version of OpenCV in your system, can you check with opencv are you linking in SFM by running ldd SFM ?

We checked and it seemed ok

traversaro commented 3 years ago

The PR https://github.com/robotology/stereo-vision/pull/29 modifies the DisparityModule, how can it can solve the SFM crash?

pattacini commented 3 years ago

@Nicogene any feedback?

Nicogene commented 3 years ago

The PR #29 modifies the DisparityModule, how can it solve the SFM crash?

The crash has been solved by #30. With @damianomal investigated for a while but we didn't figure out why the old way to access to the Mat gave problems, using the "new" one works

Moreover, we fixed a double free in closure of DisparityModule.