serycjon / vpype-flow-imager

vpype plug-in to convert images to flow field line art.
GNU General Public License v3.0
168 stars 12 forks source link

flow_img fails without -tf set #3

Closed bcongdon closed 3 years ago

bcongdon commented 3 years ago

If I try to run vpype flow_img img.jpg without the -tf flag set, I get the following error:

File ".../vsketch/venv/lib/python3.8/site-packages/vpype_flow_imager/vpype_flow_imager.py", line 228, in d_test_fn
    return d_sep_fn(*args, **kwargs) / test_frequency
TypeError: unsupported operand type(s) for /: 'float' and 'NoneType'

It looks like that flag might need a default value? Running vpype flow_img -tf 2 img.jpg seems to work

(As an aside, thanks for making this! It's a great addition to the vpype ecosystem 😄 )

serycjon commented 3 years ago

Thanks for the report, fixed.

kevin227227 commented 3 years ago

what does the "-tf" parameter modify in the drawing ?

serycjon commented 3 years ago

You probably do not have to touch it. It changes a frequency of streamline distance tests. The image darkness dictates how far apart should the streamlines be. This distance gets divided by the tf parameter to compute streamline step size. With low tf, the streamline distance check will occur less frequently and the streamlines will get closer together than they should. You get better precision with higher tf, but the computation will be slower.