Quite often, that is the heart of the matter. Thank you for kicking that can up front.
Sometimes, people are not so much interested in -foo
as they are in âHowever you do that criss-cross thing, whatever?â
Whatever that âcriss-crossâ thing is, it arises from the Cookbook article Eigenvalues and Eigenvectors. The gist of that page is: unroll the label âtensor fieldâ, wherever you may read it, to âbox of ellipses, one for each pixelâ.
Why care about ellipses?
Theory: In the immediate neighborhood of each pixel, an ellipseâs semi major axis documents the direction of fastest intensity change, this direction encoded by grayscale channels Cosine and Sine. Channel EigenOne (semi major axis length) encodes that intensity change âin the direction of the gradient (λ1)â. Channel EigenTwo, (semi minor axis length) encodes the magnitude of a vector always rotated 90° counter to EigenOne. EigenTwo encodes a magnitude âin the direction of the contour (λ2).â The eccentricity, e, follows from:

so a very eccentric ellipse (nearly one) straightaway indicates that in the immediate neighborhood of the pixel, there is a very steep gradient with respect to the contour: i. e. the pixel is on an âedgeâ, while a very circular ellipse (eccentricity nearly zero) indicates a pixel sitting on a âplainâ. Note that e is just an off-to-one-side calculation for visualization purposes. When we flip the roles of λ1 and λ2 â as we are about to do â we will be dividing by zero only insofar as far as this relation is concerned â but we arenât using this relation. Making tensors does not care about eccentricity. So sleep tight through the next dangerous curve.
Recipe: Append EigenOne and EigenTwo into one two-channel image; append Cosine and Sine into the second. -eigen2tensor
computes from these two intermediaries the per-pixel tensors encoding this data. Hand off to -smooth
or whatever else that eats tensor fields for breakfast. In any case, weâre doing Arto Huotariâs âDream Smoothingâ at right angles.
To wit: the scriptâs game. Ask -diffusiontensors
for a smoothing tensor field. -eigen
unrolls whatever -eigen2tensor
rolls somewhere in the guts of -diffusiontenors
. Throw out whatever eigen values -diffusiontensors
told us about: we just want eccentricity 1.0 ellipses. That is, for purposes of Art, we claim every pixel in the image sits on an edge. Then we flip semi-major and semi-minor axes for the makings of a second tensor field that, when fed to -smooth
via -eigen2tensor
, effectively operates in directions 90° rotated from the first tensor field, a follow-on consequence of shrinking the semi-major axis to zero while stretching the semi-minor axis to one: the ellipse effectively rotates in place. From the same source imagery (The Cat): drive one channel using one tensor field ([smooth0]
); drive the second channel using the second tensor field ([smooth1]
). Color and filter those channels however you want.
For my lot, I stacked a blue channel under smooth0
(red) and smooth1
(green) and impressed it with the averaged intensities of both, just to get a very rough magenta/cyan palette, then performed a +120° color space rotation around the white axis to align the color climate more to what I had in mind. -blur_bloom
to desaturate-by-smear the color channels was an odd choice, perhaps. I was intrigued by its non-linear âblooming blur.â In any case, it gave me a couple of off-center grays, one kissed by purple, the other by sea-green, that fit my notion of âghost-likeâ. Take that where you will.
So thatâs the criss-cross thing. Easy stew to make once the rabbit is in the pot. First: get the rabbit. Bugs Bunny rarely cooperates with us Elmer Fudd tutorial writers. Back in the day, I was a long time poking around tensor fields before I could do anything interesting with them. The heart-and-soul of theory-first, dress-it-up-in-GâMIC-commands second, is a long tutorial row to hoe. Iâve only written a few tutorials of that ilk. Some more to come some day.
Before closing, there is another bit of theory, quite apart from the criss-cross thing, that (I think) could amuse. The Cat, you will readily note, was taken with a drum-head narrow depth of field - maybe f/1.4? f/1.2? - her face in pin-point focus, and everything else, fore-and-aft, going soft. Thatâs a use case for an Airy disk or a rough approximation thereof: big positive spike surrounded by a shallower negative ring, so-scaled that the ring sum just cancels the spike - net energy: zero. Convolve that Airy disk over edgy (in-focus) regions to get hugmungous +/- coefficients. Soft focus: not so much. square and threshold-cut just to get the in-focus face framed by nothing at all. A ghost cat peering in from the void. Keep an Airy disk in your kit for just these tight depth-of-field images.
Thatâs it for now. Have fun. Thank you for the comments. Back to the tutorials.