fbergama / wass

WASS (Waves Acquisition Stereo System) is an optimized stereo processing pipeline for sea waves 3D reconstruction.
GNU General Public License v3.0
38 stars 13 forks source link

Re: Error running test_pipeline #9

Open huangya17 opened 5 years ago

huangya17 commented 5 years ago

Hello,

Could you help to direct me regards to the following error n MATLAB at the bottom fo this message while running test_pipeline.m?

Following installation instruction for Mac OSX (10.14.4 (18E226) Mojave), I have built from OpenCV 3.4.5 with the confirmation message below using cd ../dist/bin ./wass_prepare

wass_prepare v. 1.5_heads/master-0-g92603b1

[Release] Darwin-18.5.0 - AppleClang, OpenCV 3.4.5 wass_prepare arguments: --workdir arg Workdir name --calibdir arg Calibration data directory --c0 arg Cam0 image file --c1 arg Cam1 image file

The sessions "RUNNING" wass_prepare, wass_match, wass_autoclaibrate all seem to be ok. But the wass_stereo was aborted.

During downloading OpenCV, I have to use: brew install homebrew/core/opencv@3 as the original instruction did not work. Home brew will only install opencv (which is actually opencv 4.0) not opencv3 Therefore I have to make subsequent change to use: make ../src/ -DOpenCV_DIR="/usr/local/opt/opencv@3/share/OpenCV"

And before that I have followed the recommendations after installing opencv@3: ==> Caveats opencv@3 is keg-only, which means it was not symlinked into /usr/local, because this is an alternate version of another formula. If you need to have opencv@3 first in your PATH run: echo 'export PATH="/usr/local/opt/opencv@3/bin:$PATH"' >> ~/.bash_profile For compilers to find opencv@3 you may need to set: export LDFLAGS="-L/usr/local/opt/opencv@3/lib" export CPPFLAGS="-I/usr/local/opt/opencv@3/include" For pkg-config to find opencv@3 you may need to set: export PKG_CONFIG_PATH="/usr/local/opt/opencv@3/lib/pkgconfig"

Thank you, and

Kind regards,

Ya


** RUNNING wass_stereo *****


wass_stereo v. 1.5_heads/master-0-g92603b1

[Release] Darwin-18.5.0 - AppleClang, OpenCV 3.4.5

wass_stereo (info): Loding configuration file /Users/ya/wass/test/WASS_TEST/synth/config/stereo_config.txt wass_stereo (info): Reconstructing "/Users/ya/wass/test/output/000000_wd/" wass_stereo->load_data (info): image 0 loaded, Size: 2456x2058 wass_stereo->load_data (info): image 1 loaded, Size: 2456x2058 wass_stereo->load_data (info): original size: 2456x2058 wass_stereo->load_data (info): scaled size: 736x617 wass_stereo->load_data (info): scale: 0.299674 [P|10|100] wass_stereo->rectify (info): rectifying... wass_stereo->rectify (info): Detected stereo setup: wass_stereo->rectify (info): CAM1 (L) --------- CAM0 (R) wass_stereo->rectify (info): Rectifying via cv::stereoRectify wass_stereo->rectify (error): the epipole lies inside the image plane [P|20|100] libc++abi.dylib: terminating with uncaught exception of type cv::Exception: OpenCV(3.4.5) /tmp/opencv@3-20190505-97953-1nkl1lm/opencv-3.4.5/modules/imgproc/src/color.cpp:181: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

/bin/bash: line 1: 4022 Abort trap: 6 /Users/ya/wass/test/../dist/bin/wass_stereo /Users/ya/wass/test/WASS_TEST/synth/config/stereo_config.txt /Users/ya/wass/test/output/000000_wd/ LD_LIBRARY_PATH="" && /Users/ya/wass/test/../dist/bin/wass_stereo /Users/ya/wass/test/WASS_TEST/synth/config/stereo_config.txt /Users/ya/wass/test/output/000000_wd/: Aborted Error using test_pipeline (line 143) component exited with non-zero return code

fbergama commented 5 years ago

Hello, the problem is the following:

wass_stereo->rectify` (error): the epipole lies inside the image plane

that can be caused either by an incorrect spatial configuration of the cameras (ie. one in front of the other) or failure in extrinsic calibration. Did you use the "test_pipeline.m" script with the provided test data or with some other?

Filippo

huangya17 commented 5 years ago

Dear Filippo,

Thank you for your reply!

I have faithfully followed the online instruction. The error is entirely from just running test_pipeline.m alone with the accompanying test data, and nothing else.

As mentioned in my original message, during the brew opencv installation, I have to use opencv@3 and with suggested commands.

Your help would be much appreciated.

Best wishes,

Ya

fbergama commented 5 years ago

Ok, I see that you are using OpenCV version 3.4.5 (as instructed by the docs suggesting to install opencv@3, so that's my fault) but since version 3.4.1 the stereoRectify function is bugged:

https://github.com/opencv/opencv/issues/11131#issuecomment-375948886

To overcome this, I've actually re-implemented that function with various improvements. You can enable this by inserting the following:

USE_CUSTOM_STEREORECTIFY=true

in the file test/WASS_TEST/synth/config/stereo_config.txt. I think you'll also have to change the DISPARITY_OFFSET line to:

DISPARITY_OFFSET=-120

Apart from that, you can fix the problem by either:

1) Try to install OpenCV 3.4.0 2) Use Docker

Let me know if this solves the problem.

Filippo

huangya17 commented 5 years ago

Hi Filippo,

Thank you! I will definitely give it a go to modify the current code.

Meanwhile, could you be more specific about how to use docker? I installed it and it seems to sun ok, but the instruction online does not tell how to use it to by pass the problem here.

I tried to use home brew to install opencv, but I could not find the option to install OpenCV 3.4.0. With my current situation, could you recommend a way for me as how to install OpenCV 3.4.0 on my mac that could work with the rest of the existing setup?

Bests,

Ya

fbergama commented 5 years ago

If you run the pipeline via Docker all the required (and tested) dependencies are installed inside the container. Just build the container by running

./Docker/wass_docker_build.sh

and then run the scripts:

run_test_docker.sh (via shell) and test_pipeline_norun.m via Matlab. You can find those scripts in the "test" directory.

huangya17 commented 5 years ago

The same error message remains after trying to modify test/WASS_TEST/synth/config/stereo_config.txt

I also tried to modify wass_stereo from: INCFG_REQUIRE( bool, USE_CUSTOM_STEREORECTIFY, false, "Use built-in stereorectify algorithm instead of the one provided by OpenCV" ) to: INCFG_REQUIRE( bool, USE_CUSTOM_STEREORECTIFY, true, "Use built-in stereorectify algorithm instead of the one provided by OpenCV" )

But still no improvement.

Bests

Ya

fbergama commented 5 years ago

Can you paste the wass_stereo output log again?

huangya17 commented 5 years ago

If you run the pipeline via Docker all the required (and tested) dependencies are installed inside the container. Just build the container by running

./Docker/wass_docker_build.sh

and then run the scripts:

run_test_docker.sh (via shell) and test_pipeline_norun.m via Matlab. You can find those scripts in the "test" directory.

So to run Docker, I have clicked the icon and then log in to Docker to make it running on my mac. Then in ternminal I go into the directory wass/Docker, and run the following:

xtec5003huangy:Docker ya$ wass_docker_build.sh -bash: wass_docker_build.sh: command not found

How would I go about?

I am sorry for my innocence on the coding common senses...

Kind regards,

Ya

huangya17 commented 5 years ago

The wass stereo output log after running test_pipeline.m


** RUNNING wass_stereo *****


wass_stereo v. 1.5_heads/master-0-g92603b1

[Release] Darwin-18.5.0 - AppleClang, OpenCV 3.4.5

wass_stereo (info): Loding configuration file /Users/ya/wass/test/WASS_TEST/synth/config/stereo_config.txt wass_stereo (info): Reconstructing "/Users/ya/wass/test/output/000000_wd/" wass_stereo->load_data (info): image 0 loaded, Size: 2456x2058 wass_stereo->load_data (info): image 1 loaded, Size: 2456x2058 wass_stereo->load_data (info): original size: 2456x2058 wass_stereo->load_data (info): scaled size: 736x617 wass_stereo->load_data (info): scale: 0.299674 [P|10|100] wass_stereo->rectify (info): rectifying... wass_stereo->rectify (info): Detected stereo setup: wass_stereo->rectify (info): CAM1 (L) --------- CAM0 (R) wass_stereo->rectify (info): Rectifying via cv::stereoRectify wass_stereo->rectify (error): the epipole lies inside the image plane [P|20|100] libc++abi.dylib: terminating with uncaught exception of type cv::Exception: OpenCV(3.4.5) /tmp/opencv@3-20190505-97953-1nkl1lm/opencv-3.4.5/modules/imgproc/src/color.cpp:181: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

/bin/bash: line 1: 7060 Abort trap: 6 /Users/ya/wass/test/../dist/bin/wass_stereo /Users/ya/wass/test/WASS_TEST/synth/config/stereo_config.txt /Users/ya/wass/test/output/000000_wd/ LD_LIBRARY_PATH="" && /Users/ya/wass/test/../dist/bin/wass_stereo /Users/ya/wass/test/WASS_TEST/synth/config/stereo_config.txt /Users/ya/wass/test/output/000000_wd/: Aborted Error using test_pipeline (line 143) component exited with non-zero return code

huangya17 commented 5 years ago

If you run the pipeline via Docker all the required (and tested) dependencies are installed inside the container. Just build the container by running

./Docker/wass_docker_build.sh

and then run the scripts:

run_test_docker.sh (via shell) and test_pipeline_norun.m via Matlab. You can find those scripts in the "test" directory.

Hi Filippo,

Trying to use the Docker approach, I have installed and tested the Docker on my mac with hello-world which is working. Then with it running, I entered the following in the terminal. When prompted with 'Password' I input the root password for my mac. But there seems to be a problem...

$ cd wass $ sudo ./Docker/wass_docker_build.sh Password: Sending build context to Docker daemon 145MB Step 1/45 : FROM ubuntu:16.04 Get https://registry-1.docker.io/v2/library/ubuntu/manifests/16.04: unauthorized: incorrect username or password $

Any suggestion?

Thank you

Ya

fbergama commented 5 years ago

Try to use it without sudo

huangya17 commented 5 years ago

Thanks. Docker seems to work now without sudo. But the following error occurs:

Scanning dependencies of target wass_autocalibrate [ 69%] Building CXX object wass_autocalibrate/CMakeFiles/wass_autocalibrate.dir/wass_autocalibrate.cpp.o [ 73%] Building CXX object wass_autocalibrate/CMakeFiles/wass_autocalibrate.dir/sba_driver.cpp.o [ 76%] Building CXX object wass_autocalibrate/CMakeFiles/wass_autocalibrate.dir/wass/ext/incfg/incfg.cpp.o [ 80%] Linking CXX executable wass_autocalibrate CMakeFiles/wass_autocalibrate.dir/sba_driver.cpp.o: In function img_projsRTS_x(double*, sba_crsm*, int*, int*, double*, void*)': sba_driver.cpp:(.text+0x228): undefined reference tosba_crsm_col_elmidxs' CMakeFiles/wass_autocalibrate.dir/sba_driver.cpp.o: In function img_projsRTS_jac_x(double*, sba_crsm*, int*, int*, double*, void*)': sba_driver.cpp:(.text+0x21f7): undefined reference tosba_crsm_col_elmidxs' CMakeFiles/wass_autocalibrate.dir/sba_driver.cpp.o: In function sba_driver(std::vector<cv::Matx<double, 4, 4>, std::allocator<cv::Matx<double, 4, 4> > > const&, std::vector<cv::Vec<double, 3>, std::allocator<cv::Vec<double, 3> > > const&, std::vector<std::vector<cv::Vec<double, 2>, std::allocator<cv::Vec<double, 2> > >, std::allocator<std::vector<cv::Vec<double, 2>, std::allocator<cv::Vec<double, 2> > > > > const&, std::vector<cv::Mat, std::allocator<cv::Mat> >&, std::vector<cv::Mat, std::allocator<cv::Mat> >&)': sba_driver.cpp:(.text+0x2a4b): undefined reference tosba_motstr_levmar_x' collect2: error: ld returned 1 exit status make[2]: [wass_autocalibrate/wass_autocalibrate] Error 1 wass_autocalibrate/CMakeFiles/wass_autocalibrate.dir/build.make:189: recipe for target 'wass_autocalibrate/wass_autocalibrate' failed make[1]: [wass_autocalibrate/CMakeFiles/wass_autocalibrate.dir/all] Error 2 CMakeFiles/Makefile2:307: recipe for target 'wass_autocalibrate/CMakeFiles/wass_autocalibrate.dir/all' failed Makefile:127: recipe for target 'all' failed make: *** [all] Error 2 The command '/bin/sh -c cmake ../src/ -DCMAKE_BUILD_TYPE="Release" -DOpenCV_DIR=/LIBS/opencv/build/ && make && make install' returned a non-zero code: 2

huangya17 commented 5 years ago

Hello Filippo,

Any update on the above message yet?

Kind regards,

Ya

fbergama commented 5 years ago

Hi, I don't know, it should work correctly since you are building WASS on exactly the same environment I use (via Docker). I've tried building it just now in OSX, Windows, and Linux with no issues.

What version of Docker are you using? Also, when building the Docker image start from a pristine git clone of the WASS repository

Filippo