how to apply a softer sharpness in java.awt.image.BufferedImage -
i know how improve sharpness of image javascript code. result steep me. know how apply softer sharpness, sharpness factor instance?
in fact understand how sharpness operates through kernel
screencapture = new robot().createscreencapture(new rectangle(x1, y1, x2, y2)); float[] data = [-1, -1, -1, -1, 9, -1, -1, -1, -1]; kernel kernel = new kernel(3, 3, data); bufferedimageop convolve = new convolveop(kernel, convolveop.edge_no_op, null); bufferedimage = convolve.filter(screencapture, null); file file = new file(imagetemp); imageio.write(bufferedimage, "jpg", file);
this kernel seems softer, still :
float[] data= [0.0f, -1.0f, 0.0f, -1.0f, 5.0f, -1.0f, 0.0f, -1.0f, 0.0f ];
thank attention
a convolution kernel operates on pixel , surrounding pixels. given weight matrix (whose center pixel), calculates weighted sum of pixel , surrounding pixels.
with 3x3 matrix, 9 kernel values weights upper-left, upper, upper-right, left, center (the target pixel itself), right, lower-left, lower, lower-right pixels. original kernel suggests original pixel multiplied 9 , surrounding pixels substracted (-1), boosting pixel's sharpness.
what looking similar kernel, doesn't boost much.
the neutral kernel [0,0,0,0,1,0,0,0,0]
(target pixel = source pixel), can blend kernel neutral kernel factor like.
a half-sharp kernel [0.5,0.5,0.5,0.5,4.5,0.5,0.5,0.5,0.5]
(sum of halves of each kernel).
note kernel normalized: sum of weights 1: if different, image brighter (>1) or darker (<1).
Comments
Post a Comment