How to install Opencv

1

I would like to know how to install the latest version of Opencv 3.2 on Linux ubuntu 14.04. I was able to install and put to compile in codeblocks using C ++ following a tutorial. But my goal is to actually install the opencv library so that I use it with the python language and can run the good code. I did not understand very well but I would use the python impot to use opencv? Anyone who knows this library could give me some tips and help me with that? Thank you.

Note: my goal is recognition of color, and objects. Note 2: I would like to run it in atom or in codeblocks. Preferably in codeblocks.

    
asked by anonymous 15.07.2017 / 22:16

2 answers

2

Look for the opencv package in python with the pip, in the example below I am in a ubuntu 16, in a env python3:

~$ pip search opencv | grep "^opencv"
opencv-python-armv7l (3.2.0)     - opencv-python on armv7l.
opencv-contrib-python (3.2.0.7)  - Wrapper package for OpenCV python bindings.
opencv-cython (0.4)              - An alternative OpenCV wrapper
opencv-utils (0.0.2)             - OpenCV Utilities
opencv-python (3.2.0.7)          - Wrapper package for OpenCV python bindings.
opencv_cffi (0.2.2)              - A random subset of OpenCV's functionality, wrapped via CFFI
opencv_engine (1.0.1)            - OpenCV imaging engine for thumbor.
opencv_helpers (1.1)             - Helper functions for opencv
opencvutils (0.9.2)              - Simple OpenCV 3.x image processing functions

In this case we will install the fourth item:

pip install opencv-python

Or install anaconda and get rid of all package problems. : -)

Example of use

Capturing a video:

import numpy as np
import cv2

cap = cv2.VideoCapture(0)

while(True):
    # Capture frame-by-frame
    ret, frame = cap.read()

    # Our operations on the frame come here
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

    # Display the resulting frame
    cv2.imshow('frame',gray)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()

This example was taken from the great package documentation, an area of tutorials very good with several exercises, have fun.

    
16.07.2017 / 16:30
0

Install Anaconda .

Install OpenCV 3 by running this command at the anaconda prompt:

conda install -c menpo opencv3

I tested on Windows 10 and Ubuntu 14.

source: link

    
11.08.2017 / 20:41