
COSC 4393/6397
Digital Image Processing
Department of Computer Science
University of Houston
Assignment #1
Due: 9/17/07
1. Write a program to binarize a gray-level image based on the assumption that the
image has a bimodal histogram. You are to implement the method discussed in
class that assumes that both the foreground and background regions of the image
represent a Gaussian distribution and the optimal threshold to binarize the image
is the average of the means of the two Gaussians. Your code should report both
the binarized image and the optimal threshold value. Assume that foreground
takes a value of 1 and the background a value of 0 in the binary image. Also
assume that foreground objects are darker than background objects in the input
gray-level image.
2. Write a program to perform blobcoloring based on an 8-connected neighborhood
(3 x 3 window). The input to your code should be a binary image and the output
should be a count of total objects in the image as well as the labeled image where
each object is color coded starting with the value of 1 and the background taking a
value of 0. Assume that objects in the binary image take a value of 1 while the
background takes a value of 0. In addition, your code should also report the area
and centroid of each object in the binary image.
3. Write a main program to read in the supplied gray-level image (‘cells.png’) and
threshold the image to generate a binary image using the function developed in
part 1. Next, use the blobcoloring function developed in part 2 to count the
number of cells in the image and report on their statistics. Ignore cells smaller
than 15 pixels in area and generate a report of the remaining cells (Cell Number,
Area, Location, Total Count). In addition, display the original input image, the
binary image, and the final cell labeled image. The final image should include a
‘*’ representing the centroid of each cell and two numbers, one representing its
count and another its area.