I have a template image , with white background and black shape over it.I also have an image which have a similar shape but in different rotation and scale,also have some noise in image.Just like the pic as follow!
I want to use a rotateRect to get a Rect which includes the template shape and use the template to find a rotateRect which includes the target sharp.I have known matchTemplate() is not good when object is rotated or scaled in scene.So I try to use matchShapes() function.But matchShapes() function is used to compare with two contours.So can see the shape in target image,the shape is mixed with noise blob and i can't segment the target shape and noise. I want to get a rotateRect which just includes target shape not noise blob.But when i use findContours in target image,the contour which i found will include target shape and noise.As a result I can'tfind the target shape.How can i use template rotateRect to find a target rotateRect in opencv?Can you share your idea.Thanks in advances!!
SilverSurfer
Considering the scenario, you can try segmenting the image on the basis of color since your object of interest is black and noise is blue in color. Then, you can proceed with the contour based approach for finding your target. You can refer this link for implementation OpenCV:Watershed algorithm
You can also refer this SO link Coca-Cola can shape recognition.
来源:https://stackoverflow.com/questions/31490234/is-there-an-algorithm-where-i-can-match-scale-and-rotation-rotaterect-in-opencv