Skip to content

convert .png to Nutils readable topology data structure

License

Notifications You must be signed in to change notification settings

scdivi/img2mesh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image to nutils topology

This reposity provides a tool to convert .png to Nutils readable topology data structure (i.e. analysis-suitable geometry).

Instructions for usage

  • Name you image as <image_name>_<pixel_size>.png
  • Save it in subfolder images/
  • Create a .raw and .json wrapper from a png file
    • bash img2json.sh <image_name>_<pixel_size> (for example bash img2json.sh walle 35)
  • Go to examples subfolder and run example_2d script
    • python3 example_2d.py fname=<image_name>_<image_size> (for example python3 example_2d.py fname=walle_35)

Topology-preservation

The tool contains a feature called topology preservation -- an alogrithm based on the paper. It can be activated with topopreserve=True. For example python3 example_2d.py fname=walle_35 topopreserve=True. Note that the sharpness of the reconstructed boundariese can be varied with maxrefine argument. For example python3 example_2d.py fname=walle_35 maxrefine=3.

Before topology preservation:

image

After topology preservation:

image

Example images:

Pacman 300px X 300px

pacman_300

Airfoil 100px X 100px

airfoil_100

Rocket 100px X 100px

rocket_100

WALL-E 70px X 70px

walle_70

Carotid aortary 32px X 32 px

carotid_32

Required (external) packages

About

convert .png to Nutils readable topology data structure

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published