More Practice With Imaging in Bioinformatics
Feature Detection Using Template Matching
Original Image |
Template (Target) Image |
 |
 |

Prep readings:

In this assignment, we wish to:
- learn how to do feature detection on an image
by template matching to find a specific
target
Overview
Consider the noisy images shown above. Your goal is to design a computer program
to count the number of blot features in the gel on the left. You begin by extracting a sample
blot subimage, such as the one on the right. To find the blots in the original image,
you simply match the template image to all (or many) of
the possible places it could be located at in the original image.
In image processing, this type of algorithm is known by various names, such as
template matching or model matching or feature detection.
The blot subimage represents the template, model, or feature you are interested
in matching or detecting.
The matching/detection process can be implemented in several equivalent ways:
- Count the number of agreements between pixels in the image and the template,
and then pick the location(s) that have the maximum number of agreements.
This is known as a maximum correlation approach.
- Count the number of disagreements between pixels in the image and the template,
and then pick the location(s) with the minimum number of disagreements.
This is known as a minimum error approach.
- Use a distance function (typically a simple Euclidean distance) applied between
the image pixels and the template pixels to measure the similarity
of the template and the image at each location. This approach then picks the location(s)
with the smallest distance as the location(s) of the template image in the original image.
Getting some practice
- Copy the files and TIF images linked above into your bioimaging folder in your ArgoNet
account. (This was the folder you created in
Introduction to Imaging in Bioinformatics (Part I).)
- Start MATLAB, and run the template matching program by typing
featuredet program in the MATLAB Command Window on the right.
The output you see in the command window will indicate the row number of the original
image as it is being searched. You will also see a final array indicating the
location(s) detected and an associated measure for each location.
- If all works correctly, you should also see a figure open up with the results
indicated on the original image. Any results that scored a 100% match
are shown in red. Other matches are shown in shades of yellow.
- Study the results.
What is the difference between the two result images provided?
How many targets were located in each of these images?
Which image set has better performance and why?
How did this algorithm perform overall on the blot counting task?
- Now, open the findMatches.m file and change the value for the percentMatch
variable. (Try both higher and lower values.)
Run the program again and observe any results.
- Next, open the featuredet.m file and change the value of the TOTAL_MATCHES variable.
(Try both higher and lower values.)
Run the program again and observe any results.
- As you complete this lab, think carefully about the following questions:
- Which of the three methods for matching (described above) is implemented
in this code? What are the advantages and disadvantages of this approach?
- How would the presence of noise impact template matching?
- How would template matching be impacted by any distortions of the template
or targets in the original image, such
as translation, rotation, shearing, expansion, contraction or occlusion?
- What are some ways to improve the speed of template matching?
Possible Problems and Solutions
Getting Credit for Your Progress
To get credit for this assignment, you need to complete these additional steps:
- Find an interesting image that you would like to do some template matching on.
Ideally, this might be an image related to your
Term Project.
Store the new image in TIF format in your bioimaging folder. Next, use
one of the Microsoft tools with an image cropping option
to extract a feature image. Save this
in TIF format as well. (Other image
formats such as JPEG that involve compression may not work as well.)
- Make a copy of the main featuredet.m
MATLAB program provided above (also in your bioimaging folder)
and name the copy my_featuredet.m
- In your new program file, change the names
of the input images to the images you would like to process.
Save this new program, and then type my_featuredet in the MATLAB
Command Window to run the code with your new images.
- Experiment with the code and parameter values until you produce some
images which appear interesting or useful.
- Once you have some interesting images, save them from within the MATLAB
program (using the imwrite function).
Note that by default, MATLAB will save the images in the directory indicated
next to the "Current Directory" label in the main window, so you will need
to change this directory to your bioimaging folder before you run the
new version of the program.
- On your course Webpage, under a heading titled, "Lab 7b: Imaging in Bioinformatics",
include links to:
- your new MATLAB files
- four images: your original image, template image, and two result images
with the target locations marked
- text which describes why you think your results are interesting or useful
- E-mail me (msutton@uwf.edu) when you have completed the above steps.
Feel free to check out how the other students
in the class are doing on the assignments.
These pages are optimized for viewing
under Netscape.
© Copyright 2003.
Melanie A. Sutton, Ph.D.
(msutton@uwf.edu)
All rights reserved.