Detect an object on known color on a green surface?
On a white surface, the object can be detected by providing a color threshold to filter the image. Then the image is converted gray scale and passed through a medianBlur + Canny filter.
The green surface is actually artificial turf so its shiny and has texture.
I've tried looking at only the green plane instead of graying out the picture. In addition, it helped to remove the Canny filter.
The image can be scanned for the width of the object (if the red color is above a certain threshold). The, the max amount of the red color pixels in a row can be saved into a variable (giving position and size). However, I'm still not sure the correct thresholds to check for and am getting inconsistent results. On the white surface I am getting slightly bigger widths than on the green surface.
new_image = cv2.add(cv2.add(image[:,:,2],-image[:,:,1]/2),-image[:,:,0]/2)
an example image would be helpful.
Thanks, this was posted kind of late last night, and I didn't think about it.
It sounds like you are using object detection, which would explain why the texture is giving you problems. If the color is known, why not just scan the image for that color pixel..or group of pixels?
@jmbapps Thanks! I can totally do that. I'm having a hard time scanning for the right thresholds. Let me update my post.