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.
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.
- FFmpeg
- 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
댓글
댓글 쓰기