且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Amazon Linux上安装OpenCV?

更新时间:2023-02-22 20:19:50

Amazon AMI 的默认yum存储库似乎不包含 OpenCV 软件包. /p>

您可以通过以下简单步骤从源代码中自己编译它:

  • 安装必要的软件包:

sudo yum install git cmake gcc-c++

  • 从存储库中克隆 OpenCV :

git clone https://github.com/Itseez/opencv.git

  • (可选)选择所需版本:

git checkout <required version>

  • 编译并安装-创建要在其中创建文件夹的文件夹,在该文件夹中输入并键入:

cmake <path to sources> make sudo make install

这是基本步骤-之后,您将具有 OpenCV 和一些默认模块.您可以阅读 cmake 输出并在实际构建之前调整安装.可能您应该根据需要安装其他软件包(例如 libpng libjpg python 等).

I'm trying to install OpenCV for use with Pastec on an Amazon Linux instance. This is my first time using an Amazon service, and I don't have much experience using linux...

How would I install OpenCV and it's dependencies on Amazon Linux?

I have tried adding the EPEL repository using this command:

$ sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

... which works but it still won't install OpenCV...

$ sudo yum --enablerepo=epel install opencv-core
Loaded plugins: priorities, update-motd, upgrade-helper
948 packages excluded due to repository priority protections
Nothing to do

It seems that default yum repo for Amazon AMI doesn't contain OpenCV packages.

You can compile it from sources by yourself with the following simple steps:

  • install necessary packages:

sudo yum install git cmake gcc-c++

  • clone OpenCV from repository:

git clone https://github.com/Itseez/opencv.git

  • (optionally) choose required version:

git checkout <required version>

  • compile and install - create folder in which you want to build it, enter there and type:

cmake <path to sources> make sudo make install

It's basic steps - after this you will have OpenCV with some default modules. You can read cmake output and adjust your installation before actual build. Possibly you should install additional packages for your needs (like libpng, libjpg, python etc.).