4
$\begingroup$

I have many photos of devices which must be traced into AutoCAD. Is there any software for tracing object edges/outlines automatically so that a Primary Plan of the object can be made in AutoCAD?

For example: the photo below, shows an object I would like to have a line drawing of in AutoCad.

main

I need to trace the object's edge/outline from a top view and create a line drawing in AutoCAD.

I tried Photoshop by using it's Magic Wand Tool and made this:

1st

The method I used was from How To Transform an Image into Lines to AutoCAD by youtube

I found this site and made this photo by using it's edge detection function:

My photo is in www.photo-kako.com/en/edge.cgi:

enter image description here

So after this how could I change the main edge/outline to a line drawing in AutoCAD automatically?

Or how could I do this better, any help or instruction for saving time and getting a better result would be appreciated?

Because the lack of time, I have made that work by my hand similar to this :

hand line panting!!!

$\endgroup$
  • 1
    $\begingroup$ Its possible. But you need to plan your Photoshoot better so that you can eliminate camera perspective and distortions, as well as a rule to determine plane size. Also having better light conditions would help. $\endgroup$ – joojaa Jan 15 '17 at 10:56
  • 2
    $\begingroup$ If the object is flat, like in your example, you can put it in the scanner, over a transparent film (to protect the scanner glass). And as Chris mentioned, there is no simple way to do it automatically, better just draw it manually over an image. $\endgroup$ – Mikhail V Jan 15 '17 at 20:50
  • 1
    $\begingroup$ If the detail is too heavy and can break the scanner, you can also make a "imprint", cover the surface with some black marker, and press it on a paper sheet, then scan it. $\endgroup$ – Mikhail V Jan 15 '17 at 20:58
  • 1
    $\begingroup$ I would try to get an image with much better contrast between the front face and everything else, then push the image to essentially a binary white/black state, giving you a clean outline drawing of the face. $\endgroup$ – Carl Witthoft Jan 16 '17 at 14:55
  • $\begingroup$ A fast hack you can try... immerse the item in an opaque liquid (milk with red food colouring mixed in is ideal) and just enough of the liquid to be level with the top surface without covering the object. Then photograph carefully from the top. The liquid covers up any faces that are visible because of perspective, leaving only the end surface visible in the photo. This will make the edge detecting algorithm much more effective and accurate. $\endgroup$ – user6335 Oct 16 '17 at 8:10
3
$\begingroup$

One option is to import the jpeg directly into AutoCad and simply trace the lines you want over the top in a new layer.

While this isn't automatic as such I suspect that it may end up being less trouble than going through multiple pieces of software and a your example shows there is a good chance that you will need to do a bit of manual tidying up in any case especially as the photo in the example isn't very high contrast and you have a lot of shadows and perspective to deal with. So it is unlikely that an automatic edge detection tool is going to reliably do what you want, certainly with that sort of quality of photograph.

Plus be aware that close-up photos like this can distort the image quite a bit especially at the corners. Just the fact that you can see the part receding into the background indicates that it is not a true flat projection and unless you know the lens type and focal length used to take the picture this is not easy to correct.

| improve this answer | |
$\endgroup$
  • $\begingroup$ I agree with your estimate. But you could do this. Just not much worth it. Anyway i did this for fun in about 5 minutes (see other answer) but again the result is not worth the effort. (did it to prove the fact) Spending more minutes would improve it but you'd still be better of doing it more manually. $\endgroup$ – joojaa Jan 17 '17 at 8:34
3
$\begingroup$

TL;DR;

Possible but not nesseserily worth it.

Introduction

Its possible, but it is a bit questionable whether its actually practical or saves you any time. See when you photograph a section you get into measurement, and measurement is hard. Even just photographing that you get a easily traceable image needs some careful thinking about setup. In addition you get into trouble with noise, and distortions caused by lens and not entirely perpendicular camera shooting angle. You can handle all this but its quite much work. Also you need much more than one shape for this setup to be beneficial.

Photographing better

Even so there is quite much you can do for the photography session.

  • Using the scanner as suggested by user Mikhail V eliminates many of your problems. Its not prone to perspective distortions (except to one caused by uneven cut), and comes with its own light setup. The rubbing suggested can also be a good way to make the image flat for photography too. You get the scale.
  • Use a lens with a flat focus plane. Most macro lenses do but most general purpose and portrait lenses do not.
  • Use a lens with a long focal length, the longer focal length the more like a orthographic your projection will be and the more uniform your lens distortion. You can also photograph form further away and use less of the resolution area of the lens for same effect.
  • Use a tripod.
  • Use a marker/brush to make the surface you want to capture colored. This will make it easier to see and photograph the end. And makes a huge difference in the masking stage (and can in fact eliminate it entirely).
  • Use a diffuser on your light, or use a soft box for photographing.
  • Print a checkerboard on the background so that you can correct for distortions and perspective errors. Also would be good if the object is a flat slice but you can not have everything.
  • Include a scale in your image on the plane your trying to capture. Images captured by a camera lose scale information.

In general its best to actually spend time on the photo shoot to get things correct as it saves you lot of time in the masking stage.

Digital conversion of image to

You can simply do this in Photoshop, the process is pretty easy. Once you have selected the area you want to capture, and have a selection tool enabled. Right click on your canvas and choose Make Work Path..., this will simply trace the selection edge.

enter image description here

Image 1: Before and after making selection a work path

You can then use File → Export → Path to Illustrator this will create an old AI file that is in postscript format. You can either open it in illustrator (or copy paste the path) and save it as DXF and then read it in form there. Or you can just read the postscript file in AutoCAD with many available importers. (or write your own the format is fairly trivial)

enter image description here

Image 2: Resulting quickly masked image path in AutoCAD, image lost scale and could have been done better in first place with better source images.

Now the results aren't stellar because your source image is bad, one can do much better with more advanced masking techniques*. In general the results will not be super good as all your actual geometric flaws are in the image and round holes will no longer be round for example. And the design is supposed to depict the ideal object. But in general if you take precautions and work your photography session slightly more then you can use a camera as a cheap coordinate measuring device (look up stereo geometry).

But in this case i think you'd be better off taking the object in one hand and calipers in the other. I mean I wouldn't scan this thing, but your mileage may differ.

* Some of which use manual tracing which you wnated to avoid.

| improve this answer | |
$\endgroup$
1
$\begingroup$

You would want to use a feature in adobe illustrator called "live trace" you can "place" an image into an illustrator file and select live trace. You can tweak the settings and presets until you get the best result. Then, you "expand" the result which you can export to DXF. It's not perfect, but if your images are sharp and have good contrast, you may get good results.

| improve this answer | |
$\endgroup$
  • $\begingroup$ You dont need live trace just convert a selection to a path in photoshop. Its a totally different thing as to if you actually benefit from either method. $\endgroup$ – joojaa Jan 16 '17 at 5:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.