I am trying to use object detection to recognise a post-it note within a video feed. I am using emguCV for detection. I tried using the Shape Detection approach but it couldn't recognise the post-it... maybe because I was holding it up in the air so my fingers were obstructing the vertices.
I've also tried using SURF detection but that did not work either I guess because it is a square so does not have any stand-out features.
I attempted to use HAAR/LBP classification but it was taking over 10 hours to train just for one stage for 48 positives and 80 negatives so I gave up.
Can anyway suggest a suitable method for detecting/recognising a post-it note within a video feed? Would be much appreciated.
I have had a similar problem recently, this is how I have solved it. I have just used the post note color in the HSV spectrum to locate it. You just have to choose a color that is both easily recognizable and doesn't change much under angle.
I've used this code to control an AR drone with 2 post-it notes taped to it, so it had to be reliable and fast. Here it is in action. Hope it helps.
def centerFromImage(image, hue_min, hue_max):
image = cv2.cvtColor(image, cv2.cv.CV_RGB2HSV)
hue = image[:, :, 0]
# Filter out green postit note color
# yellow is 90-100
# pink is 137-150
# green is 80-90
hue[hue < hue_min] = 0
hue[hue > hue_max] = 0
hue[hue > 0] = 255
hue = cv2.erode(hue, None, iterations=2)
hue = cv2.dilate(hue, None, iterations=2)
contours, hierarchy = cv2.findContours(
hue,
cv2.RETR_LIST,
cv2.CHAIN_APPROX_SIMPLE
)
center = [0, 0]
if len(contours) > 0:
contour = contours[0]
area = cv2.contourArea(contour)
for c in contours:
if cv2.contourArea(c) > area:
area = cv2.contourArea(c)
contour = c
m = cv2.moments(contour)
center = [0, 0]
if m['m00'] != 0:
center = [m['m10'] / m['m00'], m['m01'] / m['m00']]
center = [int(center[0]), int(center[1])]
return center