Motion blur in one direction only?

Hi all. Is there a filter, similar to blur_linear but only in one direction? I am attempted to create a motion blur in one direction only. Any help is appreciated!

Hello, and welcome to the forum!

It seems like you are describing the wind effect. Is this what you are looking for? There is also the cli version.

Actually, there are no real “Motion Blur” filter right now, but that’s an excellent idea.
I have some ideas about doing one.

@David_Tschumperle I was also wondering if there is a “smear” filter, or if there could be one?

Hi, thanks for the welcome and the suggestion. I gave the wind effect you recommended a try with some quick tests in cli which im using. It’s close to what I had in mind, but not exactly what I’m aiming for.

I actually found a page the describes more or less what I’m looking for:

In my mind, I originally thought of a unidirectional motion blur, but actually a graduated blur seems to be a better match for what I had in mind! Specifically, the blur or smear begins at the edge of the image and slowly progresses downward, sort of like of sweeping a paintbrush from the top edge downwards. This is the exact effect I’m looking for.

This seems a bit more complex for me. Nonetheless, I will attempt to copy the commands as a starting point, with the hope of adjusting the parameters as needed to achieve the desired outcome.

1 Like

I see. I know that page, it’s one of many i have yet to “analyse”.

You could also check this page : Variations on a theme (Graduated blur)
Variation 2 may interest you.

The smear i had in mind was also like a brush stroke, but along a line, with xy start, xy end, fade, and a given width. Like the smear / smudge tool in a paint app. Probably too much for me to try :slight_smile:

Anyway, do not hesitate to ask questions in this forum, people here are really helpful.

Thank you! I will go through all that and see what works.

Maybe Blur by Color?

This (and @prawnsushi 's suggestion) are in the ‘Old Tutorial’ space, meaning the examples have not been updated to modern G’MIC, say, 3.0 and forward (on the TADOO list to fix…). The implementation for Blur by Color is in Testing → Gmic Tutorials → Blur By Color. The color mask image should be the layer below the image you wish to blur, and be sure to choose Active and Below for Input Layers.

Hope this helps. Welcome to the Board!

Good to know! Thank you for this information.

See also a post today on the ImageMagick forum: Eliminating virtual pixels for initiation unidirectional motion blur · ImageMagick/ImageMagick · Discussion #7197 · GitHub

2 Likes

I second this thread. It has been request before by myself and other people. A more substantive response than yesteryear would be great. :+1:

1 Like

Maybe, if you can beta-test, that would be great :slight_smile:

1 Like


Looks like it’s working fine, though i managed to lose one point under the bottom edge :man_shrugging: (can’t get it back unless i reset the points)

1 Like

I’ve done an update which make points outside the preview widget still dragable.
I’ve also added a Subsampling parameter.

3 Likes

Subsampling is cool :open_mouth:


Gotta learn how to do this GUI point stuff some day :slight_smile:

You know what would be fun? Having different strength settings per point :smiley:

1 Like

Nice!

Wow… I mean WOWW, and the controls that we have are pure awesomeness
Thank you @David_Tschumperle , a lot!

1 Like

Thanks a lot @PixLab , you cannot imagine how your message makes me happy, especially today (right when I need it).

1 Like

Churlish of me to wander in here, Sunday Morning After Breakfast, as some ill-bred boor, and direct attention to the actuality that, for all the charm of @David_Tschumperle filter (and his filters generally possess a great deal of charm, and the occasioned bits of piquant humor), it misses the point of the post, to wit: motion blur in one direction only — as in what’s behind the Road Runner when Wile E. Coyote is in hot pursuit on the — yes! — Acme Rocket-Powered Tennis Shoes, fractions of seconds before the venturi tubes crack. That kind of motion blur. The Road Runner’s beak is in sharp focus, but behind is a purplish blur and streaks and clouds of kicked-up dust.

Methinks @prawnsushi was nearer to the heart of the matter in Post #2 with the G’MIC command wind. See ≈ L. 31,719 of gmic_stdlib.gmic (commit b0d67cfb, March 28, or there abouts) for its implementation. It plays a step-and-repeat game with attenuation on every step. Alas, it embodies little intelligence about paths, stepping the detected edge image in its entirety, in just the selected direction — no variance. But — it wouldn’t do for the blur not to track The Road Runner, following the arc in the road away from the cliff — which Wile E. Coyote, possessing an excess of rocket-powered momentum, must inevitably fly over. Ah me. Have a nice trip. See you next fall.

So. Here’s a toy:

comettail.gmic
comettail : 
   -check isint(${1=300})" && "\ # fc => count of image stamps comprising tail.
          ${1}>0"          && "\ # Count must be positive. 
          isnum(${2=4})"   && "\ # blr => per-step blurring performed on the tail.
          ${2}>0"          && "\ # blurring amount must be positive.
          ${3=5}>0"        && "\ # daf => Degrade and Fade comet tail, (0,…,10], 
          ${3}<=10               # where small (0.1) daf hardly degrades (long tail)
                                 # yet where (9.99) trims the tail, mostly.
   -skip ${4=0}                  # non-image argument triggers internal palette generation.
   fc,blr=${1-2}
   daf:=0.1*$4

   # Color the comet tail
   -local[] {
      -check ${"is_image_arg $1"}
      -pass$1 0
      -to_rgba.
   -onfail
      -input (10,20,40,255^30,90,130,255^200,90,100,255^250,230,80,255^250,240,230,255)
      -permute. cyzx
      -resize. 255,1,1,4,5
   }
   -name. palette
   
   # Test path, in lieu of interactive curve.
   # A cardioid plotted in the unit square.
   gtutor_mkspectral $fc,0.5,0,1,0.5,0,1
   gtutor_specplot.
   -name. track

   foreach[^track,palette] {
        # Next image to draw on
        nm={n}
	name. canvas

        # Plotting track from parent context
        -pass[track] 0
	-name. localtrack

        # Palette from parent context
	-pass[palette] 0
	
        # comet and image mask
	-input 128,128,1,1
	-mkcomet. [palette],1.5
        -name. comet
	# Synthesize gmic image mask argument
        -input [comet],[comet],[comet],1,i(#$comet,x,y)/iM#$comet
	-name. cmask

        # Dissipate, Degrade and Attenuate
	ds:=exp(-0.001/(1-$daf))

        # Metrics to scale track: unit sqr. => canvas
	bbx:=0.8*min(w#$canvas,h#$canvas)
	mx:=(w#$canvas-$bbx)/2 # l2r margin
        my:=(h#$canvas-$bbx)/2 # t2b margin
        sx:=$bbx/2             # x axis scaling
        sy:=$bbx/2             # y axis scaling

        # Scale and transform plot points to canvas
        -fill[localtrack] ">
          begin(
                 xfrm=eye(3);
                 xfrm[0]=$sx;
                 xfrm[2]=$mx+$sx;
                 xfrm[4]=-$sy;
                 xfrm[5]=$my+$sy;
               );
          (xfrm*[I(x,y),1])[0,2]"

        # Move-and-stamp comet tail, while
	# fading-and-blurring what's already
	# there.
        -repeat $fc
	   # Degrade current path
           -blur[canvas] {$blr+0.1*$ds}
           -mul[canvas] $ds
           # Move comet head and plot it in a new spot.
           px,py:=I[#$localtrack,$>]
	   -image[canvas] [comet],{$px-(w#$comet/2)},{$py-(h#$comet/2)},0,0,1,[cmask]
	-done
	-keep[canvas]
	-name[canvas] $nm
   }
   remove[track,palette]

# Make the comet head. Perturb
# channels for a rainbow effect
mkcomet: -skip ${2=0.95}
   -check ${"is_image_arg $1"}
   -pass$1 0
   -name. palette
   sep=$2
   -foreach[^palette] {
      -name. patch
      -pass[palette]
      -name. palette
      -gaussian[patch] 9%,10%,90
      -mul[patch] 255
      -map[patch] [palette],2
      -remove[palette]
      -split[patch] c
      -foreach { -shift. {cexp([$sep,pi*u(1)/2])},0,0,2 }
      -append c
      -normalize. 0,255
   }
   -remove[palette]
$ gmic -run ' -m comettail.gmic 1024,1024,1,3 =>. plotspace comettail[plotspace] 300,5,2' o[plotspace] /dev/shm/comettail.jpg,80


comettail.jpg

which takes wind as a point of departure and adds to it path tracking.

The heart of the matter, insofar as this step-and-repeat approach is concerned, may be found from ≈L. 72-82, following the comment # Move-and-stamp comet tail… Most everything else about the script is the routine commonality of setting the table. image furnishes the stamping mechanism; plot points are taken from a gtutor_mkspectral-cum-gtutor_specplot generated cyclic path. Such guides the sprite which image stamps around. blur and mul operate in concert with every stamp, degrading the image. Of course, early-on stamps suffer more degradation than later ones, giving rise to the graduated comet tail effect. The three arguments to comettail set the stamp count (300), blur amount (5) and a fade factor (2), which degrades the path at an ever faster clip as it approaches 10.

Hope this furthers the discussion you were looking for. In any case, it has simply been ages! since I’ve posted anything to torment your poor, long-suffering laptop. Cruel, south-of-the-border, Americans…

3 Likes