Variations On a Theme

We won't give you blow-by-blow walk throughs in the following as most of the steps are the same as what you have already seen in the previous receipe. Changes are in red. Also, we've fetched Marek ƚlusarczyk's lovely street scene into a local file called 'street.png,' just to cut the verbiage.

Variation One: Blur Horizontally.

Same graduated blur, but we want the direction to be left-to-right, not up-and-down.

gmic -input street.png \
100%,100%,1,1,'h-y' -normalize[-1] 0,1 \
'(0^1^0)' \
-resize[-1] [-3],[-3],[-1],[-1],1 \
-split[-1] c \
-append[-4,-3] c \
-append[-2,-1] c \
-eigen2tensor[-2,-1] \
-repeat 3 \
-smooth[-2] [-1],50 \
-done -rm[-1]

Here‘s the Big Change: we made Cosine constant one and Sine constant zero, instead of the other way around. Recall that the sine of 90° is one, and its cosine is zero. 90° points from top to bottom. Or if you want, bottom to top. With that we blurred in a vertical orientation. Here, cosine is one and sine is zero, which corresponds to 0° and we blurred in a horizontal direction.

Do you see an emerging pattern? You betcha.

Variation Two: Blur in Any Direction

Same graduated blur, but we want to choose any direction.

gmic angle=38.629 \
-input street.png \
100%,100%,1,1,'h-y' \
-normalize[-1] 0,1 \
'(0^{cos(pi*$angle/180)}^{sin(pi*$angle/180)})' \
-resize[-1] [-3],[-3],[-1],[-1],1 \
-split[-1] c \
-append[-4,-3] c \
-append[-2,-1] c \
-eigen2tensor[-2,-1] \
-repeat 3 \
-smooth[-2] [-1],50 \
-done \
-rm[-1]
G'MIC lets us declare variables (angle=38.629) and reference the values later: $angle. The '$' signet tells G'MIC to look up the value of 'angle' and substitute the expression with its value. That's exactly what we did later in the expression pi*$angle/180. That expression converts degrees into radians, as there happens to be one pi’s worth of radians for every one hundred eighty degrees and radian measure is what G'MIC expects.

In the Greater Scheme Of Things, we're now setting Cosine and Sine to the angle by which we want to blur. Play with this yourself. Go put bunches of different angles in there.

Variation Three: Blur From Bottom To Top

We want to do everything we've learned up to now, but vary the blur in the opposite direction.

gmic angle=62.754 \
street.png \
100%,100%,1,1,'y' \
-normalize[-1] 0,1 \
'(0^{cos(pi*$angle/180)}^{sin(pi*$angle/180)})' \
-resize[-1] [-3],[-3],[-1],[-1],1 \
-split[-1] c \
-append[-4,-3] c \
-append[-2,-1] c \
-eigen2tensor[-2,-1] \
-repeat 3 \
-smooth[-2] [-1],50 \
-done \
-rm[-1]
No big deal blurring backwards. We changed the angle just for variation, giving you an example of how it's done, and we changed the ramp formula from'h-y'to 'y' so that the ramp runs from zero to one instead of the other way around. In case you've missed it, you should spend some time with our Ramp Recipes. Every gray scale ramp you have There can be used Here. You can make a bazillion ramps and never repeat yourself. Now think of all the different ways you can make a ramp: Every single way can make a blur! Open road off to far horizons;
we've hardly even taken the first steps. And yet there's more.

Variation Four: Blur With Any Ramp Orientation

Really. We don't have to go straight up and down all the time, do we?

gmic ang1=7.438 ang2=17.513 \
street.png \
100%,100%,1,1,'x*cos(pi*$ang1/180)+y*sin(pi*$ang1/180)' \
-normalize[-1] 0,1 \
'(0^{cos(pi*$ang2/180)}^{sin(pi*$ang2/180)})' \
-resize[-1] [-3],[-3],[-1],[-1],1 \
-split[-1] c \
-append[-4,-3] c \
-append[-2,-1] c \
-eigen2tensor[-2,-1] \
-repeat 3 \
-smooth[-2] [-1],50 \
-done \
-rm[-1]
The Big Thing here is the introduction of another variable and a formula which lets us run a ramp at any angle, which is something you have may have noticed if you went through the Ramp Recipes. So rather than run a ramp from top to bottom, or left to right, we run it at an angle of 7.48°, which is almost a horizontal ramp at a slight tilt. We introduced another angle variable just so that we could set the blur direction independently of the ramp direction.

Variation Five: Introducing EigenTwo

You may have noticed that we haven't done anything with the EigenTwo image yet. It has been zero all the while. So what happens when we give that knob a twirl?

gmic street.png \
100%,100%,1,1,'h-y' \
100%,100%,1,1,'y' \

-normalize[-2,-1] 0,1 \
'(0^1)' \
-resize[-1] [-4],[-4],[-1],[-1],1 \
-split[-1] c \
-append[-4,-3] c \
-append[-2,-1] c \
-eigen2tensor[-2,-1] \
-repeat 3 \
-smooth[-2] [-1],50 \
-done \
-rm[-1]

Wuff.

OK, a minor bit. We changed the image reference to -4 because we separated out the EigenTwo image from the one-pixel proto-image, making our image list longer by one. We then set up EigenTwo as a ramp running from zero to one, with EigenOne running from one to zero. We also put the business of running things at angles to one side to make the effect straightforward.

But what exactly is the effect?

It seems that we are ramping from a horizontal blur on the bottom to a vertical blur on the top, with a kind of neutral blurring in the middle.

Well, it is time to put the G'MIC toy to one side because we now have some Explaining to do.

See you on the next page.

Graduated Blurs Eigenvalues and Eigenvectors

<