OpenCV:Basic
lastmod 2023-10-26created 2023-01-076 edits
OpenCV basics.
Curriculum
- Python basics
- NumPy basics
- Reading and writing images with cv2.imread/cv2.imwrite
- Displaying in a window with cv2.imshow
- Learning OpenCV:Drawing skills such as cv2.rectangle
- Reading video and displaying it in a window using cv2.VideoCapture
- Getting keyboard events with cv2.waitKey/cv2.waitKeyEx
- Saving video with cv2.VideoWriter
- Image binarization with cv2.threshold
- OOP
- Turning the above into classes
- Selecting an ROI region with cv2.selectROI
- Drawing on an ROI region using NumPy slices
- Implementing an ROI selector without cv2.selectROI
- Select an ROI with the mouse using cv2.setMouseCallback, then draw only that region with cv2.threshold
- Pass the
thresholdvalue of cv2.threshold dynamically from the keyboard
- Contour extraction using cv2.findContours and drawing with cv2.drawContours
Typical image processing sequence
- Conversion to the grayscale color space using cv2.cvtColor.
- Image binarization with cv2.threshold
- Noise removal using dilation/erosion morphological operations with cv2.erode, cv2.dilate, cv2.morphologyEx
- Image Contours (image contour extraction)
- Or edge extraction using cv2.Canny.
- Contour extraction using cv2.findContours and drawing with cv2.drawContours
- Line/circle detection using the Hough transform
- Approximating contour shapes using cv2.approxPolyDP
- Minimum-area rotated rectangle with cv2.minAreaRect
- Convex hull - outermost contour detection
Final stage
- cvtoolkit