Professional Documents
Culture Documents
#1: Getting Started with Matlab, Grey Level Quantization and Image Histograms
Instructions
• One report has to be handed in per team. Nevertheless, you must be able to answer
questions about your lab report individually.
• The printed lab report (including source code listings) must be handed in within one (1)
week. Additionally, you have to send your source code (Matlab m-files) by electronic
mail to todor.stoyanov@oru.se. Use the subject “DIP Lab”, clearly state your names
and the lab session in the message and attach your files (in plain ASCII format).
• Each lab report is either marked as fail or pass. To pass the labs, all reports must have
been marked as pass. If the report is handed in more than three days after the deadline,
the report is marked as fail. Up to five bonus points may be awarded to the team for
very good lab assignments that comply with the criteria described below:
You will find more material (assignments, images, source code, tutorials, etc.) for the labs
on the course web page:
http://aass.oru.se/Research/Learning/courses/dip/2011/index.html.
1
Matlab
For the labs we will use Matlab (short for “Matrix Laboratory”), a large and very powerful
software tool for numeric computation, data analysis and signal processing. It features a
high-level programming language and an interactive graphical environment for algorithm
development and visualization. You will find links to tutorials on the course web page.
After starting the MATLAB application, you will get a “desktop” with several sub-
windows, of which the interactive command line window is the most important one: it prompts
(“>>”) for commands, evaluates and executes them and prints the results. Matlab provides
a built-in manual page system for all available commands as well as an extensive hypertext
on-line help system: on the command line, type help function-name to get help for a spe-
cific function, or type lookfor keyword to search for functions related to keyword; to start
the on-line help system, choose MATLAB Help from the Help menu.
2
3 Image Histograms
Image histograms are a simple but very useful method to analyze images and to enhance the
quality of the image (at least for a human observer) by performing point transformations.
To test your function, save the m-file and type at the prompt (omit the comments):
What can you see from the histogram? (Could you identify three regions in the histogram,
belonging to the dark foreground, the sea, and the light sky?)
3
function [im_out] = my_histeq(im_in)
% IM_OUT = MY_HISTEQ(IM_IN) performs a histogram equalization on the
% input image IM_IN and returns the result in IM_OUT
% both input and output image are intensity images (values from 0 to
% 255)
end
Test your function on the image file boat.tif and plot the original image, the histogram,
the cumulative histogram, the histogram and the cumulative histogram of the transformed
image, and the transformed (enhanced) image. Why is this operation called ‘histogram equal-
ization’ ?