⚡ TechVani: AI, Technology, Apps, Coding & Digital World
TechVaniAI • Technology • Apps • Coding • Digital World
HomeAI & TechAppsCodingFree AI ToolsStudent TechSecurityAboutContactPrivacy
TECHVANI // LEARN. BUILD. TEST.

Learn the tech. Build the idea.

Clear study notes, tested lab files and practical guides for coding, AI and digital safety.

Explore Latest →
šŸ¤– AI & TechAI news, tools & guides šŸ“± Apps & ToolsUseful apps & websites šŸ’» CodingProgramming & web development šŸŽ“ Student TechStudy & career technology šŸ” Cyber SecuritySafety & awareness

Latest Posts

Circuit Notebook theme

Exam Notes

šŸ“š BTech CSE Exam Notes

Find Semester 1-8 subjects in one place. Choose a semester and open the notes you need. This is a general study guide, not an official syllabus.

Open Exam Notes →🧪 Open Lab Files →

Exam Numericals & Study Series

Practice CPU scheduling and explore OS and DBMS topics in separate, easy-to-follow parts. New topics will appear in the hub as they are published.

Open Numericals Hub →

Start here and stay in touch

New to TechVani? Start with our free AI tools guide for students. It covers which tools to try and what to check before relying on an answer.

For step-by-step videos, visit SiteSudhar on YouTube.

Join TechVani on WhatsApp

Get new AI tools and coding guides in your WhatsApp Updates tab.

Browse Topics

Popular Posts

TechVani

DIP and Pattern Recognition Important Questions with Answers: Chapter 3 Part 2 Image Enhancement, Filtering and Morphology

Digital Image Processing and Pattern Recognition exam prep. The questions come from the course question bank for the B.Tech DIP and Pattern Recognition syllabus, Unit 3 continued: image enhancement, filtering, edge detection and morphological operations. Together with Chapter 3 this covers the full Unit 3 question bank. General study notes, not an official university syllabus or paper prediction. Chapters: Chapter 1: Introduction - Chapter 2: Statistical PR - Chapter 3: Image Preliminaries - Chapter 4: Feature Extraction - Chapter 5: Nonparametric Techniques - All Units index

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.

PointHistogram stretchingHistogram equalization
IdeaLinear map spreading the existing range over the full scaleNonlinear map (via the CDF) forcing a uniform histogram
PreservesRelative shape of the histogramOrder of intensities only
Best whenImage uses a narrow intensity bandIntensities are clustered unevenly
RiskDoes little if the range is already wideCan 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.

PointOpening (erode, then dilate)Closing (dilate, then erode)
RemovesSmall bright specks, thin protrusionsSmall dark holes, thin gaps
Boundary effectSmooths outward bumpsSmooths inward notches
SizeSlightly shrinks objectsSlightly grows then restores
UseDenoise foregroundRepair 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.

PointPoint processingNeighborhood processing
Output depends onThe pixel's own valueThe pixel and its neighbors
ExamplesThresholding, gamma, histogram equalization mappingMean/median filtering, edge detection
CostO(1) per pixel, lookup-table fastO(k²) per pixel for a k x k window
Can it remove noise?No spatial noise removalYes - 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.

PointThresholdingEdge-based
PrincipleGroup pixels by intensity valueFind boundaries by intensity change
OutputClosed filled regionsBoundary curves (may be broken)
NeedsBimodal histogram, even lightingStrong local contrast
WeaknessFails under gradients/overlapGaps 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.

  1. Denoise: median filter to kill impulse noise while keeping edges.
  2. Optional contrast fix: histogram equalization or stretching.
  3. Gradient computation: Sobel magnitude.
  4. Threshold the gradient to get an edge map.
  5. Morphological closing to bridge small edge gaps; thinning or boundary extraction to one-pixel curves.
  6. 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.

FilterNoise type handledEdge preservationCost
Box meanUniform/GaussianPoor - blursLowest (integral images)
GaussianGaussianModerateLow
MedianSalt-and-pepperGoodModerate (sorting)
BilateralGaussianVery 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.

Back to top ↑

Comments