Lab 3

horizontal rule

ece480 | doering | ece labs | ece | rhit

Home
Schedule
Course Information
Policies
Homework
Labs
Resources

Pixel Spatial Relationships

horizontal rule

Introduction

MATLAB provides several nice features to help you create interactive applications. The graphical input function ‘ginput’ reports pixel coordinates selected by the pointing device. Distance measures can be reported once your application prompts the user for two points on the image.

MATLAB's high-level programming features can also be used to implement algorithms. In particular, you will create an application that can identify the individual four-connected regions in a binary image.

Objectives

bullet

Design an interactive routine that reports various distance measures between two selected pixels in an image

bullet

Implement the automated 4-connected region identifier algorithm discussed in class

Deliverables

One-page memo detailing your results, plus additional attachments as needed. Be sure to include the following:

bullet

Hardcopy of all MATLAB code you develop

bullet

Hardcopy of image and command line output demonstrating your distance measures script

bullet

Hardcopy of image output from your four-connected region identifier

The memo will be due at the next lab period.

horizontal rule

Distance Measures

Create a script called ‘distance.m’ that prompts the user to select two pixels on a displayed image, and then displays the three distance measures discussed in class (Euclidean, city-block, and chessboard). Your script should place marks on the image to show the selected pixels.

Useful MATLAB functions to consider include ‘ginput’, ‘disp’, ‘text’, and ‘sprintf’.

Once you have completed your script, compare your results to the ‘pixval’ function (try holding down the left mouse button as you move the cursor).

Region Identifier Algorithm

We recently discussed an algorithm in class that can automatically identify four-connected regions in a binary image. Implement the algorithm in MATLAB (or another language, if you prefer). Test your algorithm using the ‘letters.png’ image.

NOTE: You need to convert ‘letters.png’ to a binary image as follows:

m = imread('letters.png');
m = m > 128;

The resulting image will have background pixels set to zero and foreground pixels to one.

We used letters for the region identifiers when we tried the algorithm on a small image in class. This technique becomes impractical for larger images, however. Use numerical values for your region identifiers, i.e., the sequence 1, 2, 3, etc. These symbols will be much easier to see if you assign distinct colors to each numerical value, and then use a color display. Recall that ‘imshow’ can be called with a second argument containing a colormap. You can design your own colormap, or try using one of the built-in colormaps (see the help page on the ‘colormap’ function for more information).

horizontal rule

Home | Schedule | Course Information | Policies | Homework | Labs | Resources

 ECE480/PH437: Introduction to Image Processing (W 2001-02)
Department of Electrical and Computer Engineering
Rose-Hulman Institute of Technology


For questions or comments regarding this web contact:
Last updated: 03/10/05.