/opencv-snippets

OpenCV snippets

Primary LanguagePython

opencv-snippets

This repo contains OpenCV code snippets which can be helpful to further solve complex problems and also use these snippets in your work if you have a better understanding of it.

01.py : Read and write the image and use the 'esc' key to destroy all the windows and 's' key to save the image and make a copy of that image in the current folder.

02.py : For video capture from your default PC camera.

03.py : Changing BGR colour format to gray.

04.py : Video reading and saving using the default camera.

05.py : Inserting line, arrowedLine, rectangle, circle, putText in the image.

06.py : Making a image using numpy zeros.

07.py : Changing the dimensions of the video frame.

08.py : Adding datetime to the captured video.

09.py : Show the coordinates on the image when the left mouse button is clicked on the image.

10.py : When we right click on the image, we will get the colour of the image in the BGR format, and when we left click on the image we will get the coordinates of the image.

11.py : This will make a circle at a point you will left click on and then join the 1st click and the 2nd clicked points with a line and continues the process until the termination.

12.py : Adding two images from cv2.add().

13.py : Using different types of bitwise operators.

14.py : Creating a Trackebar to change the colour of the image using B, G, R channel trackbars.

15.py : Creating a trackbar with mask on the video captured and masks the video with the described HSV given in the trackbar.

16.py : Simple thresholding(a segmentation technique) on Images using OpenCV.

17.py : Adaptive thresholding(threshold is calculated for local region and not global), so there will be different regions with different thresholding.

18.py : Morpholgical Transformations(morpholiogical transformations are some simple operations based on the image shape).

19.py : Smoothing(or Blurring), it is used to remove noise in the images.

20.py : Image Gradient(directional change in the intensity or color in an image.) Image Gradient is a fundamental property in image processing, we use image gradient to find edges inside image.

21.py : Canny Edge Detector: Is an edge detector algorithm that uses a multi-stage algorithm to detect a wide range of edges in images.

22.py : Image Pyramids: We create images with different resolutions, by bluring(or smoothing) and subsampling.

23.py : Image bending using Image pyramid techniques(Gaussian and Laplacian Pyramids).

24.py : Finding and Drawing Contours.

25.py : Motion Detection.

26.py : Detecting Geometric shapes.

27.py : Histograms in OpenCV

28.py : Template Matching(It is a method of finding and searching a template image in a larger image).

29.py : The Hough Transform: It is a popular technique to detect any shape, if you can represent that shape in a mathematical form. It can detect the shape even if it is broken or distorted a liitle bit.

30.py : Lane Detection with OpenCV.

31.py : Lane Detection in videos with OpenCV.

32.py : Drawing a circle using Hough Circle.

33.py : Haar Cascade Face Detection(on images).

34.py : Haar Cascade Face Detection(on videos).

35.py : Haar Cascade Face and Eye Detection.

36.py : Detecting Corners with Harris Corner Detection.

37.py : Detecting Corners with Shi Tomasi Method.

38.py : Background Subtraction Method.

39.py : Mean Shift: Object Tracking Method.

40.py : Object Tracking Camshift Method.