How to build FFmpeg and OpenCV on Ubuntu MATE for Raspberry Pi 3


How to build FFmpeg and OpenCV on Ubuntu MATE for Raspberry Pi 3

OpenCV is often used to handle various computer vision, such as objects, faces, or motion recognition.

In OpenCV, there are many ways to get images. Basically, you can easily get images by using the camera attached to the device, but sometimes you need to open the media file or receive the data streaming over the network.

OpenCV does not directly support various video codecs or network protocols, so FFmpeg is used in this case.

This article describes how to build OpenCV in Raspberry Pi 3 that requires FFmpeg.
The build environment is as follows.
  • Raspberry Pi 3
  • Ubuntu MATE for Raspberry Pi 3
  • cmake

How to build

The build order is as follows.
  1. FFmpeg
  2. OpenCV
When you build FFmpeg you have to be careful. If your target board is 32 bits, you must add the --enable-pic option.

Build FFmpeg

cd ~/git
git clone https://github.com/FFmpeg/FFmpeg.git
cd FFmpeg
./configure --enable-libfreetype --enable-gpl \
            --enable-nonfree --enable-libx264 --enable-shared --enable-pic
make
sudo make install

Build OpenCV

cd ~/git
git clone https://github.com/opencv/opencv.git
cd opencv
mkdir build
cd build
cmake ..
make
sudo make install

댓글

이 블로그의 인기 게시물

macOS가 갑자기 부팅이 되지 않을 경우 데이터 복구 또는 백업 방법

C++로 프로그래밍할 때 인자 또는 리턴 값으로 std::vector 등 STL 데이터 타입 처리하는 좋은 방법

Git 저장소를 병합하는 방법(How to merge repositories in Git)