We download opencv and opencv_contrib that are extra modules. In this case we are getting version 3.4.2 , fill free to change for the most recently version that is on github. We download as a zip both package and the unzip them.
We need to create a build folder under the opencv files, so we could compile them. We first execute the cmake with that parameters and then make instruction.
*make -j4, 4 could be replace with the number of process that you have in your machine.
RUN mkdir /opencv/build
WORKDIR "/opencv/build"
RUN cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D BUILD_PYTHON_SUPPORT=0N \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules \
-D PYTHON3_EXECUTABLE=/usr/bin/python3.5 \
-D BUILD_EXAMPLES=ON \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D WITH_V4L=ON ..
RUN make -j4 && make install && ldconfig
Lets remove the files that we have download so the image could be more lighter.
RUN rm -rf opencv_contrib3.zip opencv3.zip ~/opencv-3.4.2
WORKDIR "/"
Finally we need to clone the Xiaomin repository and execute the setup.sh to install all the dependencies.
RUN git clone https://github.com/Reyes-fred/Xiaomin.git
WORKDIR /Xiaomin
RUN cd Setup/ && sh setup.sh
RUN pip install imutils