Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 304

Installing opencv in docker container

$
0
0
Hi, I'm trying to install opencv for [this](https://github.com/ageitgey/face_recognition) project. In the original dockerfile, they didn't give instructions for installing opencv. The dockerfile portion is follows: FROM python:3.4-slim #RUN apt-get -y update RUN apt-get update && apt-get install -y \ build-essential \ cmake \ gfortran \ git \ libatlas-base-dev \ libav-tools \ libgtk2.0-dev \ libjasper-dev \ libjpeg-dev \ libopencv-dev \ libpng-dev \ libtiff-dev \ libvtk6-dev \ pkg-config \ python-dev \ python-numpy \ python-opencv \ python-pycurl \ qt5-default \ unzip \ webp \ wget \ zlib1g-dev #&& apt-get clean && rm -rf /tmp/* /var/tmp/* RUN mkdir -p ~/opencv cd ~/opencv && \ wget https://github.com/Itseez/opencv/archive/3.2.0.zip && \ unzip 3.2.0.zip && \ rm 3.2.0.zip && \ cd opencv-3.2.0 && \ mkdir build && \ cd build && \ cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D INSTALL_C_EXAMPLES=ON \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D BUILD_EXAMPLES=ON .. && \ make -j4 && \ make install && \ ldconfig RUN ln -s /usr/local/lib/python3.4/site-packages/cv2.cpython-34m.so /usr/local/lib/python3.4/site-packages/cv2.so RUN apt-get -y update RUN apt-get install -y --fix-missing \ build-essential \ cmake \ gfortran \ git \ wget \ curl \ graphicsmagick \ libgraphicsmagick1-dev \ libatlas-dev \ libavcodec-dev \ libavformat-dev \ libboost-all-dev \ libgtk2.0-dev \ libjpeg-dev \ liblapack-dev \ libswscale-dev \ pkg-config \ python3-dev \ python3-numpy \ software-properties-common \ zip \&& apt-get clean && rm -rf /tmp/* /var/tmp/* RUN cd ~ && \ mkdir -p dlib && \ git clone -b 'v19.4' --single-branch https://github.com/davisking/dlib.git dlib/ && \ cd dlib/ && \ python3 setup.py install --yes USE_AVX_INSTRUCTIONS COPY . /root/face_recognition RUN cd /root/face_recognition && \ pip install -r requirements.txt && \ python setup.py install CMD cd /root/face_recognition/examples && \ python recognize_faces_in_pictures.py But when I'm doing import cv2, it's giving me the error: > Traceback (most recent call last):> File "", line 1, in > ImportError: No module named 'cv2' ```When I'm doing `find / -name "cv.py"`, I'm getting > /usr/lib/python2.7/dist-packages/cv.py And for this` find / -name "cv2.so"`, the result is > /usr/local/lib/python3.4/site-packages/cv2.so> /usr/local/lib/python2.7/dist-packages/cv2.so> /opencv-3.2.0/build/lib/cv2.so I don't know where I'm making the mistake. Can someone please guide me? Thank you!

Viewing all articles
Browse latest Browse all 304

Trending Articles