filtering and enhancing images. major operations 1. matching an image neighborhood with a pattern or...
TRANSCRIPT
Major operationsMajor operations
1.1. Matching an image neighborhood Matching an image neighborhood with a pattern or maskwith a pattern or mask
2.2. Convolution (FIR filtering)Convolution (FIR filtering)
DefinitionsDefinitions
• Image enhancement = improve the Image enhancement = improve the detectability of important featuresdetectability of important features– Noise reductionNoise reduction– SmoothingSmoothing– Contrast enhancementContrast enhancement– Edge detectionEdge detection
DefinitionsDefinitions
• Image restoration = restore Image restoration = restore degraded imagedegraded image– Usually needs a model of degradationUsually needs a model of degradation
DefinitionsDefinitions
• Point operation = output pixel is Point operation = output pixel is determined only by the input pixeldetermined only by the input pixel– Out[x,y] = f(In[x,y])Out[x,y] = f(In[x,y])
• Contrast stretching = point operator that Contrast stretching = point operator that uses a piecewise smooth function of the uses a piecewise smooth function of the input gray value to enhance important input gray value to enhance important details of the image.details of the image.
• What are some examples that we have What are some examples that we have already seen?already seen?
Examples of point Examples of point operations:operations:• Threshold (demo)Threshold (demo)
• Invert (demo)Invert (demo)Out[x,y] = max – In[x,y]Out[x,y] = max – In[x,y]
• RGB RGB gray conversion gray conversion
• Gamma correctionGamma correction
Image smoothingImage smoothing
• Neighborhood operations = require Neighborhood operations = require more than a single image pointmore than a single image point
• Box filter = smoothing via equally Box filter = smoothing via equally weighted rectangular neighborhood weighted rectangular neighborhood (mask)(mask)
Image smoothingImage smoothing
• Median filter (or more generally, Median filter (or more generally, order statistic or filter)order statistic or filter)
RECALL FROM A RECALL FROM A PREVIOUS DISCUSSION PREVIOUS DISCUSSION (HOLE AND OBJECT (HOLE AND OBJECT COUNTING) . . .COUNTING) . . .
• Mask = set of pixel positions and Mask = set of pixel positions and corresponding values called weightscorresponding values called weights
• Mask origin = Mask origin = usuallyusually center center
• How?How?1.1. Calculate sum of productsCalculate sum of products
• BoundaryBoundary1.1. Replicate nearest pixel valueReplicate nearest pixel value
2.2. Use 0Use 0
2.2. Normalize or clamp (or an amplitude shift will Normalize or clamp (or an amplitude shift will occur)occur)
Applying masks to imagesApplying masks to images
Applying masks to imagesApplying masks to images
• Derived from convolution:Derived from convolution:
• Discrete form is cross correlation:Discrete form is cross correlation:
• where f is the input image, h is the mask/filter kernel, and g is the output image where f is the input image, h is the mask/filter kernel, and g is the output image resultresult
ydxdyxfyyxxhyxfyxh ,,,,yx,g
x y
yxfyyxxhyxfyxh ,,,,yx,g
ConvolutionConvolution
• See See http://en.wikipedia.org/wiki/Convolution for some nice animations. for some nice animations.
But what about borders?But what about borders?
• When we are missing data at the edges, When we are missing data at the edges, we typically do one of the following:we typically do one of the following:1.1. Copy to the missing value, the nearest Copy to the missing value, the nearest
neighboring value.neighboring value.
2.2. Use 0 for the missing value(s).Use 0 for the missing value(s).
(Regardless, it really doesn’t matter, but (Regardless, it really doesn’t matter, but we need to consistently do something.)we need to consistently do something.)
The importance of The importance of normalizing or clamping the normalizing or clamping the result.result.
• Otherwise, the values might get Otherwise, the values might get larger and larger (brighter and larger and larger (brighter and brighter) or go out of the original brighter) or go out of the original range, depending on the filter.range, depending on the filter.