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

**URL:** <https://forum.opencv.org/t/didnt-find-header-after-libopencv-contrib4-2-installed/2875>\
**Category:** C++\
**Tags:** build, contrib\
**Created:** [April 20, 2021, 1:49pm UTC](https://forum.opencv.org/t/didnt-find-header-after-libopencv-contrib4-2-installed/2875 "2021-04-20T13:49:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lin\_Zhao](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/lin_zhao/32/1863_2.png) [@Lin\_Zhao](https://forum.opencv.org/u/Lin_Zhao)\
**Post date:** [April 20, 2021, 1:49pm UTC](https://forum.opencv.org/t/didnt-find-header-after-libopencv-contrib4-2-installed/2875/1 "2021-04-20T13:49:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [April 20, 2021, 2:56pm UTC](https://forum.opencv.org/t/didnt-find-header-after-libopencv-contrib4-2-installed/2875/2 "2021-04-20T14:56:16Z")

</div>

> [@Lin\_Zhao](#):
>
> installed opencv from command line

what did you do, _exactly_ ?

most likely, you’re better off, [building from github src](https://github.com/opencv/opencv_contrib#readme)

---

<div class="post-metadata">

**Author:** ![Lin\_Zhao](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/lin_zhao/32/1863_2.png) [@Lin\_Zhao](https://forum.opencv.org/u/Lin_Zhao)\
**Post date:** [April 20, 2021, 3:05pm UTC](https://forum.opencv.org/t/didnt-find-header-after-libopencv-contrib4-2-installed/2875/3 "2021-04-20T15:05:09Z")

</div>

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.

```cmake
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.
