Sunday, 15 February 2015

opencv - Algorithm to calculate the sharpness of an edge of an image -



opencv - Algorithm to calculate the sharpness of an edge of an image -

i need calculate sharpness/blurriness of border in image provided know coordinates border starts , can calculate rgb, hsv , cmyk color space. need possible equation.

since know how perform convolutions, have @ sobel operator.

you convolve image i twice, 1 time x kernel gx

[-1 0 +1] gx = [-2 0 +2] * [-1 0 +1]

and 1 time y kernel gy

[+1 +2 +1] gy = [ 0 0 0] * [-1 -2 -1]

then, each "pixel" in gx , gy,

g(x,y) = sqrt( gx(x,y)*gx(x,y) + gy(x,y)*gy(x,y) );

g gives gradient of image @ (x,y). magnitude of gradient gives measure of difference between adjacent pixels, or sharpness of edge. high magnitudes indicate sharp edge; magnitudes near 0 indicate no edge. you'll have play around values see ones give consider "sharp" border or "blurry" border since these terms not mathematically precise.

algorithm opencv image-processing imagemagick

No comments:

Post a Comment