HugoRune wrote:
I am using windows, but I may be able to figure out the equivalent windows commands from the script.
However, as far as I can make out, the script blurs or sharpens
near edges, while I want to blur the opposite region
I could apply a -negate to the edge mask, but I am not sure that would give the same results as Gimp.
in Gimp "blur is applied only if the difference between its value and the value of the surrounding pixels is less than a defined Delta value", and I am not sure how to translate that delta for imagemagick.
Yes, sorry, I have not looked at the script in a while and was not sure exactly what you wanted. Also it is true that converting from unix bash script to windows is not trivial. Take a look at my isonoise script. That may be closer to what you want.
Alternately, if I understand your selective gaussian goal, you might try the following:
What you seem to want is to get a mix of the image. Where a pixel is close to the average of its neighbors by some threshold, you want to do a gaussian blur (-blur) and where it is not close, you want to leave the image alone. That is not hard. You create a mask image to control whether to use the original image or the gaussian blurred image. You can create the mask image by doing a local average on the image by using a convolution with equal weights. Lets say for argument a 3x3 neighborhood average is equivalent to -convolve "1,1,1,1,1,1,1,1,1". Then you take the difference (-compose difference -composite) of the convolved image and the original and threshold it using -threshold.
Steps:
1. Create gaussian blurred image (select larger sigma for more blurring)
convert image -blur 0xsigma gaussianimage
2. Create local average image (use larger kernel, say 5x5 or 25 ones with commas between if desired for a larger neighborhood average)
convert image -convolve "1,1,1,1,1,1,1,1,1" averageimage
3. Create mask image (negate threshold so that small differences are white and large differences are black)
convert image averageimage -compose difference -composite -threshold XX% -negate maskimage
4 Combine image and gaussian using mask image
convert image gaussianimage maskimage -composite resultimage
You will have to play with the various parameters. I have not tested this and I may have some misconception about what you are trying to do, but let us know how that works.
Note an alternate and perhaps more flexible alternate to -convolve is to use -blur radiusx65000. That will give a similar equal weight average, but you have easier control over the distance (radius) of the average as you can use fractional values. Something like radius=1 or 1.5 should be nearly equivalent to a 3x3 convolve.