# AMSC 460 / CMSC 460 Fall 2007

## Frequently Asked Questions for Homework 3

Question:
How are tif-files stored?

Answer:
A tif-file defines a two-dimensional array of values.
Each value is between 0 and 255. "0" represents "pure black"
and "255" represents "pure white". Values in between are
shades of gray.

For example, if

a = [ 0 0 0 0 0;

0 255 255 255 0;

0 255 165 255 0;

0 255 165 255 0;

0 255 255 255 0;

0 0 0 0 0 ],

then "imagesc(a)" followed by "colormap(gray)"
will display a gray box in a white
box in a black background. (Try it!)

So if we wanted the area of the gray and white boxes,
we could create a function that was 1 when a(i,j) was
less than 166 and 0 otherwise.

Question:
Should we read the image (using
imread) everytime we need it?

Answer:
No, this is very inefficient. Your program should read it once only.
(Otherwise you will lose a point on your grade.)

Question:
What happens if we ask Matlab for the matrix element e(x,y)
with x=22.4 and y=19.6?

Answer:
Matlab will give an error message. The indices x and y used
to get a matrix element must be positive integers. Consider
using the "round" function.

Question:

Answer: