MoI discussion forum
MoI discussion forum

Full Version: Converting planar curve(s) in a PNG into NURBS curves

Show messages:  1-17  18-25

From: MO (MO_TE)
26 Jul 2023   [#18] In reply to [#17]
Hi Brian

I tested "svgtrace.com", It traces bitmap images fairly well, The problem is, it generates "outlines" of the png curves.
For your case you need "center lines" of png curves .
Inkscape's "Centerline tracing(autotrace)" option works nicely for this case.

I will explain my procedure on extracting one of the curves of your png file.
(I'm using krita to separate overlapping curves, but it can be done with other pixel apps too, Or skipped if no overlapping exists)

<Krita>
Increase color saturation with "HSV Adjustment" filter.(CTRL+U)
Use "similar color selection" tool to select curve's color (low fuzziness).
Copy-paste selection. It will generate a new layer with selected pixels.
Hide all other layers except the new one.
Export new layer as "separated_curve.png".

<Inkscape>
Import the "separated_curve.png". Open "Trace Bitmap" panel (Path ==> Trace Bitmap)
Trace Bitmap as shown. save as PDF.



<Moi>
Import pdf. cleanup. rebuild curve (#Points).

As you mentioned, manual tracing inside moi can be much accurate and maybe faster.
Here is a quick, inaccurate result.

Attachments:
PNG_Curves.zip

Image Attachments:
PNG_To_Curve.png  PNG_To_Curve_Res.png 


From: bemfarmer
26 Jul 2023   [#19] In reply to [#18]
Hi MO,
Thank you very much.
Yes, the outline curves seem to cause some curve, and curvature (G1,G2), inaccuracy of some sort.
I was unaware that Inkscape did centerlines, but did briefly try Inkscape outlines. I think
Inkscape failed with an unfuzzy band (?).
Will try this "Krita".

For my particular PNG's, I think that in the overlap regions, some pixels only have one color (plus that color's fuzziness, so recovering say the blue band, will result in its tapering down to zero. So maybe some blending in MoI will be needed later.

- Brian
From: Frenchy Pilou (PILOU)
26 Jul 2023   [#20]
In case of :)


From: bemfarmer
26 Jul 2023   [#21] In reply to [#20]
A smart use of LineWeb!

- Brian
From: MO (MO_TE)
26 Jul 2023   [#22] In reply to [#19]
- - So maybe some blending in MoI will be needed later.

Yes, that's what I did to regenerate lost parts.
I also duplicated some overlapped regions. (Blue and Green curves)
From: bemfarmer
26 Jul 2023   [#23] In reply to [#18]
EDIT:
There is OLD, obsolete information on the internet, regarding Centerline Autotrace, in old Inkscape versions (~.9x).
Inkscape version 1.2 and 1.3 have the tool hiding in the Trace Bitmap selection.
See 2nd post following.

So this post is altered, to remove false information

- Brian

I did HSV adjust in Affinity Designer, Pixel Persona...
From: MO (MO_TE)
26 Jul 2023   [#24] In reply to [#23]
I didn't install any additional plugins on my inkscape.
Maybe a fresh install or a newer version helps.
Inkscape 1.1.2 (b8e25be833, 2022-02-05)
From: bemfarmer
26 Jul 2023   [#25] In reply to [#24]
FINALLY,
In Inkjet version 1.3, (and presumably 1.2) Centerline Trace menu choice is HIDING in the
Trace Bitmap > Single Scan > Detection Mode (dropdown list).
(I upgraded to Inkscape 1.3, and did NOT install any add-ins or extensions.)

- Brian
Did a very quick successful test.
Imported to MoI. There are some gaps, and little squiggles, in the single centerline curves, but MoI can correct these.

It is first necessary to click on Layers, and select the PNG layer.
Also, in the Trace Bitmap screen, it may help to use "Adjust Threshold". Or not? It is not in the Centerline menu, just the Brightness cutoff menu.

Centerline trace of multiple overlapping curves tends to introduce "crossing over" squiggles. (Like DNA:-)
So the source PNG should be simplified to one pixel curve, or 2+ NON-overlapping curves.

The centerline trace curves are Vectors, (SVG), so there is almost no fuzziness at small zooms, unlike the PNG images.

Multiple color curves come out as single color Vector(s).

Show messages:  1-17  18-25