cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1225
Views
5
Helpful
2
Replies
Highlighted
Beginner

How can I install OpenCV on Yocto linux version

Hi there,

 

I am very frustrated and I came here for help. So please try to provide me with command line steps to follow. Thank you.

 

So I have posted this problem on StackOverFlow and someone told me to post it to Cisco forum:

 

https://stackoverflow.com/questions/54849057/how-can-i-install-opencv-on-yocto-linux-version

 

Please read it and reply to me asap. I need this for my project specifically cisco 829 Router. 

 

Thanks again.

2 REPLIES 2
Highlighted
Cisco Employee

Re: How can I install OpenCV on Yocto linux version

Hi,
You are recommended to use Docker container style app for IOx. Basically you need to create a docker container with OpenCV, and re-generate a docker app for IOx. For details of how to develop docker apps for IOx, please refer to https://developer.cisco.com/docs/iox/#!tutorial-build-sample-docker-type-c-based-simple-app.
Hope it helps.
Highlighted
Beginner

Re: How can I install OpenCV on Yocto linux version

Hi Steve,

I have already done this process virtually since I have Docker installed on
my machine. However, I actually have the router and I am working with the
router itself. On top of that, the docker has nothing to do with Opencv in
this case since the docker “FROM” image is Yocto. The router’s space is
only 4G, installing docker on the router will take so much space. Butlet'ss
say we want to install docker and we will use image like ubuntu. The way to
install OpenCV would be like this:

```
FROM ubuntu:16.04

RUN mkdir -p /home/myapp
COPY . /home/myapp
RUN cd /home/myapp

RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends python python-dev python-pip
build-essential cmake git pkg-config libjpeg8-dev libtiff5-dev
libjasper-dev libpng12-dev libgtk2.0-dev libavcodec-dev libavformat-dev
libswscale-dev libv4l-dev libatlas-base-dev gfortran libavresample-dev
libgphoto2-dev libgstreamer-plugins-base1.0-dev libdc1394-22-dev && \
cd /opt && \
git clone https://github.com/opencv/opencv_contrib.git && \
cd opencv_contrib && \
git checkout 3.4.0 && \
cd /opt && \
git clone https://github.com/opencv/opencv.git && \
cd opencv && \
git checkout 3.4.0 && \
mkdir build && \
cd build && \
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D OPENCV_EXTRA_MODULES_PATH=/opt/opencv_contrib/modules \
-D PYTHON_EXECUTABLE=/usr/bin/python2.7 \
-D BUILD_EXAMPLES=OFF /opt/opencv && \
make -j $(nproc) && \
make install && \
ldconfig && \
apt-get purge -y git && \
apt-get clean && rm -rf /var/lib/apt/lists/* && \
rm -rf /opt/opencv*

CMD /bin/bash
RUN cd /home/myapp && \
g++ -std=c++11 main.cpp `pkg-config --libs --cflags opencv` -o myapp
FROM ubuntu:16.04

RUN mkdir -p /home/myapp
COPY . /home/myapp
RUN cd /home/myapp

RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends python python-dev python-pip
build-essential cmake git pkg-config libjpeg8-dev libtiff5-dev
libjasper-dev libpng12-dev libgtk2.0-dev libavcodec-dev libavformat-dev
libswscale-dev libv4l-dev libatlas-base-dev gfortran libavresample-dev
libgphoto2-dev libgstreamer-plugins-base1.0-dev libdc1394-22-dev && \
cd /opt && \
git clone https://github.com/opencv/opencv_contrib.git && \
cd opencv_contrib && \
git checkout 3.4.0 && \
cd /opt && \
git clone https://github.com/opencv/opencv.git && \
cd opencv && \
git checkout 3.4.0 && \
mkdir build && \
cd build && \
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D OPENCV_EXTRA_MODULES_PATH=/opt/opencv_contrib/modules \
-D PYTHON_EXECUTABLE=/usr/bin/python2.7 \
-D BUILD_EXAMPLES=OFF /opt/opencv && \
make -j $(nproc) && \
make install && \
ldconfig && \
apt-get purge -y git && \
apt-get clean && rm -rf /var/lib/apt/lists/* && \
rm -rf /opt/opencv*

CMD /bin/bash
RUN cd /home/myapp && \
g++ -std=c++11 main.cpp `pkg-config --libs --cflags opencv` -o myapp
```

I have attached this dockerfile also. I have tested this and it works but
it takes so much space i guess. Can you help me please?

Just to make things clear. I have to run the application using OpenCv & C++
on the actual (physical) router and I only have 4G.
CreatePlease to create content
Content for Community-Ad
Cisco Community April 2020 Spotlight Award Winners
This widget could not be displayed.