In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
WRTnode how to add OpenCV support, for this question, this article describes in detail the corresponding analysis and solutions, hoping to help more partners who want to solve this problem to find a more simple and easy way.
Opencv libs library file ipk compilation
Opencv ipk source code
Using the compilation mechanism of openwrt package, you only need a Makefile to compile opencv.
Why is it so simple and magical? here is a detailed explanation of Makefile (personal opinion, welcome to correct):
$vim Makefile
Include $(TOPDIR) / rules.mk PKG_NAME:=opencv # PKG_NAME-the name of the package, the version of the PKG_VERSION:=2.4.8 # PKG_VERSION-package is shown in menuconfig and ipkg, and the version of the trunk branch is the PKG_RELEASE:=1 # PKG_RELEASE-the version of this makefile PKG_USE_MIPS16:=0 PKG_SOURCE:=$ (PKG_NAME)-$(PKG_VERSION). Zip # PKG_SOURCE-the name of the package to download It is usually made up of PKG_NAME and PKG_VERSION, PKG_SOURCE_URL:= http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.8/ # PKG_SOURCE_URL-download the link to this package The MD5 value of the PKG_MD5SUM:=50cc1433b3654074206f5b3dbfd49848 # # software package obtained from the Internet Check value Method to get the value of MD5 # $. / scripts/update-package-md5sum. / opencv/#PKG_CAT:= unzip#PKG_CAT-method to extract the package (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 For example, the secondary directory to which the software package belongs in Libraries#SUBMENU-menuconfig (not used) # TITLE-package title # DESCRIPTION-detailed description of the software package # URL-the original location of the software, usually the software author's home page # MAINTAINER-(optional) package maintainer # DEPENDS-(optional) dependency Run other packages that this software depends on # PKG_INSTALL:=1 CMAKE_OPTIONS + =-DWITH_LIBV4L:BOOL=OFF-DBUILD_opencv_ts:BOOL=OFF## # CMAKE_OPTIONS # for example, do not want to compile the libv4l library, Ts et al. Just choose 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 # header files and libraries generated by #. / 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 # 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)) # this is the most critical BuildPackage macro. It is defined in the $(INCLUDE_DIR) / package.mk file. The BuildPackage macro requires only one parameter, the name of the package to be compiled, in this case "opencv". All other information is obtained through macros, which provides an inherent simplicity. For example, BuildPackage needs a long list of description information of the software package, so let's not pass lengthy parameters to it, because we have agreed that the description information is defined in the DESCRIPTION macro and BuildPackage can read it from it. # Build/Compile (optional) # compile source code command # Package/install # software installation command, mainly to copy related files to a specified directory, such as configuration files. # opencv-test ipk source code for compiling opencv test programs
Let's use opencv-test as a demo to test opencv libs. The function of the test program is to read the picture from the camera and save it in the current directory. Due to the limited storage space, only 6 pictures are saved. Here is the Makefile required to generate the opencv-test ipk package, which is compiled in exactly the same way 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 Rely on 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) is 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## # executable file generated by cv_test compilation # $(eval $(call BuildPackage) Opencv-test))
The source code for opencv-test and the Makefile for compiling binaries are in the src directory.
Note: opencv applications can almost be considered cross-platform, we can develop under windows or Mac of x86, after removing the code that cannot be supported by OpenWrt, such as graphics window display and keyboard input, we can ensure that it can be compiled and executed smoothly on WRTnode.
This is the answer to the question about how to add OpenCV support to WRTnode. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.