Do Your Own Diffusion Tensor Fields

In the usual course of events, an image comes in from the wild with a baggage of noise, and one would like to make as much of it go away as possible without losing what's “really in” the image1. In G'MIC, the command of choice for such work is -smooth. It is a nice black box that does something called “anisotropic smoothing” and hundreds use it daily without knowing much about what goes on inside, and since it doesn't cause people to break out in hives who's to worry?

We who write tutorials, of course, are constantly interested in what goes on inside, if, for no other reason, than to see if the mechanisms therein can be debauched used for other purposes. Of course, if one ever does look inside of -smooth,2 all the anisotropic smoothing bits, -structuretensors, -eigen2tensor, -eigen and -diffusiontensors, are there along with other shiny bits, and while every one of them is designed to work with -smooth, each can be used for other purposes.

In this Cookbook Recipe, we'll harness -eigen2tensor to package up tensor fields for various shenanigans. In the usual course of events, -smooth acquires diffusion tensor fields from the anisotropic smoothing bits, but we can override that by providing our own tensor field on the command line. So long as our tensor field is well formed, -smooth will use it even though it may bear no relation to the image at hand. That could be an awful lot of fun.

Here's what's on tap:

  1. Graduated Blur: Apply a strong directional blur at the top of the image, leaving the bottom alone.

  2. Variations On A Theme: Generalizations on graduated blurs, plus some background.

  3. EigenValues and EigenVectors: Various theoretical bits about setting up home-brew tensor fields.

  4. Directional Blurring: Swirls and curls

  5. Tensors for the Tonsorially Challenged: Grow your hair back. At least in some Digital Dream World.

  6. Fake Depth of Field: Narrowing it in post production
  7. Eigen Thingys: What G'MIC uses for eyeballs when it looks for edges, and what it does when it finds them. You may care to skip this section on the first or second read, or maybe forever. It does not go directly into the subject of home brew diffusion tensor fields. But, if you want to cook with insight and possess a basic understanding of linear algebra then budget some time for this. It goes into the proper use of diffusion tensors which we proceed to use improperly. But that's OK. David said we could. Honest.

Nothing preceding Graduated Blur