Description
Connected-Component Labeling and Set Operations
As discussed in L5, this project considers the application of a sequence of simple image-processing operations
to an image, such as connected-component labeling and logical (set) operations.
1. Bright-Region Extraction
(a) Consider the gray-scale image, “lake.gif.” Experimentally choose a threshold so that > 4 distinct
“bright” components obviously appear. Save this thresholded image, “fthresh,” in a form that makes
the thresholded objects visible on the screen.
(b) Find the connected components of the thresholded image “fthresh.” You can use the MATLAB function
bwlabel for this purpose. The following MATLAB call creates a labeled image called ”flabel” from the
input thresholded (binary valued!) image ”fthresh”:
[flabel, num] = bwlabel(fthresh, 8)
where 8-connectivity is assumed for the components and num is the number of connected components
labeled in “fthresh”. To display this labeled image with colored components, you can use
fRGB = label2rgb(flabel);
And then use imshow(fRGB) to see the colored labeled image.
(c) Save the 2 largest components of your labeled image and delete the other components by setting their
constituent pixels to 0. You will need to write a function to do this.
(d) Be sure to give output images for all steps above.
2. Logical (Set) Operations
Note: you are to write your own functions for the operations in this part of the project — you may NOT
use built-in Matlab functions.
(a) Write Matlab functions for the AND, OR and XOR binary-image operators and NOT unary-image
operator, using A and B as input images. What are the quantities A AND B , A OR B, A XOR B,
and NOT(A) in terms of set union, intersection, and complement?
(b) Let A be the “match1” image and B be the “match2” image. Compute the following images: A AND
B , A OR B, A XOR B, and NOT(A)
(c) Build the minimum operator and compute E = min(C, D), where image C is “mandrill gray” and
image D is “cameraman.” For each pair of pixels (x, y) in the two input images, the minimum operator
assigns the minimum of the two values (C(x, y) and D(x, y)) to the output E(x, y). As we will see later
during our discussion of Morphological Image Processing (G&W Ch. 9), the minimum operator is a
gray-scale analog of set intersection (AND) and is sometimes called “erosion.”
3. Write a report in the standard format. Be sure to describe all of your methods, including 1(c) and other
parts.