This tutorial is designed for beginners who want to learn OpenCV using English. OpenCV (Open Source Computer Vision Library) is an open-source computer vision and machine learning software library. It is widely used for various applications such as image processing, object detection, and facial recognition.

Getting Started

Before you start, make sure you have Python installed on your system. You can download it from the official Python website.

Installation

To install OpenCV, use the following command in your terminal:

pip install opencv-python

Basic Operations

Here are some basic operations you can perform with OpenCV:

  • Reading an Image: cv2.imread()
  • Displaying an Image: cv2.imshow()
  • Saving an Image: cv2.imwrite()
  • Drawing Shapes: cv2.rectangle(), cv2.circle(), etc.

Example

Here's a simple example that reads an image, displays it, and then saves it:

import cv2

# Read the image
image = cv2.imread('path_to_image.jpg')

# Display the image
cv2.imshow('Image', image)

# Wait for a key press
cv2.waitKey(0)

# Save the image
cv2.imwrite('output_image.jpg', image)

# Close all OpenCV windows
cv2.destroyAllWindows()

Further Reading

For more detailed tutorials and examples, check out our Advanced OpenCV Tutorials.

Resources

OpenCV Logo