Algorithms are to be directly implemented in the C++ (or C) language and applied to test images. You are expected to implement each programming assignment as a plug-in operator as part of the qtimage software environment provided in class. The qtimage environment automatically provides a mechanism for reading and writing several image formats, displaying many images simultaneously, probing pixel value information, zooming and panning an image, obtaining image information (size, bpp, padding, format), and a QImage class for manipulating image data in computer memory. You should apply each algorithm to several grayscale and color images of your choice. The input images, output images, histograms and other processing steps are to be saved and organized for access via Web pages. The results of your implementation can be checked for accuracy against the results produced using other image processing packages such as VisiQuest/Khoros, Matlab or the ImageVision Library.
NOTE: Assignments are to be set up as a HTML document (Web page) with a description of the algorithm, source code, input and output images. Please print out your document and turn it in for grading unless a different submission mechanism is described in class.Your program should work for both gray scale and color images. For an input gray level image the output can be another gray level image with pixel intensities ranging between 0 to 8. You can scale the output image for display by scaling (ie multiplication by 16) or offset (ie addition by 200). Since the dynamic range is small your output gray level images may not be very informative. So an alternative is to output a (8-bit) color image using a color look-up-table (LUT) of size 9, whereby each value between 0 and 8 is mapped to a distinctive color.
For an input color image the output bit count image data can be either gray level pixels with a range from 0 to 24 (suitable scaled or offset), a 8-bit color image using a color LUT of size 25, or a 24-bit color image using RGB pixels with each component in the range 0 to 8 suitably scaled and offset for display.
Again to reiterate, for display purposes you may need to manipulate your data - you can scale the output image data suitably for display via a scale and/or offset factor; for example multiplied by 10. Or you can use a color look-up-table (LUT) to index the bit count values to a color image where each pixel's color corresponds to a different bit count; this keeps the original bit count values and does not change the count data. Your program should read and process byte data for images stored in standard image formats such as raw, PGM, BMP, GIF, JPEG, SGI, TIFF, etc.
BONUS: Extend your program and bitwise manipulations to work for 16-bit imagery.
If you implement your program as a plug-in (to qtimg) the following specification does NOT apply. If your program runs on the command line and accepts command line arguments, then your program should process the following arguments:
bit_count [x_dim] [y_dim] [8|24] input_image output_image
The following C program,
pgm_read+write.c, may be useful to directly read a pgm format grayscale image (in
binary or ASCII representation) into a 2-D array for further processing.
Notice that you have a lot of choices and options even for such a simple program.
This will usually be the case for the other programming assignments in the course.
Your written description should be complete and detail the choices you made in your
software implementation.
Image display software: If you work with raw data, then you can use the IISS to look at
your input and output image data (on SGI Irix). If you read and write
other file formats you can use qtimg (software for this course), gimp, ImageMagick, VisiQuest/Khoros, imageview,
imageworks, xv, Photoshop, or any number
of other image processing packages to view and check
your results.
Your program needs to output several different pieces of information. First, output in (ASCII) text format the total number of components found along with the size of each component (ie total number of connected pixels). Second, you will need to output an image in which each component is assigned a unique numeric label from 0 through N; that is each pixel is labeled with a component number or zero for the background. A color LUT can then be conveniently used to visually check that all the components have been correctly identified.
You may assume that you will need to represent only 256 distinct components in the image so you can use just one byte to represent the component label (0 to 255) for each pixel in the output image. If the image contains more than 256 components, your program must correctly identify ALL the components but only 256 unique components or labels need to be assigned to objects in the image for display and viewing; that is reuse labels when there are more than 256 components.
The connected component labeling algorithm described in class assumes a binary image (ie zero-one valued or segmented image) as input. The general image segmentation task is very challenging and highly application dependent. Image segmentation is a topic that will be covered later in the course. For this assignment, you can generate a binary image from a gray level or RGB input image in several simple ways.
In the first approach, you can modify your bit counting program to generate a binary image for input to the connected components program by selecting a specific bit plane to output instead of counting all the bits (ie bitplane 7 would be all pixels with gray value greater than or equal to 128). In the second approach, for either gray scale or 24-bit RGB images you can select a range of intensity values to use as a simple threshold for selecting components from the image. For example, 22 to 100 would mean all pixel values between 22 and 100 would be considered as a one and all other pixel values would be a zero for the identifying objects in the image. For RGB images 3 ranges will be needed, one for each channel. Of course multiple sets of ranges can be used in the thresholding procedure.
Your connected components labeling program should work for binary, 8-bit gray scale images and 24-bit RGB color images.
If you are NOT using the qtimg program and plug-ins, then use the following command line options. For command line processing your program should accept the following arguments:
connected_comp [x_dim] [y_dim] [1|8|24] [component_range] input_image output_imagehisto_equalize [x_dim] [y_dim] [8|24] input_image output_image
input_image_histograms output_image_histogramshisto_spec [x_dim] [y_dim] [8|24] [target_histogram | target_image] input_image output_image
input_image_histograms output_image_histogramsconvolve [3x3_filter_coefficients | edge_detect] input_image output_imagefourier_transform [log] input_image output_magnitude output_phasefreq_filter [low|high|butter] input_image output_imageProgramming Project Topics:
Extra/optional assignments:
median [m | 3] input_image output_image