1. Home
  2. /
  3. Opencv
  4. /
  5. Convert Image to Grayscale

Convert Image to Grayscale - Opencv Typing CST Test

Loading…

Convert Image to Grayscale — Opencv Code

Reads an image and converts it to grayscale.

import cv2

img = cv2.imread('example.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
cv2.imshow('Gray Image', gray)
cv2.waitKey(0)
cv2.destroyAllWindows()

Opencv Language Guide

OpenCV (Open Source Computer Vision Library) is an open-source computer vision and machine learning library that provides tools for real-time image and video processing across multiple platforms.

Primary Use Cases

  • ▸Image and video processing (filtering, transformations, enhancement)
  • ▸Object detection and recognition
  • ▸Facial recognition and emotion detection
  • ▸Motion tracking and optical flow analysis
  • ▸Machine learning integration for vision-based applications

Notable Features

  • ▸Cross-platform support (Windows, macOS, Linux, Android, iOS)
  • ▸Real-time processing optimized for performance
  • ▸Supports CPU and GPU acceleration
  • ▸Integration with deep learning frameworks (TensorFlow, PyTorch, ONNX)
  • ▸Large collection of pre-trained models and algorithms

Origin & Creator

OpenCV was originally developed by Intel in 1999, led by Gary Bradski, with contributions from Willow Garage and Itseez, and has grown into one of the most widely used computer vision libraries worldwide.

Industrial Note

OpenCV is extensively used in robotics, autonomous vehicles, medical imaging, augmented reality, surveillance, and industrial automation.

More Opencv Typing Exercises

OpenCV Simple Image Read and DisplayOpenCV Resize ImageOpenCV Draw Shapes on ImageOpenCV Image ThresholdingOpenCV Edge DetectionOpenCV Video CaptureOpenCV Image BlurringOpenCV Face Detection with Haar CascadesOpenCV Video Frame Processing

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher