On 8/9/2020 3:38 PM, Jordan Brown wrote:
On 8/8/2020 10:29 PM, Jordan Brown wrote:
With invert=false you get an object that ranges from Z=0 to Z=<max
bright>, where 100 is pure white.
It appears that with invert=false you get an object that ranges from
Z = -max to Z = -min. That is, it does not reach all the down to
-100 if you have no pure white, and does not reach all the way up to
zero if you have no pure black.
Make that latter "with invert=true". Sigh.
I've pretty much confirmed this behavior using constructed images with
specific values.
I'm playing with making lithophanes
https://en.wikipedia.org/wiki/Lithophane, where I want to precisely
control the minimum thickness, and want to be able to adjust the
thickness for the particular image.
Note that invert=false is always based at zero, while invert=true has
its limits based on the actual data. Neither of them is right for a
lithophane. You don't want the brightest spot to have zero
thickness. You might (or might not) want the thickness to be directly
related to the input data. You might want the thickness to be
"absolute", that 0% bright is a particular thickness and 100% bright
is a particular thickness, or you might want the brightest spot to
have a minimum thickness and the darkest spot to have a particular
maximum thickness.
Some of that you can get by differencing or unioning. However, photos
are very high-complexity objects, and CGAL render times can be
unreasonable as soon as you bring in a boolean operation. (One that I
just did, for a 300x225 image, took 26 minutes to render.)
Some you can get with resize(), since it will take whatever the
current dimension is, and scale to reach a different dimension. Thus
if you have data that spans 53 units, you can use resize to make it
span 100 units, and you don't have to know the original range.
It is tempting to suggest a few additional features for surface(). I
might even be up for implementing them :-).
Some ideas, roughly in the order that I thought of them:
All of these are things that you could do with an image manipulation
tool. On the other hand, few image manipulation tools let you have
scripts that will do the same operations, over and over again, and
these are all "easy" transformations as you're processing the data.
It would be nice to have a script that controls the entire pipeline,
from the image off the camera to the STL.
Many of these things could be done with OpenSCAD post-processing, but
sometimes it's unobvious and sometimes it's hard on CGAL. Some are
hard to do because you don't necessarily know what the input data
looks like. You can scale the dynamic range with resize(), but you
still don't know what its Z coordinate is. (Hmm. Maybe a
"reposition" operation that is like resize in that it looks at the
actual object, but it does whatever translate is required to move the
minimum coordinate to a specified coordinate. Most general in that
line would be an operation that scales and translates an object to fit
a specified bounding box.)
Any thoughts?