DIP and Pattern Recognition Important Questions with Answers: Chapter 3 Part 2 Image Enhancement, Filtering and Morphology
Very Short Answers (1-2 marks)
1. What is a median filter?
- A neighborhood smoothing filter that replaces each pixel with the median intensity of its neighborhood - removes salt-and-pepper noise while preserving edges.
2. What is template matching?
- Finding an object by sliding a small reference image (template) over the image and measuring similarity at each position - the best-scoring locations are detections.
3. Define gray-level mapping.
- A point operation that assigns each input intensity a new intensity by a fixed function s = T(r), such as inversion, thresholding or contrast stretching.
4. What is an image histogram?
- The count of pixels at each intensity level - a global summary of brightness and contrast used for enhancement and thresholding.
5. Define histogram equalization.
- Remapping intensities so the output histogram is roughly uniform, using the cumulative distribution as the mapping - spreads crowded intensities and boosts global contrast.
6. What is thresholding?
- Converting a grayscale image to segments by comparing each pixel with a threshold: pixels above it become object, below become background - the simplest segmentation.
7. Define a mean filter.
- A smoothing filter that replaces each pixel with the average of its neighborhood - reduces random noise but blurs edges.
8. Define correlation in image processing.
- Sliding a filter mask over the image and summing pointwise products at each position - the basic operation behind filtering and template matching.
Short Answers (5-7 marks)
1. Explain the difference between histogram stretching and histogram equalization.
| Point | Histogram stretching | Histogram equalization |
|---|---|---|
| Idea | Linear map spreading the existing range over the full scale | Nonlinear map (via the CDF) forcing a uniform histogram |
| Preserves | Relative shape of the histogram | Order of intensities only |
| Best when | Image uses a narrow intensity band | Intensities are clustered unevenly |
| Risk | Does little if the range is already wide | Can over-amplify noise and look unnatural |
2. Why is the median filter preferred over the mean filter for salt-and-pepper noise?
- Salt-and-pepper noise creates extreme outliers (0 or 255). The mean absorbs outliers: one white pixel in a 3x3 window lifts the average by ~28 levels, smearing the spike.
- The median ignores magnitudes and takes the middle rank: an isolated spike never becomes the median, so it disappears completely.
- The median also preserves step edges - a median across an edge stays on one side, while a mean smears the edge.
3. Explain the difference between dilation and erosion.
- Erosion: a pixel survives only where the structuring element fits entirely inside the object - shrinks boundaries, removes thin protrusions and small noise blobs.
- Dilation: a pixel is added wherever the structuring element touches the object - grows boundaries, fills small holes and gaps.
- They are duals: eroding the object equals dilating the background with the reflected element.
4. Compare opening and closing morphological operations.
| Point | Opening (erode, then dilate) | Closing (dilate, then erode) |
|---|---|---|
| Removes | Small bright specks, thin protrusions | Small dark holes, thin gaps |
| Boundary effect | Smooths outward bumps | Smooths inward notches |
| Size | Slightly shrinks objects | Slightly grows then restores |
| Use | Denoise foreground | Repair broken regions |
5. Describe gray-level mapping and non-linear gray-level mapping techniques.
- Linear maps: identity, negative (s = L-1-r), and contrast stretching (piecewise slopes expand mid-range).
- Non-linear maps: logarithmic s = c log(1+r) expands dark levels (reveal detail in shadows); power-law (gamma) s = cr^γ with γ<1 brightens, γ>1 darkens - the standard correction for displays and cameras.
- All are point operations: each output pixel depends only on its own input value, so they are fast and parallel.
6. Explain histogram stretching, histogram equalization and histogram matching.
- Stretching: linear rescale from the occupied range [rmin, rmax] to [0, L-1] - simple contrast fix.
- Equalization: map by the cumulative histogram, s = (L-1)CDF(r) - flattens the histogram for maximum global contrast.
- Matching (specification): map the image so its histogram follows a target shape - equalize the image, equalize the target, then invert - used to standardize brightness across cameras or scans.
7. Discuss neighborhood processing techniques such as the mean filter, median filter and correlation.
- Neighborhood processing computes each output pixel from a window around the input pixel, via correlation/convolution with a mask.
- Mean (box) filter: uniform weights - smooths Gaussian-like noise, blurs edges.
- Weighted mean (Gaussian): center-heavy weights - gentler blur.
- Median filter: order statistic, not a weighted sum - kills impulse noise, keeps edges.
- Correlation is the sliding dot product that implements all linear masks; convolution is the same with the mask flipped.
8. Explain edge detection and image sharpening techniques.
- First derivative (gradient): Sobel and Prewitt masks estimate Gx, Gy; magnitude √(Gx²+Gy²) highlights edges - thick but robust.
- Second derivative: the Laplacian responds strongly at intensity transitions - fine detail but noise-sensitive; zero crossings mark edge centers.
- Sharpening: add a scaled Laplacian back to the image, or unsharp masking (original + k x (original - blurred)) - boosts high frequencies so edges look crisper.
9. Compare point processing and neighborhood processing techniques.
| Point | Point processing | Neighborhood processing |
|---|---|---|
| Output depends on | The pixel's own value | The pixel and its neighbors |
| Examples | Thresholding, gamma, histogram equalization mapping | Mean/median filtering, edge detection |
| Cost | O(1) per pixel, lookup-table fast | O(k²) per pixel for a k x k window |
| Can it remove noise? | No spatial noise removal | Yes - smoothing uses spatial redundancy |
10. Analyze the effect of different structuring elements on morphological operations.
- Size: larger elements remove larger features - a 5x5 erosion deletes thicker protrusions than 3x3.
- Shape: a disk treats all directions equally; a horizontal line preserves horizontal structures and erases vertical ones - shape selects what survives.
- Origin and symmetry: asymmetric elements shift the result; the reflection in the erosion/dilation duality matters for exact boundaries.
- Choosing the element is choosing the filter: matching it to the noise shape (salt specks vs line breaks) is the design step in any morphological pipeline.
11. Compare thresholding-based segmentation with edge-based segmentation.
| Point | Thresholding | Edge-based |
|---|---|---|
| Principle | Group pixels by intensity value | Find boundaries by intensity change |
| Output | Closed filled regions | Boundary curves (may be broken) |
| Needs | Bimodal histogram, even lighting | Strong local contrast |
| Weakness | Fails under gradients/overlap | Gaps need linking; noise creates false edges |
12. Analyze the advantages and limitations of template matching for object detection.
- Advantages: simple, no training, works with a single example; exact for fixed pose, scale and lighting; interpretable score maps.
- Limitations: breaks under scale and rotation change (needs one template per variant - expensive); sensitive to lighting and occlusion; O(image x template) cost per template; plain correlation favors bright regions (normalized cross-correlation fixes this).
- Net: fine for controlled settings (industrial inspection), replaced by learned detectors and local-feature matching (Chapter 4) in the wild.
13. Apply histogram equalization to enhance the contrast of a given low-contrast image.
Recipe: build the histogram, compute its cumulative distribution, map each intensity s = round((L-1) x CDF(r)), rebuild the image. Example: an 8-level image where 70% of pixels sit at levels 2-3 maps level 2 to about 3 and level 3 to about 6 - the crowded band spreads across the scale and the washed-out image gains visible contrast. Caution: equalization can make flat regions noisy; adaptive (CLAHE) variants equalize locally for photos.
14. Apply morphological dilation and erosion operations on a given binary image.
Recipe with a 3x3 square element: erosion keeps a foreground pixel only if all 9 positions under the element are foreground - every boundary pixel loses one layer, one-pixel-wide lines vanish. Dilation marks a pixel foreground if any position under the element touches foreground - boundaries gain one layer, one-pixel holes fill. Sequence for cleanup: open (erode then dilate) to remove specks, then close to seal gaps - the object returns to size but smooth.
15. Design an image processing pipeline for detecting object boundaries in a noisy image.
- Denoise: median filter to kill impulse noise while keeping edges.
- Optional contrast fix: histogram equalization or stretching.
- Gradient computation: Sobel magnitude.
- Threshold the gradient to get an edge map.
- Morphological closing to bridge small edge gaps; thinning or boundary extraction to one-pixel curves.
- Optionally Hough transform (Chapter 4) to fit line/circle models to the boundaries.
Long Answers (10 marks)
1. Discuss image point processing techniques including gray-level mapping, histogram equalization and thresholding in detail.
Frame point processing as s = T(r). Cover: (1) basic gray-level maps - negative, log, gamma, contrast stretching - with the graph of each T and its visual effect; (2) histogram processing - histogram definition, equalization via the CDF mapping with a small worked table, matching to a target histogram, and adaptive local variants; (3) thresholding - single and multiple thresholds, Otsu's between-class-variance idea for automatic threshold selection, and limitations under illumination gradients. Close with when point operations suffice (global tonal correction) versus when neighborhood methods must take over (noise, edges).
2. Explain neighborhood processing techniques such as mean filter, median filter, correlation and template matching with suitable examples.
Define correlation as the sliding dot product of mask and window (convolution = flipped mask). Linear smoothing: box mean and Gaussian-weighted mean - noise reduction proportional to window area, edge blur as the price. Order statistics: median filter - impulse-noise removal with edge preservation, worked 3x3 example with a salt pixel. Template matching as correlation with an image patch instead of a mask: raw correlation bias toward bright areas, normalized cross-correlation as the fix, score-map peak as detection. Compare all four on a noisy edge example.
3. Discuss edge detection and image sharpening techniques used in digital image processing.
Model an edge as a rapid intensity transition; profile of step and ramp edges with first and second derivative responses. First-derivative operators: Roberts, Prewitt, Sobel - masks, gradient magnitude and direction, thresholding; noise trade-off and smoothing first (Sobel's built-in weighting). Second derivative: Laplacian masks, zero-crossing detection, Laplacian of Gaussian (smoothing plus edge response). Sharpening: Laplacian addition g = f + c∇²f, unsharp masking and high-boost filtering. Close with the detector-to-sharpening relationship: both amplify high frequencies, one to find edges, one to emphasize them.
4. Explain morphological operations - dilation, erosion, opening and closing - with suitable examples and set notation.
Binary image A, structuring element B. Dilation: A ⊕ B = {z | (B̂)z ∩ A ≠ ∅} - B's reflection placed at z hits A. Erosion: A ⊘ B = {z | (B)z ⊆ A} - B fits entirely inside A. Opening: A ∘ B = (A ⊘ B) ⊕ B - smooths contours, cuts isthmuses, removes specks. Closing: A • B = (A ⊕ B) ⊘ B - fuses narrow breaks, fills holes. Properties: duality, idempotence of opening/closing. Worked example: a binary shape with a noise speck and a thin gap - opening deletes the speck, closing seals the gap, boundary pixels unchanged otherwise.
5. Discuss boundary detection using morphological operations with a suitable example.
Boundary extraction: β(A) = A - (A ⊘ B) - the object minus its erosion leaves a one-pixel inner boundary; the dual (A ⊕ B) - A gives the outer boundary. Worked example: a filled square eroded by a 3x3 element loses its outer layer; subtracting leaves exactly the perimeter. Extensions: morphological gradient (dilation minus erosion) for thick edges, region filling by iterative dilation from a seed inside a boundary, and skeletonization by repeated erosion-opening. Compare with derivative edge detection: morphology works directly on binary/segmented shapes and always yields closed, connected boundaries.
6. Apply histogram processing and morphological operations together to design a complete image enhancement pipeline.
Pipeline for a low-contrast noisy scan: (1) median filter for impulse noise; (2) histogram equalization (or matching to a reference scan) for contrast; (3) gamma correction for display; (4) threshold to segment the structure of interest; (5) opening to remove residual specks, closing to repair the region; (6) boundary extraction for measurement. Justify the order: enhance before segmenting so the threshold sees a clean histogram; morphology after thresholding because it operates on binary shapes. Show expected histograms and masks at each stage.
7. Evaluate the effectiveness of different neighborhood filters for noise removal while preserving edges.
| Filter | Noise type handled | Edge preservation | Cost |
|---|---|---|---|
| Box mean | Uniform/Gaussian | Poor - blurs | Lowest (integral images) |
| Gaussian | Gaussian | Moderate | Low |
| Median | Salt-and-pepper | Good | Moderate (sorting) |
| Bilateral | Gaussian | Very good (range term) | High |
Evaluation method: add controlled noise to a known image, filter, measure PSNR/SSIM and edge sharpness before and after. Conclusion: no single winner - match the filter to the noise model; median for impulses, Gaussian for smooth noise, bilateral when both noise and edges matter.
8. Design a complete image preprocessing system for a real-world application such as medical image analysis, justifying each processing stage.
Example: X-ray analysis. (1) Acquisition normalization - histogram matching to a reference so images from different machines are comparable. (2) Noise removal - median or Gaussian filter sized to the noise grain. (3) Contrast enhancement - adaptive histogram equalization to reveal tissue detail without global over-amplification. (4) Segmentation - Otsu thresholding or region growing for the organ of interest. (5) Morphological cleanup - opening to remove small artifacts, closing to complete boundaries. (6) Feature extraction (Chapter 4) for the classifier (Chapters 2 and 5). For each stage state the failure it prevents and the parameter choice; close with validation against expert-marked images.
Comments
Post a Comment