optional · CSS study notes
10. Digital Image Processing
FPSC CSS Computer Science past papers (2016–2026) — 41 questions: 8 MCQs, 33 subjective parts. Newest first.
Part A — Subjective Questions
2025 · Paper-II · Q7(a) (6 marks)
Question
In the context of compression, differentiate between coding, spatial and temporal redundancies.
Solution
Image/video compression exploits three main types of redundancy:
-
Coding redundancy: occurs when the codes (bit patterns) used to represent pixel gray levels are not chosen optimally — e.g., using a fixed-length code for all gray levels when some levels occur far more frequently than others. Variable-length coding (like Huffman coding), which assigns shorter codes to more probable gray levels, removes this redundancy.
-
Spatial (interpixel) redundancy: neighbouring pixels within a single image are typically highly correlated — most images contain regions of similar or slowly-varying intensity, so the value of a pixel can often be reasonably predicted from its neighbours. Techniques such as run-length encoding, predictive coding (DPCM), and transform coding (e.g., DCT used in JPEG) exploit this correlation between adjacent pixels within the same frame.
-
Temporal redundancy: applies specifically to video/image sequences — consecutive frames are usually very similar to each other since most of the scene does not change drastically between frames. Video compression standards (e.g., MPEG, H.264) exploit this by encoding only the differences between frames (motion estimation/compensation) rather than storing every frame from scratch, achieving very high compression ratios for video compared to compressing each frame independently.
2025 · Paper-II · Q7(b) (6 marks)
Question
What is translation and scaling? Find the number of bits required to store a 256x256 image with 32 gray levels.
Solution
Translation is a geometric image-processing operation that shifts every pixel of an image by a fixed displacement (Δx, Δy) in the x and y directions, moving the image's content to a new position without changing its size, shape or orientation: (x', y') = (x + Δx, y + Δy).
Scaling is a geometric operation that resizes an image by multiplying pixel coordinates by scale factors (Sx, Sy) along each axis: (x', y') = (x·Sx, y·Sy) — values greater than 1 enlarge the image (zoom in, requiring interpolation to fill new pixel positions) and values less than 1 shrink it (zoom out, requiring resampling/decimation).
Bits required for a 256x256 image with 32 gray levels: Bits per pixel needed to represent 32 distinct gray levels = log2(32) = 5 bits. Total pixels = 256 x 256 = 65,536. Total bits required = 65,536 x 5 = 327,680 bits = 40,960 bytes = 40 KB (327,680 / 8 = 40,960 bytes).
2025 · Paper-II · Q7(c) (8 marks)
Question
What is Histogram equalization? Explain the process and discuss its uses.
Solution
Histogram equalization is a point-processing technique that automatically enhances image contrast by transforming the gray levels of an image so that the resulting histogram is spread out as uniformly as possible over the full available range of intensities, instead of being concentrated in a narrow band (as happens in low-contrast, under/over-exposed images).
Process:
- Compute the histogram h(rk) of the input image — the frequency (or normalized probability p(rk) = nk/n) of each gray level rk, k = 0,...,L-1.
- Compute the cumulative distribution function (CDF): CDF(rk) = Σ p(rj) for j = 0 to k.
- Map each original gray level rk to a new gray level sk using the transformation: sk = (L-1) x CDF(rk), rounded to the nearest integer gray level, where L is the total number of gray levels (e.g., 256).
- Replace every pixel's old gray value rk with its new mapped value sk to produce the equalized image.
This transformation compresses gray levels that occur very frequently into a smaller output range less aggressively and stretches the ranges around the steepest parts of the CDF, which effectively spreads out the most common intensities, increasing overall contrast.
Uses: enhancing low-contrast X-ray, satellite, and photographic images to reveal detail otherwise hidden in a narrow intensity range; as a pre-processing step before edge detection, feature extraction or object recognition where higher contrast improves algorithm accuracy; and in general-purpose photo enhancement software as an automatic 'auto-contrast' tool.
2024 · Paper-II · Q7(a) (7 marks)
Question
Explain the algorithms used for point detection, line detection, edge detection, and boundary detection in digital images. Discuss the strengths and limitations of these techniques.
Solution
Point detection: uses a Laplacian-based mask (a high-pass spatial filter) convolved with the image; a point is flagged if the absolute response at that location exceeds a chosen threshold T. Strength: simple, effective for isolated bright/dark points; Limitation: highly sensitive to noise, since noise itself creates strong point-like responses.
Line detection: uses directional masks (specific 3x3 kernels tuned to detect horizontal, vertical, +45-degree, and -45-degree lines); the image is convolved with each mask and the response indicates the presence/orientation of a line. Strength: can identify line orientation; Limitation: only detects thin, straight lines matching the mask's exact orientation and width.
Edge detection: gradient-based operators (Sobel, Prewitt - compute horizontal/vertical gradients Gx, Gy and their magnitude) detect abrupt intensity changes; the Canny edge detector improves on this with a multi-stage pipeline (Gaussian smoothing, gradient computation, non-maximum suppression, and hysteresis thresholding). Strength: Sobel/Prewitt are fast and simple; Canny gives thin, well-localized, noise-robust edges. Limitation: Sobel/Prewitt are noise-sensitive and produce thick edges; Canny is computationally heavier and requires careful threshold tuning.
Boundary detection: connects/links detected edge points into continuous object boundaries, often using the Hough transform (mapping edge points into a parameter space to detect lines/curves robustly even with gaps) or active contour (snake) models. Strength: Hough transform is robust to noise and small gaps in the edge map; Limitation: computationally expensive, especially for complex shapes requiring high-dimensional parameter spaces.
2024 · Paper-II · Q7(b) (7 marks)
Question
Provide detailed explanations and applications of morphological operators like erosion, dilation, opening, closing, skeletonization, and thinning in image processing.
Solution
Erosion: shrinks/thins the foreground regions of a binary image; a foreground pixel is kept only if the structuring element fits entirely within the foreground at that position (a "min" operation). Application: removing small noise specks, separating weakly-connected objects.
Dilation: grows/thickens foreground regions; a pixel becomes foreground if the structuring element overlaps the foreground at all at that position (a "max" operation). Application: filling small holes/gaps, connecting broken object parts.
Opening (erosion followed by dilation): removes small protrusions and isolated noise points while largely preserving the size and shape of larger objects. Application: smoothing object contours, removing small unwanted objects.
Closing (dilation followed by erosion): fills small holes and gaps within objects and smooths contours from the inside, while preserving overall object size. Application: closing small breaks in object boundaries, joining nearby objects.
Skeletonization: reduces objects to a thin, one-pixel-wide representation that preserves the object's topology/connectivity and general shape (its "skeleton"). Application: shape analysis, representing the structure of objects like handwritten characters or blood vessels.
Thinning: an iterative process that strips away outer boundary pixels layer by layer while preserving connectivity, closely related to skeletonization. Application: used in OCR (character recognition) and fingerprint ridge-pattern analysis, where a thin, simplified representation of strokes/ridges is needed for feature extraction.
2024 · Paper-II · Q7(c) (6 marks)
Question
Compare and contrast various image sensing and acquisition techniques. Discuss the advantages and limitations of different methods such as CCD and CMOS.
Solution
Image acquisition techniques vary by sensor arrangement: a single sensor (one photodiode with a filter) requires mechanical scanning motion to build a 2D image (used in microdensitometers); a sensor strip (linear array of sensors) captures one dimension directly and uses relative motion for the other (used in flatbed scanners); a sensor array (2D grid of sensors) captures an entire 2D image in a single exposure without mechanical scanning (used in digital cameras/camcorders).
CCD (Charge-Coupled Device): sensor elements transfer accumulated charge, pixel by pixel, to a central output for conversion. Advantages: very high image quality, low noise, high sensitivity and dynamic range, historically preferred for scientific/high-end imaging. Limitations: higher power consumption, slower readout speed, more complex/expensive manufacturing.
CMOS (Complementary Metal-Oxide-Semiconductor) sensor: each pixel has its own charge-to-voltage conversion circuitry, allowing parallel/faster readout. Advantages: lower power consumption, lower cost (uses standard semiconductor manufacturing), faster readout, and allows integrating additional processing circuitry directly on the same chip. Limitations: historically had more noise and lower dynamic range than CCD, though modern CMOS designs have largely closed this gap and now dominate the market (used in essentially all smartphones and most consumer/professional cameras) due to their cost, speed, and power advantages.
2023 · Paper-II · Q7(a) (10 marks)
Question
A common measure of transmission for digital data is the baud rate, defined as the number of bits transmitted per second. Generally, transmission is accomplished in packets consisting of a start bit, a byte (8 bits) of information, and a stop bit. Using these facts, answer the following: How many minutes would it take to transmit a 1024x1024 image with 256 intensity levels using a 56k baud modem? What would the time be at 750K baud, a representative speed of a phone DSL (Digital Subscriber Line) connection?
Solution
256 intensity levels require 8 bits per pixel (since 2^8 = 256).
Total image pixels = 1024 x 1024 = 1,048,576 pixels = 1,048,576 bytes of information.
Each byte is transmitted as a 10-bit packet (1 start bit + 8 data bits + 1 stop bit), so: Total bits transmitted = 1,048,576 x 10 = 10,485,760 bits.
At 56K baud (56,000 bits/sec): Time = 10,485,760 / 56,000 = 187.25 seconds = 187.25 / 60 = 3.12 minutes (approximately).
At 750K baud (750,000 bits/sec): Time = 10,485,760 / 750,000 = 13.98 seconds = 13.98 / 60 = 0.233 minutes (approximately 14 seconds).
So transmitting the image takes about 3.12 minutes at 56K baud, but only about 0.23 minutes (14 seconds) at 750K baud - roughly a 13x speedup.
2023 · Paper-II · Q7(b) (5 marks)
Question
What effect would setting to zero the lower-order bit planes have on the histogram of an image in general?
Solution
The lower-order bit planes contribute only small, fine-detail variations in intensity (each lower bit represents a much smaller magnitude contribution, e.g., bit 0 contributes only +/-1 out of 255). Setting them to zero rounds every pixel's intensity down to the nearest multiple of 2^k (where k is the number of lower bits zeroed), which has a MINOR effect on the overall histogram: the general shape/envelope of the histogram is largely preserved (the main peaks/distribution of brightness remain recognizable), but the histogram becomes "combed" - only certain intensity levels (multiples of 2^k) remain populated, while the bins in between become empty, since many nearby original values now collapse onto the same reduced value. Visually, the image looks only slightly degraded (minor loss of fine texture/noise), since these bits carry little of the perceptually important information.
2023 · Paper-II · Q7(c) (5 marks)
Question
What would be the effect on the histogram if we set to zero the higher order bit planes instead?
Solution
The higher-order bit planes carry the large-magnitude, dominant intensity information of the image (e.g., the most significant bit alone represents a contribution of 128 out of 255). Setting them to zero has a DRASTIC effect: every pixel's intensity is reduced to a small value (effectively pixel value modulo 2^(8-k), where k higher bits are zeroed), so the entire histogram COLLAPSES into a narrow band near the low end of the intensity scale. The original histogram's main peaks, which represented the image's actual brightness/contrast distribution, disappear entirely; the image loses almost all of its recognizable structure and appears mostly dark/near black, since the fine-detail lower bits alone cannot reconstruct the overall brightness pattern. This is a much more severe degradation than zeroing the lower-order bit planes.
2022 · Paper-II · Q6(a) (8 marks)
Question
Find the reflection, B̂, of each of the following Structuring Elements (SE). The dot indicates the origin of the SE.
Solution
The reflection of a structuring element B about its origin, denoted B̂, is defined formally as B̂ = { -b : b in B }: every pixel of the SE that lies at offset (x,y) relative to the origin (the dot) is moved to offset (-x,-y). Geometrically, this is equivalent to rotating the entire shape of the SE by 180 degrees around its origin, while the origin (the dot) itself remains fixed in the same relative position within the flipped shape.
Practical procedure for each given SE: (1) keep the origin (dot) cell fixed; (2) for every other filled cell of the SE, find its position relative to the origin (e.g., "2 cells to the right, 1 cell up") and place a filled cell at the mirrored position ("2 cells to the left, 1 cell down"); (3) the resulting flipped pattern is B̂. For example, an SE that is skewed toward the upper-right of its origin becomes, after reflection, an SE skewed toward the lower-left of the same origin by the same amount; an SE that is symmetric about its origin (e.g., a plus-shape or a shape whose dot sits at its geometric center) is unchanged by reflection, i.e., B̂ = B. Applying this rule to each of the three given SEs, in turn, produces the 180-degree-rotated version of each shape about its marked origin.
2022 · Paper-II · Q6(b) (8 marks)
Question
The R, G, and B component images of an RGB image have the horizontal intensity profiles shown in the following diagram. Show your working to identify color that a person would see in the middle column of this image?
Solution
Read the value of each channel's profile at the middle column, x = N/2:
- Red profile: a straight line descending linearly from 1.0 at x=0 to 0 at x=N-1, so at the midpoint x=N/2, Red = 0.5.
- Green profile: a triangular (tent) shape rising from 0 at x=0 to a peak of 1.0 at x=N/2 and back down to 0 at x=N-1, so at the midpoint, Green = 1.0 (the peak).
- Blue profile: a straight line rising linearly from 0 at x=0 to 1.0 at x=N-1, so at the midpoint, Blue = 0.5.
So the RGB triple at the middle column is approximately (R,G,B) = (0.5, 1.0, 0.5). Since Green is at full intensity while Red and Blue are present at equal, half intensity, the perceived color is a light (pale/desaturated) green - green dominates the hue, while the equal R and B components add a whitening effect, making it lighter than pure, saturated green.
2022 · Paper-II · Q6(c) (4 marks)
Question
How Digital Image Processing and Computer Vision are related? Discuss.
Solution
Digital Image Processing (DIP) and Computer Vision (CV) are closely related but distinct fields. DIP focuses on image-to-image transformations - enhancement, restoration, filtering, compression, and segmentation - improving or preparing an image for further use, without necessarily understanding its content. Computer Vision focuses on image-to-understanding tasks - extracting semantic meaning, recognizing objects, interpreting scenes, and making decisions from visual data, often described as giving machines an equivalent of human visual perception.
In practice they overlap and complement each other: DIP techniques (noise removal, contrast enhancement, edge/boundary detection, morphological operations) are commonly used as low-level preprocessing steps that feed into higher-level CV algorithms (object detection, recognition, tracking). One can think of DIP as providing the "cleaned-up eye" data, while CV provides the "brain" that interprets it - CV frequently builds directly on top of DIP outputs.
2021 · Paper-II · Q7(a) (8 marks)
Question
Write code/pseudo code to locate all of the large boxes in the image below using morphological image processing.
Solution
1. Threshold the grayscale/noisy image to a binary image: pixel = 1 (white, box/foreground) if
intensity > T, else 0 (black background), separating boxes+noise from background.
2. Apply morphological OPENING (erosion followed by dilation) using a structuring element
larger than the salt-noise speckles but smaller than the boxes -- this erodes away and removes
the small isolated noise dots while leaving the solid box regions intact after the dilation
restores their original size.
3. Perform connected-component labeling (e.g. flood-fill / union-find over 4- or 8-connected
neighbours) on the cleaned binary image, assigning a unique label to each separate white blob.
4. For each labeled component, compute its bounding-box area (or total pixel count).
5. Filter: keep only components whose area exceeds a chosen threshold T_large, discarding
small blobs (leftover noise or small boxes).
6. Output the bounding box coordinates (or centroid) of every component that passed the
size filter -- these are the located 'large boxes'.
The opening step (step 2) is the key morphological operation: since the noise consists of tiny isolated speckles, a structuring element sized between the noise-speck size and the box size erodes away every noise pixel completely while the subsequent dilation restores the boxes to their original shape/size, cleanly separating true boxes from noise before the size-based filtering step.
2021 · Paper-II · Q7(b) (6 marks)
Question
Is there a need for more than 1 color model? Mention different colors models and there uses.
Solution
Yes — no single colour model is ideal for every purpose, since capture/display hardware, printing hardware, human visual perception, and broadcast/compression each have different requirements:
- RGB (additive): used by cameras, scanners, and display screens/monitors, matching how they physically emit/capture light.
- CMY / CMYK (subtractive): used in colour printing, where inks subtract colour from reflected light (K added for true black and ink economy).
- HSI / HSV (perceptual): separates intensity from hue/saturation, matching human colour perception; used in colour-based image segmentation and processing where lighting-independent colour comparison is needed.
- YIQ / YCbCr (luminance-chrominance): used in television broadcast and video/image compression (e.g. JPEG, MPEG), since separating luminance (brightness, which the eye is most sensitive to) from chrominance allows chrominance to be compressed more aggressively and keeps backward compatibility with black-and-white displays.
- CIE Lab: a device-independent, perceptually uniform model used in colour science/matching across different devices. Because hardware, perception, and transmission each impose different constraints, multiple specialised colour models coexist rather than one universal model serving all needs.
2021 · Paper-II · Q7(c) (6 marks)
Question
Explain CMY color model, its use and how is it different from CMYK?
Solution
The CMY (Cyan, Magenta, Yellow) colour model is a SUBTRACTIVE model: unlike RGB, which ADDS light to produce colour, CMY inks/pigments work by absorbing (subtracting) their complementary wavelengths from white light shining on/through them, and reflecting/transmitting the rest. Cyan absorbs Red, Magenta absorbs Green, and Yellow absorbs Blue. It is used in colour printing, where C = 1−R, M = 1−G, Y = 1−B (for normalised RGB values). Difference from CMYK: mixing full amounts of Cyan, Magenta, and Yellow together should theoretically produce black, but due to impurities in real inks it actually produces a muddy dark brown rather than a true black. CMYK adds a fourth channel, K (Key/blacK), specifically to produce sharp, true black text and dark tones directly using black ink instead of over-printing three coloured inks — this also reduces total ink usage/cost and wear, and gives cleaner, crisper results for large dark areas and printed text, which is why virtually all real-world colour printers use CMYK rather than plain CMY.
2020 · Paper-II · Q7(a) (6 marks)
Question
What is Histogram equalization? Explain the process and discuss its uses.
Solution
Histogram equalization is a contrast-enhancement technique that redistributes an image's pixel intensity values so the output histogram is spread as uniformly as possible across the full available range, improving the visibility of details in images that are too dark, too bright, or low-contrast. Process: (1) Compute the histogram of the input image — the count of pixels at each intensity level. (2) Compute the normalized cumulative distribution function (CDF) of the histogram. (3) Map each original intensity r to a new intensity s using the transformation s = T(r) = (L−1) × CDF(r), where L is the number of gray levels. (4) Apply this mapping to every pixel to produce the equalized output image. Uses: enhancing low-contrast medical images (X-rays, CT scans), satellite/aerial imagery, and any photograph with poor lighting, as a pre-processing step before further analysis such as edge detection or feature extraction, since enhanced contrast makes structures more distinguishable.
2020 · Paper-II · Q7(b) (8 marks)
Question
Explain types of color models. Also discuss the most common hardware oriented color models in detail.
Solution
Types of colour models: RGB (additive, hardware-oriented for capture/display), CMY/CMYK (subtractive, hardware-oriented for printing), HSI/HSV (perceptual, software/processing-oriented, matching human colour perception), and YIQ/YCbCr (broadcast/compression-oriented, separating luminance from chrominance). The two most common HARDWARE-oriented models:
- RGB: used by cameras, scanners, and display screens (monitors, TVs). Each pixel's colour is formed by additively combining Red, Green and Blue light intensities — R=G=B=max gives white, all zero gives black. It directly matches how display hardware emits light through three types of phosphors/sub-pixels.
- CMYK: used by colour printers. Cyan, Magenta and Yellow inks work subtractively — each absorbs (subtracts) its complementary colour of light from white paper/light reflecting off it. Because combining C+M+Y in practice yields a muddy dark brown rather than a true black (due to ink impurities), a separate Key/blacK (K) ink channel is added to produce sharp black text and dark tones economically, using less coloured ink.
2020 · Paper-II · Q7(c) (6 marks)
Question
What is translation and scaling? Find the number of bits required to store a 256x256 image with 32 gray levels.
Solution
Translation is a geometric transformation that shifts every pixel of an image by a fixed offset (tx, ty): a point (x,y) maps to (x+tx, y+ty), moving the image's content without altering its shape or size. Scaling is a geometric transformation that resizes the image by factors (sx, sy): a point (x,y) maps to (x·sx, y·sy), enlarging (scale factor > 1) or shrinking (scale factor < 1) the image. Calculation: the image has 256 × 256 = 65,536 pixels. To represent 32 distinct gray levels requires ceil(log₂32) = 5 bits per pixel (since 2⁵ = 32). Total storage required = 65,536 pixels × 5 bits/pixel = 327,680 bits = 40,960 bytes = 40 KB.
2019 · Paper-I · Q5(c) (5 marks)
Question
An image is a representation of some information. Discuss how does a computer represents an image internally? Name different algorithms used to extract features from images.
Solution
Internally, a digital image is represented as a matrix (2-D array) of picture elements (pixels). For a grayscale image, each cell holds a single intensity value, commonly an 8-bit integer in the range 0-255 (0 = black, 255 = white). A color image is usually represented by three such matrices, one each for the Red, Green and Blue channels (24-bit-per-pixel true color), or by other color models (HSI, YCbCr, CMYK). The complete image file also stores a header with metadata — width, height, color depth, and compression format — followed by the raw or compressed pixel data stored row by row (raster/bitmap format), or, for vector images, as mathematical descriptions of shapes. Feature-extraction algorithms commonly used on such image data include: SIFT (Scale-Invariant Feature Transform), SURF (Speeded-Up Robust Features), ORB (Oriented FAST and Rotated BRIEF), the Harris corner detector, the Canny edge detector, HOG (Histogram of Oriented Gradients), and Local Binary Patterns (LBP).
2019 · Paper-II · Q6(a) (8 marks)
Question
Analyze the following noise models in the context of digital image processing. (i) Gaussian Noise Model (ii) Uniform Noise Model
Solution
Gaussian Noise Model: the noise value z added to each pixel follows a Gaussian (normal) probability distribution with mean μ and variance σ², described by p(z) = (1/(σ√(2π))) · e^(−(z−μ)²/2σ²). It is bell-shaped and symmetric about the mean. It arises physically from electronic circuit noise and sensor thermal noise during image acquisition, and it is the most common noise model assumed in image-processing theory because of its mathematical tractability and closeness to real sensor noise. Uniform Noise Model: the noise value is equally likely to take any value within a fixed range [a,b], with PDF p(z) = 1/(b−a) for a ≤ z ≤ b and 0 otherwise — a flat, rectangular distribution. It is less common as a physical noise source in real cameras but is frequently used to generate/test noise in simulations and to model quantization error, since it has a simply-characterized flat histogram unlike the peaked histogram Gaussian noise produces.
2019 · Paper-II · Q6(b) (6 marks)
Question
Compare RGB and HSI color models in the context of digital image processing.
Solution
RGB (Red, Green, Blue) is an additive, hardware-oriented colour model matching how cameras and display devices physically capture/emit colour: any colour is a weighted combination of R, G and B intensities. Its three channels are highly correlated (changing scene illumination changes all three channels together), and brightness/intensity information is tangled together with colour (chromatic) information, making colour-based processing (like segmenting an object by its hue regardless of shading) awkward. HSI (Hue, Saturation, Intensity) separates the achromatic intensity (brightness) component from the two chromatic components (hue = dominant colour, saturation = colour purity), closely matching how humans perceive and describe colour ('a bright red' vs 'a dull red'). Because intensity is isolated, HSI is far more convenient for operations like colour-based segmentation, object recognition under varying illumination, and colour enhancement, whereas RGB remains the natural model for image capture/display hardware.
2019 · Paper-II · Q6(c) (6 marks)
Question
Describe step by step process of application of compression based technique for image segmentation.
Solution
Compression-based segmentation treats segmentation as an optimisation problem: find the partition of the image into regions that can be described (encoded) with the fewest total bits, following the Minimum Description Length (MDL) principle.
- Start with an initial partition of the image (e.g. every pixel or small block as its own region, or an over-segmentation).
- For each candidate region, compute the number of bits required to encode: (a) its boundary/shape, and (b) its interior content (e.g. via run-length coding, or fitting a simple model such as a constant or linear intensity and coding the residual).
- Compute the total description length = sum of boundary-coding cost + content-coding cost across all regions.
- Iteratively merge adjacent regions (or split heterogeneous ones) whenever doing so reduces the total description length — a homogeneous merged region compresses more efficiently than two separate descriptions.
- Repeat merging/splitting until no further merge or split reduces total coding cost; the resulting stable partition is taken as the final segmentation, since regions that compress well correspond to genuinely homogeneous, meaningful image regions.
2018 · Paper-II · Q6(A) (8 marks)
Question
Differentiate between image sampling and quantization. Discuss how these concepts relate to spatial and intensity resolutions.
Solution
Sampling is the process of digitizing the SPATIAL coordinates of a continuous image - converting a continuous 2D image function f(x,y) into a discrete grid of picture elements (pixels) by measuring the image's intensity only at a finite, regularly-spaced set of (x,y) locations. The number of samples taken determines the image's spatial resolution: a higher sampling rate (more pixels per unit area, i.e. more pixels overall for the same physical scene) yields finer spatial detail, while under-sampling causes loss of fine detail (and can cause aliasing).
Quantization is the process of digitizing the AMPLITUDE (intensity/brightness/color value) of the image at each sampled point - converting the theoretically continuous range of possible intensity values into a finite, discrete set of levels (e.g. 256 gray levels for an 8-bit image). The number of quantization levels determines the image's intensity (gray-level) resolution: more levels (higher bit-depth) allow smoother, more gradual tonal transitions, while too few levels cause visible banding/false contouring in the image.
Relation to resolution:
- Spatial resolution is governed by sampling - it is typically expressed as the image's dimensions (e.g. 1920x1080 pixels) or in terms of pixels-per-inch/DPI.
- Intensity resolution is governed by quantization - it is typically expressed as bit-depth (e.g. 8-bit = 256 levels, 16-bit = 65536 levels). Together, sampling and quantization convert a continuous analog image into the discrete digital image (a 2D array of finite-precision pixel values) that a computer can store and process; both must be sufficiently fine for the digital image to faithfully represent the original scene without visible artifacts.
2018 · Paper-II · Q6(B) (6 marks)
Question
In the context of image smoothing, discuss the differences between mean and median filters.
Solution
Mean Filter (Averaging filter): a linear spatial filter that replaces each pixel's value with the ARITHMETIC MEAN (average) of the intensity values of itself and its neighbors within a defined window (e.g. a 3x3 neighborhood). It is implemented via convolution with a kernel where all weights are equal (e.g. 1/9 for each of the 9 cells in a 3x3 kernel).
- Effect: effectively reduces random (Gaussian-type) noise and smooths the image, but it also blurs edges and fine details, since it averages across edge boundaries too, and it is particularly poor at removing impulse/salt-and-pepper noise (since a few extreme outlier values still pull the average significantly).
Median Filter: a non-linear spatial filter that replaces each pixel's value with the MEDIAN (the middle value when sorted) of the intensity values in its neighborhood window, rather than the average.
- Effect: it is excellent at removing impulse noise (salt-and-pepper noise) because a single extreme outlier value has little to no effect on the median (it just gets sorted to one end and ignored, unlike the mean which is skewed by it), and it tends to preserve edges better than the mean filter (since it picks an actual observed value from the neighborhood rather than blending values across a boundary), though it can still round off very fine, sharp details if the window is large.
Summary: mean filter is linear and good for general/Gaussian noise but blurs edges and struggles with outliers/impulse noise; median filter is non-linear, is much more robust against impulse/salt-and-pepper noise, and better preserves edges.
2018 · Paper-II · Q6(C) (6 marks)
Question
For the image 'X' shown in Figure 1 (a 7x8 binary grid), show the result of applying the given morphological operators. Assume zero padding for border pixels. i. Dilation of X by structuring element [1 1 1]. ii. Erosion of X by structuring element [1 1 1]^T. iii. Dilation of X by a 3x3 structuring element containing all ones. Image X (7 rows x 8 columns, row-major): Row0: 0 0 0 0 0 0 0 0 Row1: 0 1 1 0 0 1 1 0 Row2: 0 1 1 1 1 1 1 0 Row3: 0 0 0 0 0 0 0 0 Row4: 0 0 0 0 0 0 0 0 Row5: 0 0 1 1 1 1 0 0 Row6: 0 0 0 0 0 0 0 0
Solution
i. Dilation of X by horizontal SE [1 1 1] (each foreground pixel spreads to its left and right neighbor in the same row only; rows unaffected by each other): Row0: 0 0 0 0 0 0 0 0 Row1: 1 1 1 1 1 1 1 1 Row2: 1 1 1 1 1 1 1 1 Row3: 0 0 0 0 0 0 0 0 Row4: 0 0 0 0 0 0 0 0 Row5: 0 1 1 1 1 1 1 0 Row6: 0 0 0 0 0 0 0 0 (Row1's scattered 1s at columns 1,2,5,6 spread with a width-3 window to fill the entire row 0-7, since the gap at columns 3,4 is bridged by the spread from column 2 and column 5. Row2's solid block at columns1-6 also spreads to fill the entire row. Row5's block at columns 2-5 spreads to columns 1-6.)
ii. Erosion of X by vertical SE [1 1 1]^T (a pixel stays 1 only if it AND both its vertical neighbors, above and below, are all 1): Entire result is all-zero: Row0-Row6: all 0 (Reasoning: checking every column, no column has three consecutive rows that are all 1 - rows 1 and 2 are adjacent with overlapping 1-columns, but row 0 above row 1, and row 3 below row 2, are both entirely 0, so no pixel satisfies the 3-in-a-column-all-1 condition anywhere in the image.)
iii. Dilation of X by a full 3x3 all-ones structuring element (each foreground pixel spreads to all 8 neighbors plus itself): Row0: 1 1 1 1 1 1 1 1 Row1: 1 1 1 1 1 1 1 1 Row2: 1 1 1 1 1 1 1 1 Row3: 1 1 1 1 1 1 1 1 Row4: 0 1 1 1 1 1 1 0 Row5: 0 1 1 1 1 1 1 0 Row6: 0 1 1 1 1 1 1 0 (The dense blob spanning rows 1-2 has near-full column coverage, and a 3x3 dilation extends it one row up (row0) and one row down (row3), and since rows 1 and 2 each individually already span the full column-width 0-7 once expanded +-1 column, rows 0-3 all become completely filled. The separate row5 block at columns2-5 expands by 1 pixel in every direction, giving rows 4-6 the pattern columns1-6 filled, 0 and 7 empty.)
2018 · Paper-II · Q7(A) (8 marks)
Question
Perform histogram equalization on the 8-bit image shown in Figure 2 (5x5 grid: row1 all 5s, row2 all 10s, row3 all 30s, row4 all 100s, row5 all 100s).
Solution
Total pixels N = 25. Intensity levels present and their counts: 5 (count 5), 10 (count 5), 30 (count 5), 100 (count 10). Assume an 8-bit image, so L = 256 gray levels (0-255).
Histogram equalization transform: s_k = round( (L-1) * (cumulative count up to level k) / N )
Level 5: cumulative count = 5. s = round(255 * 5/25) = round(51.0) = 51. Level 10: cumulative count = 5+5 = 10. s = round(255 * 10/25) = round(102.0) = 102. Level 30: cumulative count = 10+5 = 15. s = round(255 * 15/25) = round(153.0) = 153. Level 100: cumulative count = 15+10 = 25. s = round(255 * 25/25) = round(255.0) = 255.
Mapping: 5 -> 51, 10 -> 102, 30 -> 153, 100 -> 255.
Equalized image: Row1 (was all 5): 51 51 51 51 51 Row2 (was all 10): 102 102 102 102 102 Row3 (was all 30): 153 153 153 153 153 Row4 (was all 100): 255 255 255 255 255 Row5 (was all 100): 255 255 255 255 255
The equalization has spread the four original clustered intensity levels (5,10,30,100) out across nearly the full 0-255 range, increasing the image's overall contrast.
2018 · Paper-II · Q7(B) (6 marks)
Question
For the 3x3 image shown in the following, apply the horizontal and vertical Sobel operators and compute the magnitude of gradient at the central pixel with intensity value 50. 5 5 5 5 50 5 5 5 5
Solution
Sobel horizontal kernel Gx = [[-1,0,1],[-2,0,2],[-1,0,1]], Sobel vertical kernel Gy = [[-1,-2,-1],[0,0,0],[1,2,1]].
Image neighborhood (3x3 around the center): 5 5 5 5 50 5 5 5 5
Gx = (-1)(5) + (0)(5) + (1)(5) + (-2)(5) + (0)(50) + (2)(5) + (-1)(5) + (0)(5) + (1)(5) = (-5+0+5) + (-10+0+10) + (-5+0+5) = 0 + 0 + 0 = 0
Gy = (-1)(5) + (-2)(5) + (-1)(5) + (0)(5) + (0)(50) + (0)(5) + (1)(5) + (2)(5) + (1)(5) = (-5-10-5) + 0 + (5+10+5) = -20 + 0 + 20 = 0
Gradient magnitude = sqrt(Gx^2 + Gy^2) = sqrt(0 + 0) = 0.
The gradient magnitude at the center is 0. This makes sense: both Sobel kernels assign a weight of 0 to the center pixel itself, so the center pixel's own value (50) never enters the calculation - only the surrounding ring of pixels matters, and since that ring is perfectly uniform (all value 5), there is no directional intensity change (no edge) detected around it, giving zero gradient despite the stark difference between the center and its neighbors.
2018 · Paper-II · Q7(C) (6 marks)
Question
In the context of compression, differentiate between coding, spatial and temporal redundancies.
Solution
Image/video compression works by removing different types of redundant information that do not add real visual/informational value:
Coding Redundancy: arises when the codes (bit patterns) used to represent pixel intensity values are not optimally assigned relative to the probability of each value's occurrence - e.g. using the same fixed number of bits for every gray level regardless of how frequently it occurs. This is removed via variable-length coding techniques (e.g. Huffman coding, arithmetic coding), which assign shorter codes to more frequently occurring values and longer codes to rare values, reducing the average number of bits needed overall (this follows directly from information theory/entropy).
Spatial Redundancy (Inter-pixel redundancy): arises because neighboring pixels within a single image are often highly correlated (similar/predictable) - e.g. a flat blue sky region has nearly identical pixel values across a wide area. This redundancy is exploited by predictive coding (e.g. predicting a pixel from its neighbors and encoding only the difference/residual) and transform coding (e.g. DCT-based compression like JPEG, which concentrates image energy into few significant coefficients).
Temporal Redundancy: arises specifically in VIDEO (a sequence of frames over time), because consecutive frames are often very similar to one another (most of the scene doesn't change from one frame to the next). This is exploited by inter-frame/motion-compensated coding, which encodes only the differences (motion vectors and residuals) between a frame and a reference frame, rather than encoding every frame independently from scratch, as used in video codecs like MPEG/H.264.
In short: coding redundancy relates to inefficient symbol representation, spatial redundancy relates to correlation within a single image, and temporal redundancy relates to correlation across frames over time in video.
2017 · Paper-II · Q7(a) (8 marks)
Question
Define image histogram. What is meant by histogram equalization? Explain their applications in image processing.
Solution
Image Histogram: a graphical representation showing the frequency (count) of occurrence of each possible intensity/gray-level value in an image - the x-axis represents intensity levels (e.g. 0-255 for an 8-bit image) and the y-axis represents the number of pixels having that intensity. It reveals the overall tonal/brightness distribution of an image (e.g. whether it is mostly dark, mostly bright, or has good contrast/spread).
Histogram Equalization: a contrast-enhancement technique that redistributes/stretches the intensity values of an image so that the resulting histogram is as close as possible to a uniform (flat) distribution across the full available intensity range, using a transformation function based on the cumulative distribution function (CDF) of the original histogram: s = round((L-1) * CDF(r)), where r is the original intensity, s the new intensity, and L the number of gray levels.
Applications:
- Contrast enhancement: histogram equalization is widely used to improve the visual contrast of poorly-lit or low-contrast images (e.g. medical X-rays, satellite images, photographs taken in poor lighting), making details in dark or washed-out regions more visible.
- Image analysis: histograms help in choosing thresholds for image segmentation (e.g. distinguishing an object from its background by finding a valley between two histogram peaks).
- Feature/quality assessment: histograms are used in exposure analysis (camera systems), and as inputs to other processing stages like histogram matching (specification) to make one image's tonal distribution match another's.
2017 · Paper-II · Q7(b) (6 marks)
Question
Find the storage in bytes required to store a 256 x 200 colored image using RGB color model with 24 bit color depth.
Solution
Total pixels = 256 x 200 = 51,200 pixels.
24-bit color depth means 24 bits = 3 bytes per pixel (8 bits each for Red, Green, and Blue channels).
Total storage = 51,200 pixels x 3 bytes/pixel = 153,600 bytes.
In kilobytes: 153,600 / 1024 = 150 KB (exactly).
So the image requires 153,600 bytes (150 KB) of storage.
2017 · Paper-II · Q7(c) (6 marks)
Question
Briefly explain Geometric Transformations.
Solution
Geometric transformations modify the spatial arrangement (positions) of pixels in an image, altering its shape, size, or orientation, while (typically) preserving the pixel intensity/color values themselves (only their location changes). They are fundamental to image registration, correction of geometric distortion, and computer graphics.
Common types:
- Translation: shifts every pixel by a fixed offset (dx, dy) - moves the image without changing its size/orientation.
- Rotation: rotates the image about a point (usually the origin or image center) by a specified angle theta, using the standard rotation matrix.
- Scaling: enlarges or shrinks the image by scale factors (sx, sy) along the x and y axes.
- Shearing: slants the image along the x or y axis by a shear factor, distorting rectangular shapes into parallelograms.
- Affine transformation: a general linear transformation (combination of translation, rotation, scaling, shearing) that preserves points, straight lines, and parallelism (parallel lines remain parallel), represented via a single matrix.
- Perspective (Projective) transformation: a more general transformation that does not necessarily preserve parallelism, used to correct perspective distortion (e.g. viewing a flat document at an angle).
Geometric transformations typically require interpolation (nearest-neighbor, bilinear, bicubic) to compute pixel values at the new, possibly non-integer, coordinate positions.
2016 · Paper-II · Q7(b) (6 marks)
Question
Differentiate between CMY and CMYK Colour Models used in digital image processing.
Solution
CMY (Cyan, Magenta, Yellow): a subtractive colour model used mainly for printing, where colours are produced by subtracting varying amounts of red, green, and blue light from white light using cyan, magenta and yellow inks (C=1-R, M=1-G, Y=1-B, in normalized [0,1] terms). Combining full amounts of all three inks should theoretically produce black, but in practice real inks produce a muddy dark brown/grey rather than a true black due to impurities.
CMYK (Cyan, Magenta, Yellow, Key/blacK): adds a fourth, dedicated black (K) ink channel to the CMY model. This solves the CMY model's problem of producing a poor/impure black, and also reduces the total amount of coloured ink needed (using black ink for dark/neutral tones instead of layering three coloured inks), which saves ink and produces sharper, richer blacks and shadows/text.
Key differences:
- Number of channels: CMY has 3; CMYK has 4.
- Black reproduction: CMY yields impure/muddy black; CMYK yields a true, crisp black via the dedicated K channel.
- Practical use: CMYK is the industry-standard model for actual commercial/office colour printing; CMY is more of a theoretical/simplified subtractive base model.
2016 · Paper-II · Q7(c) (8 marks)
Question
Explain the Boundary Extraction Algorithm used for basic morphology.
Solution
Boundary extraction is a basic morphological technique used to extract the outline (boundary) of objects in a binary image.
Algorithm: given a binary image A and a suitable structuring element B (commonly a 3x3 all-ones square, capturing 8-connectivity): Boundary(A) = A - (A erosion B)
Steps:
- Erode the image A with structuring element B: (A erosion B) shrinks the foreground region by removing boundary pixels (a pixel stays 1 only if the entire structuring element fits within the foreground at that position).
- Subtract the eroded image from the original image A (set difference: keep pixels that are 1 in A but 0 in the eroded result).
- The resulting set of pixels is exactly the boundary/outline - the pixels that were on the 'edge' of the object and got removed by erosion.
Intuition: erosion strips away the outer layer of foreground pixels, leaving only the 'interior'; subtracting this interior from the original object leaves exactly that outer layer, i.e., the object's boundary, which is typically one pixel thick (assuming a 3x3 structuring element).
Example: for a solid filled square of foreground pixels, erosion by a 3x3 square shrinks it by one pixel on every side; the difference (original - eroded) leaves just the outline/perimeter pixels of the square - a hollow square outline.
Part B — MCQs
2025 · Paper-II · Q5 (MCQ)
Which of the following comes under the application of image blurring?
- A. Object detection
- B. Gross representation
- C. Object motion
- D. Image segmentation
Answer: B
Explanation: Image blurring/smoothing is classically used for 'gross representation' — removing small, unimportant details before further analysis, as described in standard digital image processing texts.
2025 · Paper-II · Q6 (MCQ)
For a continuous image f(x, y), Quantization is defined as:
- A. Digitizing the coordinate values
- B. Digitizing the amplitude values
- C. Both (A) & (B)
- D. None of these
Answer: B
Explanation: Quantization converts the continuous intensity/amplitude values of an image into a finite set of discrete gray levels; digitizing the spatial coordinates is called sampling, a separate step.
2025 · Paper-II · Q7 (MCQ)
What is the method that is used to generate a processed image that has a specified histogram?
- A. Histogram linearization
- B. Histogram equalization
- C. Histogram matching
- D. Histogram processing
Answer: C
Explanation: Histogram matching (specification) transforms an image so that its histogram matches a specified, desired histogram, whereas histogram equalization always produces an approximately uniform histogram.
2024 · Paper-II · Q14 (MCQ)
Dynamic range in image processing is:
- A. Refers to span of wavelengths covered by a particular band in a multispectral image
- B. Maximum or minimum values present in an image
- C. Range of values spanned by grey scale
- D. None of these
Answer: C
Explanation: Dynamic range refers to the range of intensity/grey-level values an imaging system or image can represent, from its minimum to maximum distinguishable grey level.
2024 · Paper-II · Q15 (MCQ)
Which of the following is true?
- A. Brightness gives a measure of degree to which a pure color is diluted by white light
- B. Saturation gives a measure of degree to which a pure color is diluted by white light
- C. Hue gives a measure of degree to which a pure color is diluted by white light
- D. None of these
Answer: B
Explanation: In the HSI/HSV color model, saturation measures the purity of a color, i.e., the degree to which it is diluted by white light; hue represents the dominant wavelength/color type, and brightness/intensity represents overall light level.
2024 · Paper-II · Q16 (MCQ)
SIFT is:
- A. An image deblurring algorithm
- B. Basic edge detection algorithm
- C. Used to identify and define local features
- D. None of these
Answer: C
Explanation: SIFT (Scale-Invariant Feature Transform) detects and describes distinctive local keypoints/features in an image that remain identifiable under changes in scale, rotation, and illumination, used for tasks like object recognition and image matching.
2024 · Paper-II · Q17 (MCQ)
Optical character recognition:
- A. Cannot be done without non deterministic algorithms
- B. Can be done without non deterministic algorithms
- C. Can be done more efficiently and robustly with deterministic algorithms
- D. None of these
Answer: B
Explanation: Classical OCR relies on deterministic pattern-matching, template-matching, and feature-extraction/classification pipelines, so it can absolutely be performed without non-deterministic algorithms.
2024 · Paper-II · Q19 (MCQ)
Which of the following are true about the Weiner filter?
- A. It is a deterministic algorithm
- B. It minimizes the quadratic error
- C. It uses the binary cross entropy
- D. None of these
Answer: B
Explanation: The Wiener filter is derived to minimize the mean square (quadratic) error between the estimated and true image/signal, making it a minimum mean-square-error (MMSE) filter; it does not use binary cross-entropy, which is a loss function from classification/deep learning.