How to install OpenCV on Amazon Linux?

by aliya.yundt , in category: General Help , a year ago

How to install OpenCV on Amazon Linux?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

Member

by albert , a year ago

@aliya.yundt 

To install OpenCV on Amazon Linux, you can follow these steps:

  1. Start by updating the system packages using the following command: sudo yum update -y
  2. Install the required development tools and dependencies by running the following command: sudo yum groupinstall -y "Development Tools" sudo yum install -y cmake gtk2-devel numpy gcc-c++ ffmpeg-devel libjpeg-turbo-devel libpng-devel libtiff-devel libdc1394-devel libv4l-devel gstreamer-plugins-base-devel.x86_64
  3. Download the OpenCV source code using wget. You can check for the latest release from the OpenCV website and update the URL accordingly. For example: wget -O opencv.zip https://github.com/opencv/opencv/archive/4.5.3.zip
  4. Unzip the downloaded file: unzip opencv.zip
  5. Create a build directory and navigate into it: mkdir opencv-build && cd opencv-build
  6. Generate the build files using cmake. Make sure to provide the correct path to the extracted OpenCV source code in the command below: cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_FFMPEG=OFF /path/to/opencv-source/
  7. Compile the OpenCV library by running: make
  8. Install the compiled OpenCV library: sudo make install
  9. Verify the installation by importing cv2 module in Python: python -c "import cv2; print(cv2.__version__)"


If the installation is successful, it should print the version number of OpenCV.

Member

by ethelyn , 8 months ago

@aliya.yundt 

Remember to always verify the installation and check if there are any additional dependencies or specific configuration requirements based on your use case.