0%

[OpenWrt]安装opencv

Makefile修改

修改 /openwrt-hiwooya/feeds/packages/libs/opencv/Makefile,把版本改为3.0.0(没有opencv文件夹则新建)

下载速度慢的话,先把 opencv-3.0.0.zip(点击下载) 包放入 /openwrt-hiwooya/dl 文件夹中

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#
# Copyright (C) 2013-2014 wrtnode.com
# Copyright (C) 2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=opencv
# PKG_VERSION:=2.4.11
# PKG_RELEASE:=3

# PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip
# PKG_SOURCE_URL:=http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/$(PKG_VERSION)/
# PKG_MD5SUM:=32f498451bff1817a60e1aabc2939575

PKG_VERSION:=3.0.0
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip
PKG_SOURCE_URL:=http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/$(PKG_VERSION)/
PKG_MD5SUM:=09004c275d8092cbdf5b61675cecd399

PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk


define Package/opencv/Default/description
OpenCV (Open Source Computer Vision Library) is an open source computer
vision and machine learning software library. OpenCV was built to provide
a common infrastructure for computer vision applications and to accelerate
the use of machine perception in the commercial products. Being a
BSD-licensed product, OpenCV makes it easy for businesses to utilize
and modify the code.
endef

define Package/opencv
SECTION:=libs
CATEGORY:=Libraries
TITLE:=$(PKG_NAME)-$(PKG_VERSION)
URL:=http://opencv.org/
MAINTAINER:=WRTnode Team <pub@wrtnode.com>
DEPENDS:=+libpthread +librt +libstdcpp +zlib +libjpeg
endef


PKG_INSTALL:=1

# CMAKE_OPTIONS += -DBUILD_opencv_gpu:BOOL=OFF \
# -DWITH_1394:BOOL=OFF -DBUILD_opencv_stitching:BOOL=OFF \
# -DBUILD_opencv_superres:BOOL=OFF -DBUILD_opencv_ts:BOOL=OFF \
# -DBUILD_opencv_highgui:BOOL=OFF \
# -DBUILD_opencv_videostab:BOOL=OFF \
# -DWITH_FFMPEG:BOOL=OFF \
# -DWITH_GSTREAMER:BOOL=OFF \
# -DWITH_LIBV4L:BOOL=OFF \
# -DWITH_PNG:BOOL=OFF \
# -DWITH_TIFF:BOOL=OFF \

CMAKE_OPTIONS += -DBUILD_opencv_gpu:BOOL=OFF \
-DWITH_1394:BOOL=OFF -DBUILD_opencv_stitching:BOOL=OFF \
-DBUILD_opencv_superres:BOOL=OFF -DBUILD_opencv_ts:BOOL=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 Package/opencv/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libopencv* $(1)/usr/lib/
endef

$(eval $(call BuildPackage,opencv))

make menuconfig 选中软件包

1
2
Libraries  ---> 
<*>opencv............................ opencv-3.0.0

20201210090217118.png

编译

单独编译:

1
make package/opencv/compile V=s

全编译:
1
make V=s

20201210000055894.png
解压目录:
openwrt-hiwooya/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/opencv-3.0.0

动态库目录:
/home/pjw/linux/MTK/MT7628/SDK/openwrt-hiwooya/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/lib
————————————————
版权声明:本文为CSDN博主「丨匿名用户丨」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/p1279030826/article/details/110943718