Lab-exercises-v9
Lab-exercises-v9
Exercise A-2: Convert a rectangular PART of a color image to gray scale (part1.cpp)
The program converts a rectangular part of the image to gray scale. This rectangle is
defined by (startX,startY) and (endX,endY). Adjust the rectangle and see the change in the
output image.
Exercise A-6: Changing the image contrast using gamma adjustment (gamma1.cpp)
Gamma adjustment is one way of adjusting the overall contrast of an image. If the parameter
gamma is less than 1.0 but greater than 0, then the lower intensities are stretched up,
resulting in a brighter image but with greater contrast for the lower intensities. On the other
hand, a gamma that is greater than 1.0 stretches the high intensities downward, resulting in
a darker image but with greater contrast for the higher intensities. Play around with the value
of gamma on different input images and observe the result. Modify the program such that a
small region is enhanced instead of the whole image.
Exercise A-7: Increasing the image contrast using histogram equalization (histeq1.cpp)
Histogram equalization is a contrast-enhancing technique. It modifies the intensity histogram
to match the uniform distribution as closely as possible. The parameters startX, startY,
endX, and endY define the region that will contrast-enhanced. The parameter percent
determines the amount of contrast enhancement, where a value of percent=100 maximizes
the contrast. Find images with low-contrast regions and bring out the image details in these
regions using histogram equalization.
Exercise A-8: Increasing the image contrast using histogram stretching (histstretch1.cpp)
Another method for increasing the image contrast is by stretching the intensity histogram.
This time, the left end (parameter lowerPercentile) of the histogram is “pulled” to black and
the right end (parameter upperPercentile) is “pulled” to the white end. The parameters
startX, startY, endX, and endY define the region that will contrast-enhanced. Adjust these
parameters to see the effect on the region’s contrast. Try this on other images.
Exercise A-10: Edge detection using the image gradient and zero crossings (edge1.cpp)
One way of finding significant edges in an image is using the edge magnitude. Applying a
threshold on the gradient magnitude separates the significant edges from the rest of the
image. In the program, adjust gradientMagnitudeThreshold and observe the edges that
were picked out. Did the method also pick out the noise? Another method for finding edges
is by applying a second-derivative operator (ex. Laplacian) and detecting the zero-crossings.
The program applies the Laplacian operator and marks the edges that mark the location of
the zero-crossings.
Exercise B-6: Finding words, lines and paragraphs in a document image (page1.cpp)
Page layout analysis is an area of document image analysis where the system groups
characters horizontally to find words, words are grouped horizontally to find text lines, and
text lines are grouped vertically to find paragraphs. In this program, hierarchical grouping is
done by horizontal or vertical “smearing”, followed by connected component analysis.
Adjust the “smearing” parameters (structuring element’s dimensions for dilation) to get good
grouping at each level of the hierarchy.
Exercise B-7: A document form reader: optical mark recognition
Write a program that reads the answers from the attached 30 forms (forms30.zip). Put a
green box on each input field. Put a red box on the input fields that are shaded. The field
locations are found in the attached file fields39.csv. Each row of the CSV file corresponds
to a question with seven input fields (choices) whose locations are arranged x1 y1 x2 y2 x3
y3 x4 y4 x5 y5 x6 y6 x7 y7. As a bonus, put a blue box around answers with an “X”.
Part C: Color Image Processing
K-means clustering is a pattern recognition technique for finding the K natural groupings, or
clusters, in a given data set. The clustering algorithm is applied to the pixels of a color
image, where each pixel is a point in the RGB color space. Try the method on different types
of images. For each image, try to find the best value of K. Assuming that K is NOT initially
known, how would you modify the program to automatically find the best value of K?
Part D: Image Sequence Processing