OpenCV Python tutorial
Tags: python, opencv
Published: 2020-10-16 06:48:14

---
title: OpenCV Python tutorial
published: true
description: 
tags: python, OpenCV
//cover_image: https://direct_url_to_image.jpg
---

OpenCV is a massive open source library for `computer vision, and picture processing`. OpenCV supports a huge array of programming languages such as <a href="https://www.code2master.com/python/python-tutorial-beginners/" target="_blank" rel="noopener noreferrer">Python</a>, C++, Java, etc. It can process pictures and videos to identify items, faces and can be very useful in a lot of scenarios. 
For example: Auto tag feature used by facebook. When you upload a picture to `facebook`, it automatically detects the person and suggests you tag the person.

`OpenCV` stands for open source computer vision library. It is widely used for image detection. It was first introduced by intel and was written in C/C++. It is generally used in Python for computer visions.

## Install OpenCV on Windows and linux
You need to install python first on your machine.
You can check `python` version using:
```python
Python --version
```

You can use pip to install opencv. pip is standard package manager for Python and it will help you install packages not available in Python Standard library.
To install OpenCV, just to command line and type:
```Python
pip install opencv-python #Python 2
pip3 install opencv-python #Python 3
```
If you want to check if OpenCV is correctly installed, then you can use the following command.
```python
>>> Python
>>> import cv2
>>> print(cv2.__version__)
```

In case you are using anaconda then you can use following command"
```python
>> conda install -c menpo opencv3
```
In case, you are getting modulenotfounderror, then you can use <a href="https://java2blog.com/modulenotfounderror-no-module-named-cv2-python/" target="_blank" rel="noopener noreferrer">CV2 modulenotfounderror: no module named cv2</a> to resolve the issue.

## OpenCV Python tutorial
This OpenCV tutorial will help you to understand the basic Image-processing with a lot of examples. 

It includes following tutorials:

<a href="https://java2blog.com/python-introduction-installation-opencv/" target="_blank" rel="noopener noreferrer">OpenCV introduction</a>: It provides quick introduction to openCV python library.
<a href="https://java2blog.com/cv2-imread-python/" target="_blank" rel="noopener noreferrer">CV2 imread</a>: cv2 imread method is used to read image from path.
<a href="https://java2blog.com/cv2-imwrite-python/" target="_blank" rel="noopener noreferrer">CV2 imwrite</a>: cv2 imwrite method is used to save image to the disk.
<a href="https://java2blog.com/cv2-imshow-python/" target="_blank" rel="noopener noreferrer">CV2 imshow</a>: cv2 imshow is used to display image in the window.
<a href="https://java2blog.com/cv2-resize-python/" target="_blank" rel="noopener noreferrer">CV2 resize</a>: cv2 resize is used to resize an image.
<a href="https://java2blog.com/cv2-videocapture-python/" target="_blank" rel="noopener noreferrer">CV2 videocapture</a>: cv2 videocapature is used to read and start live streaming.
<a href="https://java2blog.com/cv2-threshold-python/" target="_blank" rel="noopener noreferrer">CV2 threshold</a>: CV2 threshold is used to separate an object form the background in the image.
<a href="https://java2blog.com/cv2-canny-python/" target="_blank" rel="noopener noreferrer">CV2 canny</a>: Cv2 canny method is used to detect edges in an image.
<a href="https://java2blog.com/cv2-findcontours-python/" target="_blank" rel="noopener noreferrer">CV2 findcontours</a>: cv2 findcontours method is used find boundaries of an image.
<a href="https://java2blog.com/cv2-gaussianblur-python/" target="_blank" rel="noopener noreferrer">CV2 gaussianblur</a>: CV2 gaussianblur is used to blur an image.
<a href="https://java2blog.com/cv2-cvtcolor-python/" target="_blank" rel="noopener noreferrer">CV2 cvtcolor</a>: CV2 cvtcolor is used to convert color of an image from one color space to another.