Shape Digitizing and converting to DXF

Good evening,
this is my first post, so I hope I´ve selected the correct forum.

I have the following problem:
We have to photograph shapes and wooden modells and send the pictures to another factory where the images will plotted true to scale in the correct dimension.

I read a lot of camera calibration and so on, but i´m not sure if this is relevant for my 2D(?) modells (Most of the calibration tutorials works 3D in a room with many different angles).

We can photograph the shapes and modells in front of a defined raster (grid) as background but then I´m not sure how to continue.

The final solution should be, that we´re able to convert the images in a dxf file, but this is in the first step not necessary (but if anyone has any hints how to solve this problem I´d also very thankful).

I found a professional solution, but this solution is very expansive and I think this will never amortise (but it´s maybe helpful for better understanding: Virtualdigitizing software for glass, templates & patterns - Glass-iq.com)

I also haven´t found any similar question but maybe it is not possible how I want to realize. Any help is appreciated (and by the way sorry for my bad englisch, I´m no native-speaker).

welcome.

they basically made a “document scanner app” that takes a picture from any angle and pulls it straight, assuming those four markers define a proper rectangle. only difference to “document scanner” apps is that those figure the corners from the contour of a white sheet of paper vs background – and here you could do that as well! – vs. this does it from those corner markers that have to be placed precisely

there’s no magic in that. find the markers (or have user click on them approximately), get precise location (cornerSubPix), getPerspectiveTransform, warpPerspective, “done”. I’d recommend different corner markers because those look a little tricky to detect. typical algorithms for finding corners work well with chessboard corners (same as on a crash test dummy).

their screenshots indicate that the user still has to trace contours manually.

Hi,
thanks for your very quick answer. I´ll try to build it as you described and see if I get any usable result :slight_smile:

Hello,
I tried a little bit with the hints you gave me, but I´m struggling on a problem with the “crashtest-Marker”. Is there any option to make sure, that I only get the middle corner (in my picture the blue marked), and not some of the others (like the red marked).

Thanks a lot.

Unbenannt

hm not sure.

usually this is combined with a blob detector that finds the outer circle first, and then looks for the corner in its center. you need an easy to find outer circle, so either the yellow marker goes on a dark background, or you put another black circle around the yellow circle so you get a nice contrasting contour.

if you have corners only, the usual trick is to round off those corners you don’t want to be corners. it’ll look like a two-leaf clover.

the corner you want is a “saddle point”. the corner circled in red isn’t a saddle point. this is distinguishable in the second derivative, I think. don’t quote me on it.

you can skip this part for now. it’s a distraction. the homography stuff is the crucial bit. use manually entered coordinates, i.e. hardcoded numbers or have user click on the picture.

Hello,

I made very good progress in this topic. I solved the finding of the edge-corners with creating a mask for red color, then searching the circles and search inside the red circles for the corner-points. After that I import the image in inkscape and draw my dxf file. Everything works fine so far.
But my problem is, if the models are not plan (e.g. a paper) but from wood with between 4 and 20mm thickness, then the result is too big (what´s logic, but I don´t know how to recalculate). Is there maybe already a function in opencv or has anyone a good idea how to correct the finished size dependend from the thickness? (In my opinon it´s also relevant how far from center point the edges are, because I think the more distant the bigger is the correction angle and the smaller must the finished image).

Any help or “food for thoughts” is appreciated.

Thanks,
Christian

Hi,

What do you mean by 4 to 20mm thickness, in the same model, like a 3D part?
Or just one thickness, between 4 to 20mm?

I think, and i don’t have much experience, that if you center your camera correctly and use a ring flash, you can flash out and shadows and get a nice contour, no matter what thickness the model has. A ring flash and a low distortion lens would be recommened.

Play with apeture and speed, its not about the beauty off the picture, more the functionality, crisp edges, no shadows.

That’s my food for thoughts

Interesting project,
good luck with it