1 | initial version |
Testing Testing
(I am trying to post a instruction, but always fail)
2 | No.2 Revision |
Testing
Testing
(I am trying to post a instruction, but always fail)
I have tried to build OpenCV 3.2 with libjpeg-turbo 1.3.0. It crashes in imwrite without any error message. Then I fallback to the libjpeg version used by Qt 5.8. That works.1) Download opencv 3.2 and opencv contrib 3.2 and extract them:
$ ls opencv-3.2.0 opencv_contrib-3.2.0
2) Download libjpeg source code
Since I have already downloaded the Qt 5.8 source code, I simply use Qt's version.
3) Patch opencv-3.2.0/platforms/ios/build_framework.py
--- build_framework.py.orig 2017-02-13 11:12:14.000000000 +0800
+++ build_framework.py 2017-02-13 11:13:42.000000000 +0800
@@ -135,6 +135,7 @@
cmakecmd.append("-DENABLE_NEON=ON")
cmakecmd.append(self.opencv)
cmakecmd.extend(cmakeargs)
+ cmakecmd.extend(["-DWITH_JPEG=ON", "-DBUILD_JPEG=OFF","-DJPEG_INCLUDE_DIR=/opt/libjpeg-turbo/include", "-DJPEG_LIBRARY=/opt/libjpeg-turbo/lib64/libjpeg.a"])
execute(cmakecmd, cwd = builddir)
# Clean and build
clean_dir = os.path.join(builddir, "install")
You should change the parameter of -DJPEG_INCLUDE_DIR and -DJPEG_LIBRARY according to your environment
-DJPEG_INCLUDE_DIR = Path to the source code
e.g ~/qt-everywhere-opensource-src-5.8.0/qtbase/src/3rdparty/libjpeg
-DJPEG_LIBRARY = Path to the libqjpeg.a from Qt SDK
e.g ~/Qt/5.8/ios/plugins/imageformats/libqjpeg.a
4) Build
cd opencv-3.2.0
mkdir build
cd build
../platforms/ios/build_framework.py ios --contrib=../../opencv_contrib-3.2.0