Home | | Schedule | | Assignments | | Lecture Notes
This assignment focuses on the analysis of intensity changes in two-dimensional images. You will examine the results of processing a natural image at multiple scales and explore how the nature of early processing in human vision can lead to visual illusions.
The M-Files and images that you need for this assignment are contained in the
csci363/assignments/assign2
directory. You should already have copied the
files into your assign2 directory during lab2. In MATLAB, set your
Current Directory to the assign2
folder. Final submission details are given
at the end of this handout.
First, complete lab2.
In this problem, you will write functions to detect the zero crossings obtained from the convolution of a real image with Laplacian-of-Gaussian convolution operators of different size. You will then describe your observations.
The yachtScript.m
script in the assign2
folder contains the processing
steps needed to reiterate the steps you accomplished in lab2. I.e. it loads in the image,
yacht.jpg, convolves it with laplacians of gaussians of sizes 4 and 8 and stores the results in
two images, conv4 and conv8.
You can execute this script by typing
>>yachtScript;
in the Command Window.
Your function should loop through the entire convolved image, starting at position (2,2). If the pixel value at position (x,y) differs in sign from the one to the left (at (x-1,y) or the one above it (x, y-1), that constitutes a zero crossing and your function should place the value 255 at position (x, y) in zcImage (which should be zero elsewhere).
Note that you can find the dimensions of the original convolution with the statement:
[xdim ydim] = size(conv);
The size
function will return the x dimension in xdim and the y dimension in
ydim.
Run your function on the conv4 image, view the result with imtool and note where the zero crossings are located. Now, run the function on the conv8 image and view that with imtool.
You can also view the zero crossings overlaid on the original image using the overlayZC function provided to you in your assign2 folder. If your zero crossing image is named zcs4, you can view the overlay by typing:
>>overlay4 = overlayZC(yacht, zcs4);
>>imtool(overlay4);
Examine the behavior of the zero-crossings for the two different operator sizes. How well do they match up with intensity changes that you see in the original image? How accurately do they seem to reflect the positions of the intensity changes? Are there "spurious" zero-crossings that do not seem to correspond to real edges in the original image? Describe specific examples of features in the image that are captured well by the zero-crossings, and places where the zero-crossing contours do not seem to correspond to a real edge in the image.
Write a function, zcSlope = zeros2D(conv)
, that will compute the slope at the
location of each zero crossing. The slope is computed as follows:
dx = conv(x, y) - conv(x-1,y);
dy = conv(x, y) - conv(x, y-1);
slope = sqrt(dx^2 + dy^2);
Your function will look very much like your zcs function, except that instead of placing
the value of 255 at the location of the zero crossing, it will place the value of the slope
at that location.
Create two new zeroCrossing images by using your zeros2D function on your conv4 and conv8
convolutions. Display the resulting images using the displayImage
function.
Examine the original image next to the images of the slopes of the zero crossings. Do the slopes
seem to be correlated with the contrast of the corresponding intensity changes in theimage?
Write your answers to the questions in parts a and b of this problem and turn them in with the hardcopy of your code.
In the case of the "sun illusion" shown on the far right, we perceive a bright central disk that is not really present in the image. Sometimes we can offer a possible explanation for why these illusory contours arise, on the basis of the nature of the early processing of intensity changes that takes place in the visual system. In this problem, you will examine the zero-crossings that result from the convolution of the sun image with Laplacian-of-Gaussian operators of different size, in search for such an explanation.
The makeSun
function creates an image of the sun illusion. The
sunScript.m
file provides some initial code for analyzing the sun image. This
code convolves the image with a Laplacian-of-Gaussian operator of size w = 5
and
computes the zero-crossings. (Note that the script relies on your function from problem
1, which should be named zcs and stored in the file, zcs.m. The image and zero-crossings are both displayed using
imtool
. At this scale, the zero-crossing contours surround each spoke of the sun
wheel. Add code to the sunScript.m
code file to generate zero-crossings from
convolutions with larger Laplacian-of-Gaussian operators of size w = 10
and
w = 20
. Observe the zero-crossing contours obtained from all three operator sizes and
describe how they change as the operator size is increased. Based on this analysis, can you offer
an explanation for the sun illusion?
The function makeHermann
creates an image of a famous contrast illusion known as
the Hermann Grid. While reading a book on sound by John Tyndall in 1869 that contained a grid
of bright lines on a black background, Hermann noticed that dark shadowy dots appeared at the
intersections of the bright horizontal and vertical lines. You can see these dark spots in the
Hermann Grid image shown below - you can see the dots more clearly at intersections that are
located a small distance away from where you are directly looking. Hermann reported his
observations in 1870, and since this time, the so-called Hermann Grid illusion has been much
studied and debated by vision scientists. In this problem, you will explore a possible account
of this phenomenon based on an analysis of the computed contrast of intensity edges (i.e. the
slopes of the zero-crossings).
The hermannScript.m
script file contains code for processing the Hermann Grid
image by convolving it with a Laplacian-of-Gaussian operator of size w = 6
and
computing the resulting zero-crossings. (Note that the script makes use of the
zeros2D function you wrote in part 1). The image, convolution and zero-crossings are displayed
using imtool
. Again, they may initially be superimposed when the script is
executed and can be dragged apart with the mouse. Using the Pixel Region tool in the Image Tool
window, examine the slopes of the zero-crossings computed in the vicinity of an intersection of
the grid, and along the middle of a horizontal or vertical bar of the grid. These two
locations are indicated in the diagram below. The slope of a zero-crossing is roughly
proportional to the contrast of the corresponding intensity change in the image.
Explain why the slopes are different in the vicinity of the grid intersections and along the edges of the bars between the intersections. To assist you in answering this question, the following diagram shows the placement of the convolution operator when computing the convolution values in these two regions:
How would you EXPECT the convolution values to differ in these two areas, given your understanding of the structure of the convolution operator and the convolution computation? (Keep in mind that the intensity values for the dark regions are smaller than those for the bright bars. For both of the operator positions that are shown in the above picture, the central positive region of the operator covers an area of constant bright intensity, but the surrounding negative regions cover different amounts of dark area in the image.) The answer to this question should then lead you to an explanation of why the slope of the zero-crossings is different in these two regions. Assuming that the slopes of the zero-crossings convey information about the contrasts of the intensity changes in the original image, try to construct a possible explanation for why the intersections of the Hermann Grid appear darker. You can assume that the black regions will appear uniformly black to the human viewer.
Submission details:
zcs.m, zeros2D.m
and sunScript.m
code files and your answers to the questions
for Problems 1-3. (To conserve paper, you can copy-and-paste the individual code files into one
extended M-File that you submit.)
zcs.m, zeros2D.m
and
sunScript.m
Home | | Schedule | | Assignments | | Lecture Notes
Constance Royden--croyden@holycross.edu
Computer Science 363--Computational Vision
Last Modified: February 8, 2023
Page Expires: February 8, 2024