【问题标题】:Install OpenCV 2.4.9 on ARM在 ARM 上安装 OpenCV 2.4.9
【发布时间】:2015-01-02 00:13:10
【问题描述】:
在 ARM 上安装 OpenCV 的最佳方式是什么?
我有一个带有 Linux Debian 的 BeagleBone Black,我正在尝试使用 this sh 脚本安装 OpenCV,但它非常繁重(运行超过一天)。
我使用 this 手册在我的 Ubuntu x86 上交叉编译 OpenCV,它运行正常,但现在我不知道我需要将哪些文件复制到我的 ARM 以运行可执行的 C++ OpenCv 文件,有人可以帮我吗?
如果在我的 Ubuntu x86 上使用 gnueabi 编译所有内容,我需要在 ARM 上安装 OpenCV 依赖项(如 build-essential、cmake、python ...)吗?我想知道在我的 BeagleBone Black 上运行可执行 C++ OpenCV 文件的更轻松的方法。
非常感谢。
【问题讨论】:
-
试试Buildroot。它提供 BB 目标(内核、rootfs)以及最新的 OpenCV 版本。
标签:
c++
linux
opencv
cross-compiling
beagleboneblack
【解决方案1】:
如果您只想运行 OpenCV 应用程序,则不需要开发工具(build-essential、cmake、python、g++、...)。
简答:您需要将所有 OpenCV 共享库(.so 文件)复制到设备,以及 OpenCV 依赖的所有共享库。
长答案:您可能不需要所有 OpenCV 共享库来运行您的应用程序。编译完自己的 OpenCV 程序后,您可以使用 ldd 来确定它需要哪些 OpenCV 共享库,然后在其中的每一个上再次使用 ldd 来确定其依赖关系。
This script 可能会给你一些关于如何自动化这个过程的想法:
#!/bin/bash
# Author : Hemanth.HM
# Email : hemanth[dot]hm[at]gmail[dot]com
# License : GNU GPLv3
#
function useage()
{
cat << EOU
Useage: bash $0 <path to the binary> <path to copy the dependencies>
EOU
exit 1
}
#Validate the inputs
[[ $# < 2 ]] && useage
#Check if the paths are vaild
[[ ! -e $1 ]] && echo "Not a vaild input $1" && exit 1
[[ -d $2 ]] || echo "No such directory $2 creating..."&& mkdir -p "$2"
#Get the library dependencies
echo "Collecting the shared library dependencies for $1..."
deps=$(ldd $1 | awk 'BEGIN{ORS=" "}$1\
~/^\//{print $1}$3~/^\//{print $3}'\
| sed 's/,$/\n/')
echo "Copying the dependencies to $2"
#Copy the deps
for dep in $deps
do
echo "Copying $dep to $2"
cp "$dep" "$2"
done
echo "Done!"