Is there an algorithm where I can match scale and rotation rotateRect in opencv

拈花ヽ惹草 提交于 2019-12-20 04:30:28

问题


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't
find the target shape.How can i use template rotateRect to find a target rotateRect in opencv?Can you share your idea.Thanks in advances!!

回答1:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!