In code samples you will see cv2 library is imported.
import cv2If you run sample code without installing opencv you will get following error.
Traceback (most recent call last):
File "pythonface.py", line 2, in
import cv2
ImportError: No module named cv2
Installing python package from online repository is very easy in python. You can search for a package in PyPI (Python Package Index) interface.
Type opencv to search box in pypi webpage (https://pypi.python.org/pypi)
This will give you a long list which contains your keyword.
List cropped for blog post.
Finding right package may be hard in this list. You can find package names from original sources of specific libraries.
If you click "opencv-python 3.3.0.10" from the list (https://pypi.python.org/pypi/opencv-python/3.3.0.10) you will see installation and usage guide.
On docs.opencv.org you can see library name as opencv-python:
OpenCV-Python is the Python API for OpenCV, combining the best qualities of the OpenCV C++ API and the Python language.Use following command to install opencv library to your computer from PyPI.
pip install opencv-pythonNow you are ready to use opencv functions.
If you can't find opencv-python package in your installation you can download source codes and run commands according to your environment. This link will give you an idea about sequence of this work.
0 comments:
Post a Comment