Use this file to discover all available pages before exploring further.
Open Source Computer Vision Library
Build powerful computer vision applications with the world’s most popular open-source CV library. Process images, detect objects, and deploy AI models across every platform.
Apply image processing operations like converting to grayscale and edge detection.
Python
C++
import cv2# Read imageimage = cv2.imread('image.jpg')# Convert to grayscalegray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)# Apply Canny edge detectionedges = cv2.Canny(gray, 100, 200)# Save the resultcv2.imwrite('edges.jpg', edges)
#include <opencv2/opencv.hpp>int main() { cv::Mat image = cv::imread("image.jpg"); cv::Mat gray, edges; // Convert to grayscale cv::cvtColor(image, gray, cv::COLOR_BGR2GRAY); // Apply Canny edge detection cv::Canny(gray, edges, 100, 200); // Save the result cv::imwrite("edges.jpg", edges); return 0;}
OpenCV uses BGR color format by default, not RGB. Keep this in mind when working with color images.
4
Explore advanced features
Now you’re ready to explore object detection, face recognition, deep learning, and more.Check out the tutorials or dive into the API reference to learn about specific modules.