ISharpen
Function
This is identical to the Sharpen function, except it uses a second
control image to control the amount of sharpening across the first image.
We use un-sharp masking for our sharpening filter. This process blurs
the image slightly, takes the difference between the blurred result and
the input image, and adds that back over the input image. High values
of x and yPixels (say, greater than 3% of the image size)
will return undesirable results. You can also use the sharpen filter in
the Convolve function,
but this may give you ringing.
For an example of this process, see IBlur.
Parameters
|
Type
|
Defaults
|
Function
|
controlImg |
image
|
|
The second image is the control image for
the sharpen. The brightness of this image controls how much sharpening
is applied. |
percent |
float
|
20 |
The amount of blend between the non-sharpened
image (0) and the sharpened image (100). |
x/yPixels |
float
|
3, xPixels |
The amount of blur as described in Pixels,
ie 200 will blur 200 pixels to either side of the current pixel. |
steps |
int
|
5 |
This is the amount of regions. The intensity
of the control image is divided up X amount of zones, with X being
equal to regions. |
stepBlend |
float
|
1 |
This controls the blending between the
amount of regions (see below). If you put this at 0, each step will
have a constant blur value. If this is 1, there is a continuous blend
between the different regions. |
controlChannel |
string
|
"a" |
The channel of the second image to use
to control the amount of sharpen. |
channels |
string
|
"rgba" |
The channels of the first image to sharpen. |
invert |
int
|
0 |
Inverts the controlChannel. |
Synopsis
image ISharpen(
image img,
image controlImg,
float percent,
float xPixels,
float yPixels,
int steps,
float stepBlend,
const char * controlChannel,
const char * channels,
int invert
);
Script
image ISharpen(
img,
controlImg,
percent,
xPixels,
yPixels,
steps,
stepBlend,
"controlChannel",
"channels",
invert
);
Command Line
shake -isharpen image percent xPixels yPixels
|