Date post: | 21-Apr-2017 |
Category: |
Technology |
Upload: | balepc |
View: | 44 times |
Download: | 0 times |
● Image processing● Histograms● Smoothing and blurring● Thresholding● Gradients and edge detection● Contours● Machine Learning
Color based detection● Define color boundaries (eg green)
greenLower = (20, 100, 100)greenUpper = (40, 255, 255)
● Apply maskmask = cv2.inRange(image, greenLower, greenUpper)
● Blur & Smoothmask = cv2.erode(mask)mask = cv2.dilate(mask)
● Find contourscnts = cv2.findContours(mask)
Image thresholding
● Apply filterscv2.GaussianBlur
● Apply thresholdcv2.adaptiveThreshol
● Find contourscv2.findContours
● Calculate shapeedges = cv2.approxPolyDParea = cv2.contourAreaIf len(edges) == 4 and area > 100: print “square”
Edge detection
● Apply filterscv2.bilateralFilter
● Edge detectioncv2.Canny
● Find contourscv2.findContours
● Easy to start● Real time processing
● Sensitive to lighting● Sensitive to noise● Need to choose socks
properly
Preparing the data● Color scheme● Size of sample images● Blurring / smoothing● Number of positive / negative samples
Feature extraction● Haar feature● Histogram of oriented gradients● Scale invariant feature transform● Speeded up robust feature● Local binary pattern
Detecting
● Load cascadecascade = cv2.CascadeClassifier('your_cascade.xml')
● Detect objectcascade.detectMultiScale(image)