Didn't find header after libopencv-contrib4.2 installed

Hi, I am using Ubuntu 20.04 and installed opencv from command line like libopencv-contrib-dev libopencv-contrib4.2 libopencv-dev. I can find my opencv lib and header but not opencv-contrib stuff.

Just wondering the only way to use opencv_contib is to build from source? Thanks for your time.

what did you do, exactly ?

most likely, you’re better off, building from github src

thanks for your reply, actually, the opencv is installed by ROS. I do build from source with opencv and opencv_contrib. But it’s have a issue with ROS package cv_bridge since it’s always to link the lib like /usr/lib/x86_64-linux-gnu/libopencv_calib3d.so.4.2.0.

I’ve set LD_LIBRARY_PATH and PATH. Also, set CMakelists.txt like below and all output are correct, which means cmake found the right version I installed.

SET(OpenCV_DIR /home/lin/develop/3rd/opencv/install/opencv-4.2.0/lib/cmake/opencv4/)   
find_package(OpenCV 4.2)    
message(STATUS "OpenCV library status:")  
message(STATUS "    config: ${OpenCV_DIR}")  
message(STATUS "    version: ${OpenCV_VERSION}")  
message(STATUS "    libraries: ${OpenCV_LIBS}")  
message(STATUS "    include path: ${OpenCV_INCLUDE_DIRS}")

Outputs:

  • OpenCV library status:
    – config: /home/lin/develop/3rd/opencv/install/opencv-4.2.0/lib/cmake/opencv4/
    – version: 4.2.0
    – libraries: opencv_calib3d;opencv_core;opencv_dnn;opencv_features2d;opencv_flann;opencv_gapi;opencv_highgui;opencv_imgcodecs;opencv_imgproc;opencv_ml;opencv_objdetect;opencv_photo;opencv_stitching;opencv_video;opencv_videoio;opencv_aruco;opencv_bgsegm;opencv_bioinspired;opencv_ccalib;opencv_cvv;opencv_datasets;opencv_dnn_objdetect;opencv_dnn_superres;opencv_dpm;opencv_face;opencv_freetype;opencv_fuzzy;opencv_hdf;opencv_hfs;opencv_img_hash;opencv_line_descriptor;opencv_optflow;opencv_phase_unwrapping;opencv_plot;opencv_quality;opencv_reg;opencv_rgbd;opencv_saliency;opencv_sfm;opencv_shape;opencv_stereo;opencv_structured_light;opencv_superres;opencv_surface_matching;opencv_text;opencv_tracking;opencv_videostab;opencv_viz;opencv_xfeatures2d;opencv_ximgproc;opencv_xobjdetect;opencv_xphoto
    – include path: /home/lin/develop/3rd/opencv/install/opencv-4.2.0/include/opencv4

I just want to make sure if opencv_contrib can be installed by command line libopencv-contrib4.2. Since I can find they were insatlled , but no header and lib are found in my machine.

Thanks for your time.