OpenCV Python Tutorial
OpenCV Python Resources
Selected Reading
- OpenCV Python - Digit Recognition
- OpenCV Python - Feature Matching
- OpenCV Python - Feature Detection
- OpenCV Python - Meanshift/Camshift
- OpenCV Python - Face Detection
- OpenCV Python - Video from Images
- OpenCV Python - Images From Video
- OpenCV Python - Play Videos
- OpenCV Python - Capture Videos
- OpenCV Python - Fourier Transform
- OpenCV Python - Image Blending
- OpenCV Python - Image Addition
- OpenCV Python - Image Pyramids
- OpenCV Python - Template Matching
- OpenCV Python - Image Contours
- OpenCV Python - Transformations
- OpenCV Python - Color Spaces
- OpenCV Python - Histogram
- OpenCV Python - Edge Detection
- OpenCV Python - Image Filtering
- OpenCV Python - Image Threshold
- OpenCV Python - Resize and Rotate
- OpenCV Python - Add Trackbar
- OpenCV Python - Mouse Events
- OpenCV Python - Shapes and Text
- OpenCV Python - Bitwise Operations
- OpenCV Python - Image Properties
- OpenCV Python - Using Matplotlib
- OpenCV Python - Write Image
- OpenCV Python - Reading Image
- OpenCV Python - Environment
- OpenCV Python - Overview
- OpenCV Python - Home
OpenCV Python Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
OpenCV Python - Feature Matching
OpenCV Python - Feature Matching
OpenCV provides two techniques for feature matching. Brute force matching and FLANN matcher technique.
Example
Following example uses brute-force method
import numpy as np import cv2 img1 = cv2.imread( lena.jpg ) img2 = cv2.imread( lena-test.jpg ) # Convert it to grayscale img1_bw = cv2.cvtColor(img1,cv2.COLOR_BGR2GRAY) img2_bw = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY) orb = cv2.ORB_create() queryKeypoints, queryDescriptors = orb.detectAndCompute(img1_bw,None) trainKeypoints, trainDescriptors = orb.detectAndCompute(img2_bw,None) matcher = cv2.BFMatcher() matches = matcher.match(queryDescriptors,trainDescriptors) img = cv2.drawMatches(img1, queryKeypoints, img2, trainKeypoints, matches[:20],None) img = cv2.resize(img, (1000,650)) cv2.imshow("Feature Match", img)