postprocess image data to get cad models

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
cox
Posts: 971
Joined: Wed Nov 26, 2014 11:37 pm

Re: postprocess image data to get cad models

Post by cox »

Thanks @microelly2, this explanation rely helped me see the workflow :D
Looking forward to seeing your progress
Need help? Feel free to ask, but please read the guidelines first
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: postprocess image data to get cad models

Post by microelly2 »

The scipy skimage library has some powerful methods,
http://scikit-image.org/docs/dev/auto_e ... sform.html
The medial_axis method creates one pixel wide skeletons, this is for me the best method to find the exact lines.
Back to my testcase I can get now the exact lines (green) and purge the background grid (blue)
bn_993.png
bn_993.png (8.55 KiB) Viewed 3975 times
Still looking for a open source implementation of this:
http://www.balintmiklos.com/scale-axis/ ... h_2010.pdf
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: postprocess image data to get cad models

Post by microelly2 »

Here a video which demonstrates the steps from an image to a good database.
https://youtu.be/GcSMcMc0br0
The results are skeletons and hough lines.
From here the 2nd pass can start: create good models of figures on top of these data.
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: postprocess image data to get cad models

Post by microelly2 »

The first step of post processing data: Find paths and categorize them as straight lines or arcs of circles.
bp_004.png
bp_004.png (377.3 KiB) Viewed 3902 times
For the moment I have a dialog where I can tune the "path analyzer".
It's amazing for me to see how intuitive seeing can be mapped to mathematical models.

I see great opportunities in working with (matplotlib) colors and data representation to visualize behaviour and structure.
(I'm always fascinated by the pictures of the FEM workbench. )

It's a adventure: I built a machine and now I have learn to use it: What are the right parameters?
or images from screen shots I found good values 6 // 101 for circles and sometimes 10 // 100 for lines.
Next I will scan hand drawn images.

https://youtu.be/QXEPoVpmIiI
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: postprocess image data to get cad models

Post by microelly2 »

I have added two features:

(1) Select a subset of an image. So I do not need to have for each detail an extra photo. I can scan a complete drawing at once and then I restrict myself to the interesting details one by one.

(2) There is a mask node, where I can mask out some disturbing details which are not eliminated by other automatic tools.

https://www.youtube.com/watch?v=Dy6atasetOQ

Using computervison functionality its easy to write a small image editor tool. So my question: Is someone working on an improved version of the image workbench? Painting on the faces of a model may be funny :lol:
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: postprocess image data to get cad models

Post by microelly2 »

The property tab displays the data of exactly one selected object.

But sometimes I want to have more than one object in my focus at the same time.

So the idea is: one widget per object.

There are two ways:
a) arrange the the widgets as dockwindows somewhere inside the FreeCAD main Window
b) create a new top level Widget (separate main Window) and store the properties there

I prefer version b) because I work with more monitors and want to have structure on my desktop.

example

version b: separate window **Reconstruction Tools** - Subwindows are Dockwidgets and can be undocked too
bp_009.png
bp_009.png (237.93 KiB) Viewed 3824 times
version a: all widgets stacked inside FreeCAd main Window
bp_008.png
bp_008.png (205.3 KiB) Viewed 3824 times

My question: what is the taste of the community?
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: postprocess image data to get cad models

Post by triplus »

I read the description and i am looking at 2 sample images but i am not 100% sure about the difference. For example dock widgets can be docked or un-docked and therefore can be moved around. What would therefore be the benefit if i guess instead of dock widget you would use "dialog window"?

As i guess this will be standard FreeCAD module/workbench wouldn't Tasks sidebar be a better choice in the first place? That is tool buttons on toolbars and for complex tools additional options located in Tasks sidebar?
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: postprocess image data to get cad models

Post by microelly2 »

triplus wrote: What would therefore be the benefit if i guess instead of dock widget you would use "dialog window"?
To configure my objects I use DockWidgets like the ComboView.
For every object there can be exactly one Dockwidget.
In my example I have open Dockwidgets for the Image, the Mask, the Skeleton and the Pathfinder.
These Dockwidgets can be undockend and placed somewhere on my Desk.
So I see all parameters at the same time and when I change parameters in the Image I can re adjust the Skeleton.
If there are to many Dockwidgets I dock them back to an area and I can switch between them by clicking the tabs.

What is the mainWindow where the Dockwidgets are docked in?
* In example "a" the dockwidgets are docked into the FreeCAD main Window. This is the common behavior. But when the number of widgets grows the FreeCAD main Window is to small to display all in an acceptable way.

* In example "b" there is a separate main Window where the Dockwidgets for the objects are docked. In this case I can use the FreeCAD main Window in the common way and the 2nd main Window parallel. At the end of the work I close(hide) the 2nd main Window. Whenever I need it again I reopen(show) it and have all its Dockwidgets available without extra user activity.
Depending on the number of Dockwidget in the 2nd main Window I can change the arrangement: tabified or side by side. If there is a large number of dockwidgets and I use tabified layout I can undock some essential ones of them.
In example "b" the Pathanalyzer is undocked and the others are tabified, so I can see two dialogs: Pathanalyzer and (the selected tab) Image
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: postprocess image data to get cad models

Post by triplus »

I see. I guess " example b" starts to become more useful in multi-monitor environment. As i do imagine it would make sense to support such use case i believe having good support for "single-monitor" environment is a must. Therefore you will probably need to rethink some things (or not and just do what you feel is appropriate). Therefore as said the way i see it a lot of the tools from the sidebar(s) are likely better suited as a tool buttons available on toolbar. As for the remaining ones i probably wouldn't go beyond one dock widget or as said offer better integration for individual tool in Tasks sidebar (for more complex tools).

The main problem you are having is you made a lot of tools and you put them all in dock widgets in space inefficient way. After you separated dock widgets and introduced work flow where all dock widgets tools should be visible on the screen. This i guess needs to be rethinked.

The long story short:

Try to move tools to toolbars and properties in property view. Likely if something remains (complex tool) it will fit nicely in Tasks sidebar in some simple form.
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: postprocess image data to get cad models

Post by microelly2 »

Inspired by a discussion in the german forum here is the elevation grid generator:

Starting with some height information (example some points of my garden with knows position and height)
i calculate a surface, that matches the control points and has one of the standard interpolation behaviours (linear, cubic, thin plate, ...)

https://youtu.be/xSsSJ0BzoFw
Attachments
bp_016.png
bp_016.png (509.74 KiB) Viewed 3724 times
Post Reply