Ask Your Question

How to build OpenCV 3.0.0 with libjpeg turbo?

asked 2015-08-15 11:58:49 -0600

ChaoyuanYeh gravatar image

updated 2015-08-15 12:10:27 -0600


I'm trying to build OpenCV 3.0.0 with libjpeg turbo 1.4.1. The only relevant information I can find is a post from Stack Overflow :

I try to follow this and did the following in cmake-gui: 1) uncheck : BUILD_JPEG, 2) add entry(PATH) : JPEG_INCLUDE_DIR=C:/libjepeg-turbo64/include/, 3) add entry(STRING) : JPEG_LIBRARY=C:/libjpeg-turbo64/lib/libjpeg.a C:/OpenCV-3.0.0

When I hit generate in cmakge-gui, the log reads : "Found JPEG: C:/libjpeg-turbo64/lib/libjpeg.a C:/opencv-3.0.0_turbo" But when I build the solution in openCV, a great majority of the projects failed, showing fatal link error.

I have two questions here: 1) What does "JPEG_LIBRARY=C:/libjpeg-turbo64/lib/libjpeg.a C:/OpenCV-3.0.0" really mean? I just copy the line and make some changes that I understand but it doesn't quite make sense to me. I can't find any file named libjpeg in the lib folder, but there is a jpeg.lib.

2) What should I do if I want to build OpenCV 3.0.0 with libjpeg-turbo?


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-08-15 13:53:04 -0600

I think that your platform is Windows(64bit).
Is my understanding correct?

If your answer is 'yes', I think that you need to install libjpeg-turbo-1.4.1-vc64.exe and add the entry of JPEG_LIBRARY(Value is C:/libjpeg-turbo64/lib/jpeg-static.lib) as FILEPATH. Please try it.

edit flag offensive delete link more


Thank you. I actually used turbojpeg-static.lib and I can build openCV successfully. Now I'm wondering, between jpeg-static.lib and turbojpeg-static.lib, which one should I use?

ChaoyuanYeh gravatar imageChaoyuanYeh ( 2015-08-15 16:05:41 -0600 )edit

The turbojpeg-static.lib provides 'TurboJPEG C API', too.
If you use this API, you need to link this library.

You can know 'TurboJPEG C API' by the following information.

Current OpenCV uses only 'libjpeg API'.
So, I used jpeg-static.lib.

dandelion1124 gravatar imagedandelion1124 ( 2015-08-15 18:38:53 -0600 )edit

Question Tools

1 follower


Asked: 2015-08-15 11:58:49 -0600

Seen: 5,222 times

Last updated: Aug 15 '15