How to compile OpenCV with libjpeg-turbo?

I am using OpenCV 2.3.1 for OS X Lion in one of my C ++ projects. Although my project works just fine, it depends a lot on JPEG decoding and encoding. I would like to get acceleration using libjpeg-turbo, but I cannot find the correct way to communicate with libjpeg-turbo. Depending on my hacking attempts and the files I'm editing, I either finish compiling the errors or useless OpenCV library (everything compiles correctly, but I can't open or write JPEG files, although there are no errors in the C ++ project).

Can anyone explain how you can compile OpenCV with libjpeg-turbo for faster JPEG decoding / encoding?

+8
c ++ opencv libjpeg-turbo
source share
1 answer

To build OpenCV 2.4.0 with libjpeg-turbo you need:

  • build libjpeg-turbo as a static library
  • configure OpenCV with the following command:

cmake -DWITH_JPEG=ON -DBUILD_JPEG=OFF -DJPEG_INCLUDE_DIR=/path/to/libjepeg-turbo/include/ -DJPEG_LIBRARY=/path/to/libjpeg-turbo/lib/libjpeg.a /path/to/OpenCV

+17
source share

All Articles