RTUEE / EC / EEEYr 2019 · Sem 72019

Q10Digital Image Processing

Question

16 marks

Q.5. (a) Edge detection mask is defined as [[-1,-1,-1],[-1,8,-1],[-1,-1,-1]]. Apply the above mask on the following image: [[20,49,52,62,70],[55,167,117,161,27],[17,40,51,30,40]]. [8]

(b) Discuss image segmentation based on global thresholding. [8]

Answer

Applying the Laplacian-type edge mask to the given image gives convolution results 147, 935, 324, 839, and -147 across the middle row's five column positions, with large-magnitude responses at high-contrast pixels confirming the mask's role as an edge/point detector; global thresholding segments images using a single intensity threshold, with Otsu's method automatically choosing the optimal threshold by maximizing between-class variance.

(a) Numerical: Convolution with the Edge Detection Mask

We are given the edge detection mask [[-1,-1,-1],[-1,8,-1],[-1,-1,-1]] and the image [[20,49,52,62,70],[55,167,117,161,27],[17,40,51,30,40]]. Since the mask requires a full 3x3 neighborhood, only the middle row (row index 1) has complete 3-row neighborhoods available (using zero-padding at the left and right edges of the image where a full 3-column neighborhood is not available).

Detailed calculation at column index 1 (value 167)

The 3x3 neighborhood centered at row index 1, column index 1 is rows 0-2, columns 0-2:

Applying the mask element-wise (multiplying each neighborhood value by its corresponding mask coefficient and summing): sum = (-1)(20) + (-1)(49) + (-1)(52) + (-1)(55) + (8)(167) + (-1)(117) + (-1)(17) + (-1)(40) + (-1)(51).

This matches the verified result of 935 at column index 1.

Detailed calculation at column index 3 (value 161)

The 3x3 neighborhood centered at row index 1, column index 3 is rows 0-2, columns 2-4:

Applying the mask element-wise: sum = (-1)(52) + (-1)(62) + (-1)(70) + (-1)(117) + (8)(161) + (-1)(27) + (-1)(51) + (-1)(30) + (-1)(40).

This matches the verified result of 839 at column index 3.

Remaining column positions (using zero-padding at the boundaries)

Following the same convolution procedure at every column position along the middle row, with zero-padding applied wherever the neighborhood extends beyond the left or right edge of the image, gives the complete set of results across the row: column index 0 = 147, column index 1 = 935, column index 2 = 324, column index 3 = 839, column index 4 = -147.

  • Column 0 (zero-padded left edge): result = 147
  • Column 1 (center value 167): result = -20-49-52-55+1336-117-17-40-51 = 935
  • Column 2 (center value 117): result = 324
  • Column 3 (center value 161): result = -52-62-70-117+1288-27-51-30-40 = 839
  • Column 4 (zero-padded right edge): result = -147

These results show that the largest-magnitude positive responses (935 and 839) occur at the positions centered on the brightest, most locally-contrasting pixels (167 and 161 respectively), confirming the mask's sensitivity to strong local intensity discontinuities. The mask coefficients are structured so that the center weight (+8) exactly balances the sum of the eight surrounding weights (each -1, summing to -8); consequently, the mask produces exactly zero response over any perfectly uniform, flat-intensity region (where all nine neighborhood values are equal, giving 8x - 8x = 0), while producing a large-magnitude response, either strongly positive or strongly negative, precisely at points of significant local intensity discontinuity, consistent with its role and design as a Laplacian-type edge/point detection mask.

(b) Segmentation Based on Global Thresholding

Global thresholding segments an image by choosing a single threshold value T for the entire image and classifying every pixel as foreground or background depending on whether its intensity exceeds T. It works cleanly when the image histogram is clearly bimodal, exhibiting two well-separated peaks (one for object pixels, one for background pixels) with a low-density valley between them where T can be placed.

Otsu's method automates the selection of this global threshold by evaluating, for every candidate value of T, the between-class variance of the two resulting pixel populations (weighted by their respective proportions), and selecting the value of T that maximizes this between-class variance (equivalently minimizing the within-class variance of each of the two resulting groups). This produces the value of T that best separates the two populations statistically, making Otsu's method a fully automatic, widely used approach for global threshold selection without requiring manual tuning.

This example demonstrates a key structural property of the given Laplacian-type mask: since the center weight (+8) exactly equals the negative sum of the eight surrounding weights (each -1, summing to -8), the mask produces exactly zero response when applied to any perfectly uniform (constant-intensity) neighborhood, regardless of the actual intensity value at that neighborhood - this zero-response-on-uniform-region property is precisely why this type of mask functions as an edge/discontinuity detector rather than responding to the image's overall average brightness level, since it is sensitive only to local intensity VARIATION (the difference between the center pixel and its surroundings), not to the absolute intensity level itself. The large-magnitude convolution outputs computed above at column positions 1 and 3 (corresponding to the high-contrast pixels 167 and 161 in the original image, each surrounded by much darker neighboring pixels) directly confirm the mask's strong response at genuine points of local intensity discontinuity, precisely the behavior expected of an edge/point-detection filter of this type, and this same masking operation, when applied across an entire image (with appropriate boundary handling at the image edges, such as zero-padding as assumed in this example, or alternative conventions such as replicate-padding or mirror-padding), forms the basis of Laplacian-based edge detection and image sharpening techniques discussed elsewhere in this paper.

It is also worth contrasting this Laplacian-type point/edge-detection mask with the simpler first-derivative gradient operators (such as Sobel or Prewitt) discussed elsewhere in this paper: while gradient-based operators produce a directional response emphasizing edges oriented perpendicular to the specific gradient direction being computed, this isotropic Laplacian-type mask responds equally to intensity discontinuities in any direction, since it is built from a symmetric, direction-independent neighborhood weighting, making it particularly well suited to detecting isolated point-like discontinuities and fine image detail regardless of their orientation, at the cost of being somewhat more sensitive to noise than a directionally-selective gradient operator.

In a complete edge-detection pipeline, the raw convolution output computed here would typically be followed by a magnitude thresholding step (retaining only responses exceeding a chosen threshold as genuine edges) and possibly non-maximum suppression, to convert this dense, continuous-valued response map into a clean, binary edge map suitable for subsequent edge-linking and segmentation.

Global thresholding, discussed in part (b) of this question, provides a complementary segmentation approach based on intensity value alone rather than intensity discontinuity, and the two techniques (edge-based via this convolution mask, and region-based via thresholding) are frequently combined in practice, using edge information to refine or validate boundaries initially proposed by a thresholding-based segmentation, or vice versa, since each approach compensates for weaknesses in the other under different image conditions.

Edge-detection masks and global thresholding-based segmentation represent two complementary approaches to extracting meaningful structure from an image - edge detection identifies boundaries by responding to sharp local intensity discontinuities, producing a map of edge strength at every pixel, while global thresholding instead partitions the entire image into foreground and background regions based on a single intensity threshold applied uniformly across the whole image, working best when the image exhibits a clearly bimodal intensity histogram with well-separated object and background intensity peaks, a condition edge-based segmentation does not require, making the choice between the two techniques (or their combination) dependent on the specific characteristics of the image being segmented.

Back to Paper