码迷,mamicode.com
首页 > 编程语言 > 详细

S3 Zeta使用python和opencv

时间:2018-05-28 15:00:38      阅读:238      评论:0      收藏:0      [点我收藏+]

标签:version   usr   which   table   tin   build   diff   dex   cout   

一、为SDK的Buildroot打上下面的补丁

diff --git a/package/opencv/Config.in b/package/opencv/Config.in
index c046baa..6cb6183 100644
--- a/package/opencv/Config.in
+++ b/package/opencv/Config.in
@@ -119,7 +119,12 @@ config BR2_PACKAGE_OPENCV_LIB_PHOTO
     help
       Include opencv_photo module into the OpenCV build.
 
-comment "opencv_python module requires numpy which is not yet available."
+config BR2_PACKAGE_OPENCV_LIB_PYTHON
+    bool "python"
+    depends on BR2_PACKAGE_PYTHON
+    help
+      Include opencv_python module into the OpenCV build.
+      No python example is installed.
 
 config BR2_PACKAGE_OPENCV_LIB_STITCHING
     bool "stitching"
diff --git a/package/opencv/opencv.mk b/package/opencv/opencv.mk
old mode 100644
new mode 100755
index 947589b..b00f293
--- a/package/opencv/opencv.mk
+++ b/package/opencv/opencv.mk
@@ -58,7 +58,6 @@ OPENCV_CONF_OPTS += \
     -DBUILD_opencv_objdetect=$(if $(BR2_PACKAGE_OPENCV_LIB_OBJDETECT),ON,OFF) \
     -DBUILD_opencv_ocl=OFF \
     -DBUILD_opencv_photo=$(if $(BR2_PACKAGE_OPENCV_LIB_PHOTO),ON,OFF) \
-    -DBUILD_opencv_python=OFF \
     -DBUILD_opencv_stitching=$(if $(BR2_PACKAGE_OPENCV_LIB_STITCHING),ON,OFF) \
     -DBUILD_opencv_superres=$(if $(BR2_PACKAGE_OPENCV_LIB_SUPERRES),ON,OFF) \
     -DBUILD_opencv_ts=$(if $(BR2_PACKAGE_OPENCV_LIB_TS),ON,OFF) \
@@ -138,7 +137,6 @@ OPENCV_CONF_OPTS += \
 OPENCV_CONF_OPTS += \
     -DBUILD_JASPER=OFF \
     -DBUILD_JPEG=OFF \
-    -DBUILD_NEW_PYTHON_SUPPORT=OFF \
     -DBUILD_OPENEXR=OFF \
     -DBUILD_PNG=OFF \
     -DBUILD_TIFF=OFF \
@@ -235,6 +233,22 @@ else
 OPENCV_CONF_OPTS += -DWITH_V4L=OFF -DWITH_LIBV4L=OFF
 endif
 
+ifeq ($(BR2_PACKAGE_OPENCV_LIB_PYTHON),y)
+OPENCV_CONF_OPTS += +    -DBUILD_opencv_python=ON +    -DBUILD_NEW_PYTHON_SUPPORT=ON +    -DPYTHON_EXECUTABLE=$(HOST_DIR)/usr/bin/python2                               +    -DPYTHON_INCLUDE_DIR=$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR) +    -DPYTHON_LIBRARY=$(STAGING_DIR)/usr/lib/libpython$(PYTHON_VERSION_MAJOR).so   +    -DPYTHON_NUMPY_INCLUDE_DIR=$(STAGING_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages/numpy/core/include +    -DPYTHON_NUMPY_VERSION=$(PYTHON_NUMPY_VERSION)
+OPENCV_DEPENDENCIES += python python-numpy
+else
+OPENCV_CONF_OPTS += +    -DBUILD_opencv_python=ON +    -DBUILD_NEW_PYTHON_SUPPORT=OFF
+endif
+
 # Installation hooks:
 define OPENCV_CLEAN_INSTALL_DOC
     $(RM) -fr $(TARGET_DIR)/usr/share/OpenCV/doc

二、配置Buildroot

执行cout && make menuconfig进入Buildroot界面,以下图:

技术分享图片

按照下面的顺序选择opencv

Target packages  --->
    Libraries  --->
        Graphics  --->
            opencv-2.4  --->

按照下面的顺序选择python

Target packages  --->
    Interpreter languages and scripting  --->
        python

opencv及python的子包视实际情况进行选择。

三、编译、生成固件

执行croot && zmake all

 

S3 Zeta使用python和opencv

标签:version   usr   which   table   tin   build   diff   dex   cout   

原文地址:https://www.cnblogs.com/kinglaw/p/9099695.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!