uzh-rpg / vilib

CUDA Visual Library by RPG

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpenCV not found

brendanlb opened this issue · comments

commented

I'm trying to compile the library, following the "How to use" section instructions, but when i run make solib -j4, I get that kind of error :

include/vilib/storage/subframe.h:25:32: fatal error: opencv2/core/mat.hpp: No such file or directory

I am using OpenCV 4.1.0 that is compiled from sources. As a consequence, I set these Makefile variables

CUSTOM_OPENCV_SUPPORT=1
CUSTOM_OPENCV_INSTALLATION_PATH=/usr/local/include/opencv4

Any idea why it is not working ? I think it might come from CXX_NVCC_INCLUDES, CXX_LD_DIRS or CXX_LD_FLAGS but I don't know where these should lead to.

hi brendanlb, thanks for your message.
Your CUSTOM_OPENCV_INSTALLATION_PATH seems incorrect.

The underlying logic for the folder paths:

  • ${CUSTOM_OPENCV_INSTALLATION_PATH}/include: this should point to a folder in which you find a folder called opencv2 and other header files.
  • whereas ${CUSTOM_OPENCV_INSTALLATION_PATH}/lib should point to a folder, where you can find libopencv_imgproc.so and similar shared libraries that belong to your current OpenCV build.

Little remark: Our Makefile solution is far from perfect, ideally we would have a CMake file, that would do the discovery automatically, however for manual builds you'd still need to adjust it to add additional header and library search paths.

I also just created a new feature branch, on which I updated our custom OpenCV usage guide.
I tested it on Ubuntu 20.04, CUDA 11, and OpenCV 4.3.0. As I followed suit with the README.md present in the root of our project, my installation folder is /usr/local/opencv-4.3, while in your case it was /usr/local.

If you check out that branch (until it is not merged to master):

git pull origin
git checkout feature/custom_opencv

then apply these for your installation in the Makefile:

CUSTOM_OPENCV_SUPPORT=1
CUSTOM_OPENCV_INSTALLATION_PATH=/usr/local

Then the compilation should work just fine.

commented

Hello baliika, thank you for your answer and your work. Following the instructions in your second message, I was able to build the library. I am using Ubuntu 18.04, CUDA 11.0 and OpenCV 4.1.0.

Unfortunately, I am now encountering another problem. When I run ./test_vilib, I get the following error:

brendan@HP-EliteDesk:~/lib/vilib/visual_lib$ ./test_vilib 
### Image Pyramid
 CPU (w/o. preallocated array)      : min: 48, max: 87, avg: 49.44 usec
 GPU Device (w. preallocated array) : min: 12.992, max: 38.784, avg: 14.808 usec
 GPU Host (w. preallocated array)   : min: 5, max: 19, avg: 5.87 usec
 Success: OK
### SubframePool
 Pool creation (with 10 frames)     : min: 254, max: 413, avg: 267.99 usec
 Preallocated access                : min: 0, max: 1, avg: 0.066 usec
 New allocation                     : min: 1, max: 248, avg: 22.127 usec
 Success: OK
### PyramidPool
 Pool creation (with 10 frames)     : min: 393, max: 563, avg: 411.56 usec
 Preallocated access                : min: 0, max: 1, avg: 0.288 usec
 New allocation                     : min: 7, max: 233, avg: 36.81 usec
 Success: OK
### FAST detector
terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoi
Abandon (core dumped)

Any idea of what is the problem now ?

hi brendanlb,
After the compilation,
Did you properly prepare the test data for the feature detector evaluation, i.e. did you run:

cd test/images
# Follow the instructions
./create_feature_detector_evaluation_data.sh

Once done, please make sure, that you have the extracted images present in test/images/euroc/ ... , because it can happen, due to missing dependencies that the python script failed executing.

I'll make an update to our test bench so that the error is more clear in this case.

commented

It seems that the Python script is not running correctly on my computer as some package aren't found. I will look into it and try to find a solution. Furthermore, it seems that these two packages are not used in your script and could be deleted :

from PIL import Image
import numpy as np

Thanks brendanlb,
I updated our python extractor script. Additionally, I also added a more meaningful error message for the missing dataset.