How to compile OpenCV with libjpeg-turbo?

萝らか妹 提交于 2020-01-01 04:41:06

问题


I am using OpenCV 2.3.1 on OS X Lion in one of my C++ projects. While my project works great as-is, it depends heavily on JPEG decoding and encoding. I would like to gain a speedup by using libjpeg-turbo, but I cannot find the correct way to link with libjpeg-turbo. Depending on my hackery attempts and which files I edit, I either end up with compiling errors or with a useless OpenCV library (everything compiles correctly, but I cannot open or write JPEG files, though no errors appear in the C++ project).

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


回答1:


To build OpenCV 2.4.0 with libjpeg-turbo you need:

  1. build libjpeg-turbo as a static library
  2. 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




回答2:


OpenCV now has replaced libjpeg completely by libjpeg-turbo: https://github.com/opencv/opencv/pull/11497

It is in the current master and will be available in the upcoming 3.4.2



来源:https://stackoverflow.com/questions/10465209/how-to-compile-opencv-with-libjpeg-turbo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!