OpenCV Libs Library file IPK compilation
OpenCV IPK Source
Using the OpenWrt package's compilation mechanism requires only one makefile to compile the OpenCV.
Why this is so simple and magical, the following on makefile detailed (personal view, welcome correction):
$vim Makefile
include $ (topdir)/rules.mk pkg_name:=opencv # pkg_name -software package name, in menuconfig and ipkg shows the version of the pkg_version:=2.4.8 # pkg_version -package, which is the version of the backbone branch that we want to download pkg_ release:=1 # pkg_release -this makefile 's version pkg_use_mips16:=0 pkg_source:=$ (PKG_ Name)-$ (pkg_version). zip # pkg_source -the name of the package to be downloaded, typically by PKG_NAME and pkg_version Composition pkg_source_url:=http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.8/ # pkg_source_url -Download the link to this package  , and get the pkg_md5sum:=50cc1433b3654074206f5b3dbfd49848 ################ from the Internet ################################### software package MD5 value, checksum value, get MD5 value of the method #$ ./scripts/ update-package-md5sum ....../opencv/#PKG_CAT: = unzip#pkg_cat -Extract Package Method (Zcat, bzcat, unzip) ################################################# #include $ (include_dir)/package.mk include $ (Include_dir)/cmake.mk define package/opencv/default/description the open source computer vision library for linux endef define package/opencv section:=libs category:=libraries title:= opencv-2.4.8 depends:=+ libpthread +librt +libstdcpp +zlib +libjpeg endef ############################## #################### #SECTION - Package type #CATEGORY The first-level directory to which the package belongs in - menuconfig, such as The two level directory (not used) that the package belongs to in Libraries#submenu - menuconfig #TITLE - package title #description - A detailed description of the package #url - the original location of the software, typically the software author's home page #maintainer - (optional) Package maintainer #depends - (optional) dependencies, run other packages that the software relies on ################################################ #PKG_INSTALL:=1 cmake_options += -dwith_libv4l:bool=off -dbuild_opencv_ts:bool=off############################# #################### #CMAKE_OPTIONS #例如不想编LIBV4L Library, TS, etc., select Off. ################################################ #define build/installdev $ ( Install_dir) $ (1)/usr/include $ (CP) $ (pkg_install_dir)/usr/include/ opencv $ (1)/usr/include/ $ (CP) $ (pkg_install_dir)/usr/include/opencv2 $ (1)/usr/include/ $ (Install_dir) $ (1)/usr/lib $ (CP) $ (Pkg_install_dir)/usr/lib/libopencv* $ (1)/usr/lib/ endef #################### ############################## define build/installdev #生成的头文件和库放到 #./staging_dir/ target-mipsel_24kec+dsp_uclibc-0.9.33.2/usr/include and ./staging_dir/target- mipsel_24kec+dsp_ uclibc-0.9.33.2/usr/lib under #pkg_install_dir ./trunk/build_dir/target-mipsel_24kec+dsp_ uclibc-0.9.33.2/opencv-2.4.8/ipkg-install ################################################ #define Package/opencv/install $ (Install_dir) $ (1)/usr/include $ (CP) $ (Pkg_install_dir)/usr/include/* $ (1)/usr/include/ $ (INSTALL_DIR) $ (1)/usr/lib $ (CP) $ (Pkg_install_dir)/usr/lib/libopencv* $ (1)/usr /lib/ endef $ (eval $ (CALL BUILDPACKAGE,OPENCV)) ########################################### ###### #这是最为关键的BuildPackage宏. It is defined in the $ (include_dir)/package.mk file. The Buildpackage macro only requires a parameter, which is the package name to compile, in this case "OpenCV". All other information is obtained through macros, which provides an intrinsic simplicity. For example, Buildpackage needs a large string of descriptive information for the package, and we don't want to pass a lengthy argument to it, because we've agreed that the description information is defined in the description macro, and Buildpackage reads from it. # build/compile (optional) # compile source code command # package/install # Software Installation command, the main is to copy the relevant files to the specified directory, such as configuration files. #################################################
compiling the OPENCV test program
Opencv-test IPK Source
Below we use opencv-test this demo to test OpenCV Libs. The test program implementation function is to read the picture from the camera and save it in the current directory. Since storage space is limited, 6 images are saved. The following is the makefile required to build the Opencv-test IPK package, with the same compilation method as any other IPK package.
$vim makefielinclude $ (Topdir)/rules.mkpkg_name:=opencv-testpkg_release:=1pkg_build_dir:=$ (BUILD_DIR )/$ (Pkg_name) pkg_install_dir:=$ (pkg_build_dir)/ipkg-installinclude $ (include_dir)/kernel.mkinclude $ (Include_dir)/package.mkdefine package/opencv-test section:=wrtnode category:= wrtnode submenu :=demos title:=opencv demo app depends := +opencvendef################################################# #DEPENDS := +opencv Dependent opencv lib################################################ #define package/opencv-test/description WRTnode test program for opencv libendefdefine build/prepare mkdir -p $ (PKG_ Build_dir) $ (CP) ./src/* $ (PKG_BUILD_DIR)/endefdefine build/compile $ (Make) -c $ (Pkg_build_dir) $ (target_configure_opts) CFLAGS= "$ ( Target_cflags) " ldflags= "$ (target_ldflags)" endef################## ################################$ (target_configure_opts) , $ (target_cflags), $ (target_ldflags) As defined in rules.mk ################################################ #define package/opencv-test/install $ (Install_dir) $ (1)/usr/bin $ (Install_bin) $ (Pkg_build_dir)/cv_test $ (1)/usr/bin/endef######################## ######################### #cv_test Compile the generated executable #################################################$ (eval $ (call buildpackage,opencv-Test))
and Opencv-test source code and compiled binaries makefile in the SRC directory, interested students can be in-depth study.
Note: OPENCV applications can almost be considered cross-platform, we can be developed under the x86 of Windows or Mac, will be with the graphics window display and keyboard input, such as OPENWRT cannot support the code after removal, can be guaranteed to successfully compile on the Wrtnode and execute.
Play Turn Smart Router-wrtnode add OPENCV support