一区二区三区日韩精品-日韩经典一区二区三区-五月激情综合丁香婷婷-欧美精品中文字幕专区

分享

Building OpenCV

 特—亮 2015-03-03
I was working on this post for a long time, and I didn't share any information before because I Was facing a big problem to get the highgui library successfully built to our embedded system. And as you may know, the highgui is very important when you need to open a video stream, create a camera device and even work with windows in OpenCV.

Last week I managed to build it successfully using the latest Freescale's BSP (kernel 3.0.35) and I'm going to show you how to do that in the following lines.

First of all,  you can download the Freescale's i.MX6 BSP here !


Unfortunately getting the latest BSP doesn't mean you are going to get all the latest packages. The only things that are really update in this BSP and probably all others are the kernel and specific drivers for the current hardware you are going to work with. The most commons packages like GTK, GLIB2, PANGO, CAIRO and etc... are not updated, and in order to build the new OpenCV 2.4.X we will need to upgrade these packages and install a new one, the v4l-utils.

So let's stop with this BLAH BLAH BLAH and get into what is really interesting  !


Step 1 - Building the dependencies
-----------------------------------------------------------
 1) Assuming you already have the BSP installed (min profile) in your host machine, you will need to upgrade the GLIB2 package and install the v2l-utils one.

2) Get the new spec files at: https://github.com/andreluizeng/ltib-pkgs-upgrade

3) the new GLIB2 now has a dependency, the LIBFFI. (you can also get the spec file of this lib in the link above.

4) Build & install the libffi as follows:
     mkdir ../ltib/dist/lfs-5.1/libffi
     cp ../git/ltib-pkgs-upgrade/libffi.spec ../ltib/dist/lfs-5.1/libffi
     cp ../git/ltib-pkgs-upgrade/libffi-3.0.12-includedir-1.patch /opt/freescale/pkgs
     cp ../downloads/libffi.tar.gz /opt/freescale/pkgs
* you can find the link that you can get the libffi from.
      cd ../ltib
     ./ltib -p libffi.spec -m prep
     ./ltib -p libffi.spec -m scbuild
     ./ltib -p libffi.spec -m scdeploy

5) Build & install the new glib2
    cd ../ltib
    cp ../git/ltib-pkgs-upgrade/glib2.spec ../ltib/dist/lfs-5.1/glib2
    cp ../downloads/glib-2.35.9.tar.xz /opt/freescale/pkgs
    ./ltib -p glib2.spec -m prep
    ./ltib -p glib2.spec -m scbuild
    ./ltib -p glib2.spec -m scdeploy

6) Build & install the v4l-utils packages
    mkdir ../ltib/dist/lfs-5.1/v4l-utils
    cp ../git/ltib-pkgs-upgrade/v4l-utils.spec ../ltib/dist/lfs-5.1/v4l-utils
    cp ../downloads/v4l-utils-0.9.3.tar.bz2 /opt/freescale/pkgs
    cd ../ltib

    ./ltib -p v4l-utils.spec -m prep
    ./ltib -p v4l-utils.spec -m scbuild
    ./ltib -p v4l-utils.spec -m scdeploy


After all these steps you should have the necessary dependencies built for now building the OpenCV 2.4.X.


Step 2 - Cross-Compiling OpenCV-2.4.X
-----------------------------------------------------------------

When Cross-compiling using cmake you need a special file containing the information about the toolchain you are going to use. In our case we can create this file as:


1) touch toolchain.cmake & vi toolchain.cmake

2) add the following information:

               # this one is important
               set( CMAKE_SYSTEM_NAME Linux )

               #this one not so much
               set( CMAKE_SYSTEM_PROCESSOR arm )

               # specify the cross compiler
                set( CMAKE_C_COMPILER /opt/freescale/usr/local/gcc-4.6.2-glibc-    2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi-gcc )
               set( CMAKE_CXX_COMPILER /opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi-g++ )

              # where is the target environment - point to your rootfs here
              set( CMAKE_FIND_ROOT_PATH  /home/andre/bsps/imx6x/1301/ltib/rootfs )

              # search for programs in the build host directories
              set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )

             # for libraries and headers in the target directories
             set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
             set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )

             # point to your rootfs path here 
             set( CMAKE_CXX_FLAGS "-L/home/andre/bsps/imx6x/1301/ltib/rootfs/usr/lib" )

3) download OpenCV-2.4.X here or here.

4) untar the package:
    tar -xvf OpenCV-2.4.2.tar.bz2

5) cd OpenCV-2.4.2
    mkdir build
    cd build
    cp ../../toolchain.cmake .
    cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake ../

after these steps you should have the necessary files to be built in your build directory, you now just need to configure which extra packages you want to add or remove for your OpenCV profile.

In your build folder:

6) ccmake .

7) you can let your configuration similar to mine:

BUILD_DOCS                          OFF
 BUILD_EXAMPLES                OFF
BUILD_JASPER                       OFF
BUILD_JPEG                           OFF
 BUILD_PACKAGE                  ON
BUILD_PERF_TESTS              ON
 BUILD_PNG                           OFF
 BUILD_SHARED_LIBS           ON
 BUILD_TESTS                        ON
 BUILD_TIFF                           OFF
 BUILD_WITH_DEBUG_INFO ON
 BUILD_ZLIB                          OFF
 BUILD_opencv_calib3d        ON
 BUILD_opencv_contrib        ON
 BUILD_opencv_core             ON
 BUILD_opencv_features2d  ON
 BUILD_opencv_flann            ON
 BUILD_opencv_gpu              ON
 BUILD_opencv_highgui        ON
 BUILD_opencv_imgproc       ON
 BUILD_opencv_legacy          ON
 BUILD_opencv_ml                 ON
 BUILD_opencv_nonfree        ON
 BUILD_opencv_objdetect     ON
 BUILD_opencv_photo           ON
 BUILD_opencv_stitching      ON
 BUILD_opencv_ts                  ON
 BUILD_opencv_video            ON
 BUILD_opencv_videostab     ON
 CMAKE_BUILD_TYPE
 CMAKE_CONFIGURATION_TYPES  Debug;Release
 CMAKE_INSTALL_PREFIX             /home/andre/imx_applications/OpenCV-2.4.2/build/install
 CMAKE_TOOLCHAIN_FILE             /home/andre/imx_applications/OpenCV-2.4.2/toolchain.cmake
 CMAKE_VERBOSE                   OFF
 CUDA_BUILD_CUBIN               OFF
 CUDA_BUILD_EMULATION     OFF
 CUDA_SDK_ROOT_DIR             CUDA_SDK_ROOT_DIR-NOTFOUND          
 CUDA_TOOLKIT_ROOT_DIR     CUDA_TOOLKIT_ROOT_DIR-NOTFOUND   
 CUDA_VERBOSE_BUILD          OFF
 EIGEN_INCLUDE_PATH            EIGEN_INCLUDE_PATH-NOTFOUND
ENABLE_NOISY_WARNINGS                OFF
 ENABLE_OMIT_FRAME_POINTER      ON
 ENABLE_PRECOMPILED_HEADERS  ON
 ENABLE_PROFILING                           OFF
 ENABLE_SOLUTION_FOLDERS          OFF
 EXECUTABLE_OUTPUT_PATH           /home/andre/imx_applications/OpenCV-2.4.2/build/bin
 INSTALL_C_EXAMPLES                      OFF
 INSTALL_PYTHON_EXAMPLES          OFF
 INSTALL_TO_MANGLED_PATHS        OFF                 
 LIBRARY_OUTPUT_PATH_ROOT         /home/andre/imx_applications/OpenCV-2.4.2/build                                                                                              
 OPENCV_CAN_BREAK_BINARY_COMPAT   OFF
 OPENCV_CONFIG_FILE_INCLUDE_DIR   /home/andre/imx_applications/OpenCV-2.4.2/build                                                                                              
 OPENCV_WARNINGS_ARE_ERRORS
OFF OPENEXR_INCLUDE_PATH                  OPENEXR_INCLUDE_PATH-NOTFOUND PVAPI_INCLUDE_PATH            PVAPI_INCLUDE_PATH-NOTFOUND PYTHON_PACKAGES_PATH     lib/python2.7/site-packages WITH_1394         ON
 WITH_CUBLAS                   OFF
 WITH_CUDA                       OFF
 WITH_CUFFT                     ON
WITH_EIGEN                       ON
WITH_FFMPEG                   ON
 WITH_GSTREAMER           ON
 WITH_GTK                          ON
 WITH_JASPER                    OFF
 WITH_JPEG                        ON
 WITH_OPENEXR                ON
 WITH_OPENGL                  OFF
 WITH_OPENNI                   OFF
 WITH_PNG                         ON
 WITH_PVAPI                       ON
 WITH_QT                           OFF
 WITH_TBB                         OFF
 WITH_TIFF                        ON
 WITH_UNICAP                   OFF
 WITH_V4L                         ON
 WITH_XIMEA                     OFF
 WITH_XINE                        OFF
   
you basically removed the gpu acceleration (we don't support full profile OpenCL), we enabled the v4l library and also disabled some unnecessary ones, you can try your on configuration if you will.

8) make -j

9) make install


If you reached the step 9 with no issues you should have all  your cross built OpenCV in the install folder. Just copy it to your rootfs:

10) sudo cp -a build/install ../ltib/rootfs/usr

and you know have a OpenCV-2.4.X installation in your embedded system.

Now the result using a simple code to open a camera device and display the image:








EOF !


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
                                                            UPDATE
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

I Got some issues building GTK when following the procedure above, so here is the deal to avoid any headache:
  1. Install X11        (package list)
  2. Install GTK+    (package list)
  3. add the LIBFFI and V4L-UTILS like described earlier.
  4. Upgrade the GLIB2 package like described earlier.
  5. Cross Compile the OpenCV Library.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

EOF2 !

    本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多

    91天堂免费在线观看| 久久精品国产99国产免费| 亚洲男人的天堂久久a| 五月天丁香亚洲综合网| 很黄很污在线免费观看| 久久99爱爱视频视频| 亚洲精品成人午夜久久| 在线观看免费视频你懂的| 激情五月天深爱丁香婷婷| 美国欧洲日本韩国二本道| 高清一区二区三区不卡免费| 久久精品欧美一区二区三不卡| 亚洲一区二区精品国产av| 少妇熟女亚洲色图av天堂| 老司机精品视频在线免费看| 国产不卡免费高清视频| 国产精品美女午夜福利| 日韩黄色大片免费在线| 国产福利在线播放麻豆| 欧美性猛交内射老熟妇| 亚洲高清中文字幕一区二区三区| 大尺度激情福利视频在线观看| 一区二区三区精品人妻| 亚洲国产四季欧美一区| 日本黄色美女日本黄色| 国产乱人伦精品一区二区三区四区| 91精品国自产拍老熟女露脸| 成人三级视频在线观看不卡| 国产一级二级三级观看| 久久国产亚洲精品赲碰热| 99国产一区在线播放| 久久国产亚洲精品赲碰热| 我想看亚洲一级黄色录像| 欧美一区二区日韩一区二区| 好吊色免费在线观看视频| av一区二区三区天堂| 久久精品国产熟女精品| 国产国产精品精品在线| 久久99国产精品果冻传媒| 精品熟女少妇av免费久久野外| 欧美一本在线免费观看|