The Mask R-CNN is a Convolution Neural Network algorithm, which was introduced by He et al. in their 2017 paper, Mask R-CNN. Mask R-CNN builds on the previous object detection work of R-CNN (2013), Fast R-CNN (2015), and Faster R-CNN (2015), all by Girshick et al.
In this folder is many tutorials for OpenCV. Recommend to take a look.
In practical cases I am learning and dealing with practical cases with OpenCV such as:
- amazon cover search
- eye tracking
- face detection
- recognizing handwritten text
- object detection or plant classification
goal: How do I compute the center of a contour using Python and OpenCV?
- detect the outline of each shape in the image
- compute the center of the contour — also called the centroid of the region
image preprocessing:
- Conversion to grayscale
- Blurring to reduce high frequency noise to make contour detection more accurate
- Binarization of the image (thresholding)
This code is built on previos (center of contour) but here I also add something more. Algorithm is able to recognize shape and also color.
Detect shape:
- Using Dougles-Peucker algorithm
- peri = cv2.arcLength(contour, True)
- approx = cv2.approxPolyDP(contour, 0.04*peri, True)
- IF/ELSE based on number of detected lines (circle, triangle, square...)
goal: find text and then rotate it to right - horizontal position for reading
- Load image -> resize -> change colors into Gray
- Bitwise_not -> background black, text white
- Threshold (pixels will be just black and white)
- Find coordinates and angle with: cv2.minAreaRect
- Rotate image into horizontal position with: warpAffine based on: cv2.getRotationMatrix2D