Converting planar curve(s) in a PNG into NURBS curves
 1-20  21-25

Next
 From:  bemfarmer
11152.1 
I have a PDF math paper with graphs of Curvature and Torsion, also centerline curves, which I would like to utilize as NURBS curves.
Image import and placing multiple points to create curves is one option.
Another option is to convert the PNG curves to SVG curves.

Use SVG trace or VectorMagic to convert PNG to SVG.
Import SVG into MoI.
If there is only one PNG curve, the original PNG curve (may/will) appear as pairs of NURBS curves, with a very small separation.
If there are crossing or parly overlapping curves in the original, it will be necessary to clean up the curves in Moi, to get the desired pair of curves, with Trim and Blend.
(The center of Tan_Tan circles will be on the "average" of the two curves.)
Find the average of the pair of curves with Loft of line segment, and find the centermost Iso_Line, which is the Medial curve, (more or less, for relatively uniform initial curves).

https://discourse.mcneel.com/t/finding-the-average-curve-between-two-curves/149668/13

Orient the Nurbs curves to the proper location on the MoI screen.

This is an initial outline.
Offset command does not quite have the correct result.
Maybe there is already some script in MoI?
Keywords include Medial Axis, Equidistance, central curves, voronoi.

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
11152.2 In reply to 11152.1 
Hi Brian, one technique to get a median shape between 2 curves is to do a Construct > Loft between the 2 curves and then extract an isoparm (Construct > Curve > Iso) from the loft surface.

I think Max's cmorph plugin does that. http://moi3d.com/wiki/MaxScriptArchive

But that's only going to work for pretty simple cases, not if there is something like a centerline for a complex boundary with multiple branches. Another keyword you might search for is "straight skeleton".

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
11152.3 
Here in 3D but will be the same in 2D ;)
CMorph by Max Smirnov


Ps Will works with circles but not with "rectangles" or "polygons"
Don't works with curves with sharp "angles"
So first Fillet the rectangles or curves (with "angles") with a very tiny angle! ;)

EDITED: 18 Jul 2023 by PILOU

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
11152.4 
Thank you Pilou.

So, I have discovered that in Windows 11, clicking on a file, there are 5 icons at the top of the dropdown list, including Cut, Copy, Rename, Share, and Delete, accessible WITHOUT clicking on "Show more options".
Windows 11 is currently displaying thumbnail of SVG file saved from a PDF.
The very annoying Windows 11 "news" popup in the lower left corner is now occurring. I was sure I disabled it a year or so ago...

SVGTrace online free conversion tool permits clicking on the various colors in the PNG, and will then convert curves to their corresponding color Layer (Like a Style in MoI). (lMy example has about 6 layers, including axis labels and values, with some colors the same for labels and one of the curve.)

Various color layers can then be deleted, and the conversion to SVG done. BUT the decolorized curves will still be SVG Imported into MoI. BUT, MoI will then create many more closed curves, including the desired Layer, in segments, some partly overlapping, making it easier to clean up the desired curve "pair".

MoI does NOT import color layers as Styles???

I wonder if Affinity Designer is good for editing SVG? It is "inexpensive".

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
11152.5 In reply to 11152.4 
Hi Brian,

re:
> MoI does NOT import color layers as Styles???

Correct, MoI does not read colors in currently for PDF/AI/SVG import.

You might try DXF for the transfer into MoI.


> I wonder if Affinity Designer is good for editing SVG? It is "inexpensive".

Affinity Designer is good, you might also look at Inkscape.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
11152.6 In reply to 11152.5 
Thank you Michael.

Here is the PNG graph that I have started with.
The tallest curve is to be isolated and converted to NURBS curve.

- Brian

https://imgbox.com/PdYzdONn
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
11152.7 
I bought Affinity Design, and Photo and Publisher.
The PNG exports to SVG, but MoI does not seem to import the SVG. (There are a bunch of export setups.)


- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
11152.8 In reply to 11152.7 
Hi Brian,

re:
> The PNG exports to SVG, but MoI does not seem to import the SVG.

MoI only reads vector drawing entities from SVG files, bitmap images will be skipped.

You'll need to convert it from raster/image data into vector drawing data, you mentioned a couple of tools above for doing that like SVG trace / VectorMagic.

If you're doing the raster to vector conversion already can you please post an example SVG file that will not load into MoI ?

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
11152.9 
you must see at the free Photopea online! ;) for me the best for this price! ;) And more easy than Inkscape!
Vectorize Bitmap
tested PDF and SVG from Moi...no problem :)
https://www.photopea.com/learn/ https://www.photopea.com/tuts/
it has also inside the magic function of AI image! ;) InPainting, OutPainting !
https://www.photopea.com






EDITED: 18 Jul 2023 by PILOU

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
11152.10 
Speed test with Photopea...not sure you can import colors ... here in SVG ...works also without color in PDF !
Same result with Affinity (only SVG) no color PDF seems not works...(surely a bitMap )
https://moiscript.weebly.com/uploads/3/9/3/8/3938813/testaff.pdf (affinity file pdf who don't work in Moi)

EDITED: 19 Jul 2023 by PILOU

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
11152.11 
We can import curves drawn from Photopea ... just Fill them first...


"
---
Pilou
Is beautiful that please without concept!
My Moi French Site My Gallery My MagicaVoxel Gallery
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
11152.12 
Affinity Designer V2.1, does NOT do autotrace conversion of pixels into vectors. It can be done manually, or by some other programs.
https://www.youtube.com/watch?v=480dGcU6ce4
https://forum.affinity.serif.com/index.php?/topic/130625-png-to-vector/

Auto Trace in other programs takes many seconds to do.
Vector Magic ($), Inkscape, and SVG trace can do auto trace of PNG pixels.

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
11152.13 In reply to 11152.12 
Vectorization of a bit Map : free Photopea online can do it also in a second! sea above! ;)
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
11152.14 
After a lot of study and practice, here is an outline of one procedure to prepare a PNG for autotrace to SVG that may be imported into MoI.
Documenting such procedures takes some time, and there may be a few minor steps omitted.
Older versions of Affnity may have minor menu differences. So watching old YouTube videos can be trying. Also there is a lot of terminology, and one word can have different meanings in different contexts.

1. Open Affinity Designer and load PNG file. The image shows up with White background pixels, and 6 color curves and graph axi and graph labels. (Only one color curve, plus graph axi and labels wil result in the final modified and Exported PNG, to assist and simplify future vectorization.) ("Behind" all of the pixel colors, is a checkerboad of the pixel locations, which will begin showing up as colors are deleted, or copied to new layer(s).)

2. Select "Pixel Persona".
- File > Persona > Pixel
- Or else click Pixel Persona icon, upper left corner of screen.
On the right hand side of the screen, below the color wheel, one Layer is shown, which initially has ALL of the Pixel information. Orange curve Selection and copy/paste will be used to create a new OrangeLayer. Pixel cleanup and copy/paste (or cut/paste) will be used to create a new GraphLabel layer.
The original Layer will be deleted, and the two new Layers exported to processed PNG.
The two Layers will NOT be exported to SVG, because such a SVG would be a pseudoSVG file, containing embedded pixel data, NOT vector data of a true SVG.

3. The original Layer is named "Background". Any layer may be renamed. Optionally, Duplicate the original Layer, as a backup. (This backup has lock icon)).
- On RHS of screen, right click the Layer and click "Duplicate."
- Select the non-locked Layer, by clicking on it.
(For practice learning, it would be simpler not to bother with the backup layer.)

4. Select the Orange curve, and copy it to a new Orange Layer.
- Make sure the sole original layer on Right, is active/selected (highlighted), by clicking on it, if necessary.
- Select > Select Sampled Color.
All colors get selected initially. A Tolerance popup box will appear on the screen. 15% seems to be a good value. Tolerance is the value of the color about to be picked, to include slight color variations.
- Adjust the Tolerance value to the desired value. If the Tolerance is too high, other colors may be added to the selection.
- Zoom way in, and click in the middle of the Orange curve band. The orange band is seleced
- Click "apply" in the Tolerance box.
- Right click on (layer or pixel screen) and select Cut or Copy.
- Right click on (layer or pixel screen) and select Paste.
ESC
A new Layer rectangle appears directly above the active layer, and contains the color band(s) selected.
Note that there is a "Toggle Visibility" button on each layer rectangle.

5. It is desirable to copy the Black axi and labels to their own Layer. To do this, it is necessary to edit out the Black curve ribbon, using Pixel Persona Tools, primarily the Lasso select tool, which works very well, with a small learning curve. (A little different that the MoI select method.) Then the steps of step 4 can be repeated with selection of Black axi/label, Tolerance, and Cut(Copy)/ Paste.

6. Clean up the two new layers, if there are a few undesirable pixel shades, with Lasso select.

7. Delete original Layer, and Duplicate, and Export the two new Layers to a new PNG. <<<END OF Affinity Design processing>>>

8. Perform AutoTrace with another program, with the new PNG as input image file.
Download the output to SVG file.

Autotrace programs:

SVG Trace, (Free, Online, works well.):
https://svgtrace.com/

Adobe Express, png-to-svg, (Free, Online, works well.):
https://adobe.com/express/feature/image/convert/png-to-svg

Vector Magic, ($, Online or Desktop):

There are several others.

Import the (true vector) SVG into MoI, for further processing.

- Brian

I still have to try out PhotoPea :-)

EDITED: 23 Jul 2023 by BEMFARMER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
11152.15 
Due to overlapping curves, and related loss of some color pixels, maybe it is better to import a selected PNG to MoI image and trace in MoI???

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
11152.16 
Affinity Design can ALSO Trace/Draw Vectors, in Designer Persona, on or near Pixel objects of a PNG image, so more study is needed.
Then export to (true vector) SVG...and skip the 3rd party AutoTrace program.
Then import the new SVG into MoI...

https://www.youtube.com/watch?v=7N-ePdWaBns
The video goes so fast, and so low volume, that it is hard to follow...

AD vector tools:
https://www.youtube.com/watch?v=hsbtJxqBi_I

- Brian

So, using Affinity Designer, I am shifting focus to reproducing 2D curves in PNG pixel image, with Vectors, using the numerous AD vector Tools.
Include scaling/alignment references. Save as AD (true vector) SVG, to be imported into MoI. This bypasses using Image command in MoI.

EDITED: 24 Jul 2023 by BEMFARMER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
11152.17 
Attached is the Top view of a 3D curve, which is Red. The 2D mirror half is not shown.

The Blue curves are the Trimmed, Blended (G1 and G2) and Joined profile traces of a band of blue pixels.
Some of the Blends had to be slider adjusted. Rebuild was done at .001.

The Red curve is the Loft of the two Blue curves, with center point selection of central IsoLine.
The Loft had to be in #Points mode, with about 100 points, to look good.
The Red curve is the Goal.

Loft and IsoLine was used instead of cMorph.
cMorph produced a central curve, which was very off-center. (The cMorph script might be improved by adding #Points mode ???)

Initial PNG was processed in Affinity Design, with two reference vector lines for X and Y. Saved to number2.PNG
Affinity Designer does not have autotrace of a pixel band. Manual tracing can be done with enough experience, but it is much nicer to work in MoI.

Online SVGTrace was used to vectorize blue pixel band of number2.PNG to vector SVG file.
(Inkscape Trace Bitmap command is derived from PoTrace.)

Import of SVG into MoI was huge, but Orient Line/Line was used to adjust size.

Now on to XZ and YZ views...

- Brian

I need to delete some old attachments.
Also Harddrive is too full...
Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  MO (MO_TE)
11152.18 In reply to 11152.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.


  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
11152.19 In reply to 11152.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
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
11152.20 
In case of :)

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
Show messages:  1-20  21-25