Saturday, December 23, 2017

Making a mask on OpenCV by matching a CAD drawing to a picture

Leave a Comment

I'm working on a project and am not sure the following functionality already exists with OpenCV: I have a picture taken of something and a black and white outline of that object from a CAD drawing. I need to analyze the object, and only the object, so I want to somehow match the CAD drawing to the picture. Currently, I'm doing this by not using the CAD drawing and just having the user outline the object with their mouse, like in Photoshop, which then creates a mask to isolate the object. I was reading This page on Template Matching, but that won't be match the image enough for what I want, since that just finds an area. I was thinking about using findCountours() or some type of edge detection, then trying to match the CAD drawing to that. A simple image of what I want and an outline would be this donut and it's outline:

enter image description here

enter image description here

While this isn't a perfect example of images since I just found them online, I think it is close enough to what I'm working with. I don't think it is useful for me to post code since I'm just search for some methods that I might be able to use for this task and am still really new to OpenCV and trying to learn it.

A difficulty I'm having with the CAD drawings is that they will not be the same size as the picture I'm trying to match them to since the picture is taken with a camera, so sizing will be different and the CAD drawing may need to be expanded, rotated, or skewed depending on different angles.

I've also been looking into having the user select a number of points on the CAD image then click those same spots on the actual picture, then have the program match up the points to overlay the CAD image over the picture, but I haven't found good tools in OpenCV for this either.

0 Answers

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment