OpenCV "No package 'opencv' found"

Hello all. I am following along with PJReddie’s Darknet Yolo setup tutorial, and am having trouble with properly installing OpenCV as I get an error “No Package ‘opencv’ found”, both when running the make file (after changing OPENCV=1) and when I run “pkg-config --cflags --libs opencv”.
I have read many many forums on this answer but it always seems that some solutions that work for others don’t work for everyone.

I have tried reinstalling OpenCV through the Ubuntu repository.
I tried "sudo apt install libopencv-dev " in which it says it is already installed.

So I’m aware that it must not be installed in the right location (I think it’s supposed to be /usr/lib but it’s not there.

Small update: so I ended up finding “opencv4.pc” in usr/lib/aarch64-linux-gnu/pkgconfig", how would I move this properly in order to get the darknet program to recognize it?

Edit 2: I am not sure but I believe it might be because I have “opencv4” instead of “opencv”. I will try installing opencv3 in that case.

Would appreciate help.

• Jetson Xavier NX
• DeepStream-5.1
• JetPack 4.5.1 (Latest Xavier NX Development Kit)

1 Like

In Makefile, change the OpenCV part as:

ifeq ($(OPENCV), 1) 
LDFLAGS+= `pkg-config --libs opencv4` -lstdc++
COMMON+= `pkg-config --cflags opencv4` 

and GPU part as:

ifeq ($(GPU), 1) 
COMMON+= -DGPU -I/usr/local/cuda/include/ -I/usr/local/cuda/targets/aarch64-linux/include/
LDFLAGS+= -L/usr/lib/aarch64-linux-gnu -lcuda -lcudart -lcublas -lcurand

Hope it helps.


Thank you for the help. In the end, I attempted to go with AlexeyAB’s darknet yolov3 and it seems to work with what I already had. I may try that attempt if I do decide to use PJReddie’s version!