Importing images leaves work to be done

I imported this outline scanned from a plan,see picture 1. When I trace the image I get a double line as seen in the picture 2. The breaks in the line mean I have several shapes. I can cut the shapes so the inner line is loose, as picture 3, then delete it and patch up the joins but I wonder am I missing a trick that would make this easier?

Original

                            Image traced

Zoomed in at a break

Use the offset tool to scale up (closes gaps) then use the offset tool to scale back down.

That’s due to LightBurn not having a “center line trace” function. A previous discussion covers some alternatives:

Because the image started as a scan, tweaking the Threshold level may improve the Trace results. However, it will also increase the number of random speckles, which will eventually drive you crazy.

I use GIMP to pre-process scanned images: clean them up, blow out the contrast, and generally simplify things for the Trace operation.

For closed shapes like the ones in your images, you can use GIMP to fill the interior with black so LightBurn can Trace a single line around the perimeter.

For example, start with a scanned image of a dumbbell nut:

Blow out the contrast, then use GIMP’s Scissor Select tool and some manual cleanup to convert it into this filled mask:

Your images start with much higher contrast and will be much easier to process!

Although I used it to get a solid model for 3D printing, LightBurn will do what you want:

For me, using an image editor to process images works better than trying to force LightBurn into doing the entire job.

2 Likes

Those gaps in the original are easy to see, and fix. Use MS Paint to fill in the gaps with the Pencil Tool. You will then get a nice separation between the inner and outer loops. Delete the inner loop. You can then use the Offset Tool @JimNM mantioned to smooth it out. Do an ouside offset like 1mm, move it to another layer, then do an inner offset 1mm to get back to the original dimensions. This will be your working path.

Why don’t you just rebuild the shape from scratch. It took me about 10 minutes to make it symmetrical.

Shape.lbrn2 (8.9 KB)

Perfect!

That’s quick and easy. Now for the other 140 odd parts.

1 Like

Just for fun, I made a web app that tries to extract centerlines from image files like this…give it a go (click on the image below):

image

Credits & Acknowledgments

This centerline extraction tool is built using the following open-source libraries (with the help of GitHub Copilot):

Image Processing:

Web Framework:

Additional Libraries:

Algorithm Development:

  • Circle-based evaluation system and optimization technique developed by Nicholas L
2 Likes

I had to raise the Dark Threshold to 0.5 and raised the Smoothing Factor to 0.03, but it did a pretty good job after that. Fast too! Wish I had this two years ago. Nice job, do we get to keep it? :joy:

MerDolph-01 - Copy_centerline

Thanks Mike :grinning_face:, I can probably make a much better version if it’s useful, although I doubt it will be needed as it’s only a matter of time before Lightburn will have something much better available as a trace option.

If you wrote in QT6, then just kind of sneak it in? :joy:

LB Trace seems to have received a boost going from v1.0.08 to v2.0.04. I rarely have to touch any of the controls now.

Hi Nicholas

I loaded up an image…or at least, I selected an image for upoad but nothing seemed to happen. Are there only specific file types that work with this app.

Hi Peter, TBH I haven’t tested a lot of different images, but .jpg .png .bmp .tiff should all work.

There may currently be an issue with png images with transparency, if you DM me any image that doesn’t work I can look.

I think I can simplify this program so the ‘Detection parameters’ that will produce the longest continuous medial lines would be set automatically.

And you might get better results if ‘Enable Optimization’ is not selected - and instead optimise in LightBurn with arc fitting.

I made this in the spur of the moment, mostly out of curiosity to see how much I could get AI to help with the programming process.