Error using Caffe: "This tool requires OpenCV; compile with USE_OPENCV."

1.5k Views Asked by At

I want to use Caffe's tool, compute_image_mean to compute the mean image, but the command line tells me that:

This tool requires OpenCV; compile with USE_OPENCV.

I've searched the Internet, and one guy said:

Well, this message suggests that you have compiled caffe without OpenCV, i.e; with USE_OPENCV set to 0 in your Makefile.config. Recompile with that settings commented out (as is the default) and try again. And of course you need to have OpenCV installed for this to work.

But I have already set USE_OPENCV := 0 when I compiled my Caffe.

Could someone help me to solve this problem?

3

There are 3 best solutions below

3
On

I think you have misread the statement you found, it says you are compiling without OpenCV, which means WITH_OPENCV := 0 , to compile Caffe with OpenCV you have to set WITH_OPENCV := 1 , or just comment it out.

0
On

I met the same error information when I used caffe to do my work. I solved this problem by modifying something in the "Makefile.config" file.

The same as the lastest answer, I commented this line "USE_OPENCV := 0" with "#", so after compiling I can use OpenCV's function. I can use this way to deal with it, but you said that when you did this action and got another error. I think you didn't install your OpenCV correctly. Maybe it's your version problem or environment variable error. You can try to install OpneCV again.

0
On

I met the same error when I tried to make lmdb.

At first I uncomment "USE_OPENCV:=0" in the Makefile.config and recompile for many times, but it does not help.

So I try to comment "USE_OPENCV:=0" with # and recompile the caffe, it success.