You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OpenSource Computer Vision, more commonly known as OpenCV, is a more advanced image manipulation and processing software than PIL. It has been implemented in several
69
+
languages and is widely used.
70
+
71
+
Installation
72
+
~~~~~~~~~~~~
73
+
74
+
In Python, image processing using OpenCV is implemented using the ``cv2`` and ``NumPy`` modules.
75
+
The `installation instructions for OpenCV <http://docs.opencv.org/2.4/doc/tutorials/introduction/table_of_content_introduction/table_of_content_introduction.html#table-of-content-introduction>`_ should guide you through configuring the project for yourself.
76
+
77
+
NumPy can be downloaded from the Python Package Index(PyPI):
78
+
79
+
.. code-block:: console
80
+
81
+
$ pip install numpy
82
+
83
+
84
+
Example
85
+
~~~~~~~
86
+
87
+
.. code-block:: python
88
+
89
+
from cv2 import*
90
+
import numpy as np
91
+
#Read Image
92
+
img = cv2.imread('testimg.jpg')
93
+
#Display Image
94
+
cv2.imshow('image',img)
95
+
cv2.waitKey(0)
96
+
cv2.destroyAllWindows()
97
+
98
+
#Applying Grayscale filter to image
99
+
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
100
+
101
+
#Saving filtered image to new file
102
+
cv2.imwrite('graytest.jpg',gray)
103
+
104
+
There are more Python-implemented examples of OpenCV in this `collection of tutorials <http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_tutorials.html>`_.
0 commit comments