File Exchange

image thumbnail

Target Detection

version 1.0 (2.04 KB) by

Detects a Target image in a given image and focuses on it.

33 Ratings



No License

This program detects a target image in a given image according to maximization of Cross Correlation.

Sample Run:

>> target

This program detects a target in an image
Entering the image for MATLAB...
Save the image or its copy in MATLAB working Directory
Enter the name of the image file (filename.ext) : myphoto.bmp

Entering the target image for MATLAB...
Save the target image or its copy in MATLAB working Directory
Enter the name of the target image file (filename.ext) : eye.bmp

Do you like to SAVE Result Image? (y/n) : n

You choose NOT to SAVE the Result Image

Comments and Ratings (47)

Keerthi Js

how to give an value for output

mahum pervez

can anyone tell me how to extract that detected portion?

Navya k

thank u for this good work..i got lot of help from this..


sahil (view profile)


sahil (view profile)

can any1 plz xpalin me the code inside the {} brackets..
{pixel = find(output == 1);
pcolumn = fix(pixel / sizw(1));
prow = mod(pixel,sizw(1));
rdis = fix(sizt(1)/2);
cdis = fix(sizt(2)/2);
cmin = pcolumn - cdis;
cmax = pcolumn + cdis;
rmin = prow - rdis;
rmax = prow + rdis;
c = [cmin cmin cmax cmax];
r = [rmin rmax rmax rmin];
m = roipoly(ww,c,r);
m = im2double(m);
m = 0.5 * (m + 1);
mask(:,:,1) = m;
mask(:,:,2) = m;
mask(:,:,3) = m;
final = mask .* w;
i need to understand it as soon as possible..


ya ! cool one ...................,

Sisir Kanti

Hi, i didnot understand this part. Please help!

m = 0.5 * (m + 1);
mask(:,:,1) = m;
mask(:,:,2) = m;
mask(:,:,3) = m;
final = mask .* w;

Raymond Cheng

Thanks for your sharing.

Jun wan

very done,thanks


flame metal

I am just a beginner in image processin.can someone please tell me what is the function of following codes in this program? I will be really grateful.

1. output = (1/o)*out;
2. pixel = find(output == 1);
3. pcolumn = fix(pixel / sizw(1));
prow = mod(pixel,sizw(1));
rdis = fix(sizt(1)/2);
cdis = fix(sizt(2)/2);
4. m = 0.5 * (m + 1);

Ashar Malik

the effort is good yet the problem of matching is not completely solved, the rotated or tilted objects create a real mess and you have to permute, which takes centuries .... well at least for now it does....
i am working on something related and as soon as i get it up will post it here ....

kum jinlong


majid chababi

indexed images by color,textur and forme

Ashish Pant

The implementation above is good but seems to fail on real world images extracted from a video sequence. Due to intensity flicker and motion of even the smallest objects, targets dont get detected on subsequent images.Further more the size of target image is crucial since in a real world sequences areas within an object can appear to be similiar and thus lead to multiple area detection as i am obtaining. With additional work this code could overcome these problems.

raffaele pappaterra

jingkun guo


Lin Zhang

This is a template matching topic.

I would like to know how to deal with the rotation and scaling changes for the template in the input image.

When there is no rotation and scaling change, the cross-correlation method can do this detection job. The cross-correlation method can not detect the template when it is rotated and changed.

I am looking forward to anyone's response. Many thanks in advance.

mamadoe86 mamadoe

good work

arnold jansen

i need source code about face recognition using gabor wavelet.would you help me please....


rajarao chatla

it's working but im unable to follow this detection part. Pls help

hana qudah

nanda kishore velaga

i find it interesting....iwant to prepare documentation for this.........please help me.....what topics i can include in it ?.....please help me

Harold Odom

Fernando Castro

Very good!!!

siyao fu

need to have a pre-definded pic first, use it to travese all the image to match the one.

Chon Ji

I can't make it work, I tried to input 2 bmp files but it shows an error
conversion to cell from double is not possible.

Error in ==> test at 53
mask(:,:,1) = m;

How can I make it work?

aziz osman

Ita good, but it tries to give a positive output eventhough the images do not match.That could pose a problem i believe.

kratos kong

Good....i am currently doing research on teleoperated bomb disposal robot vision system...i wonder if i can use this features or any other features in matlab image processing to enhance its peformance..Can someone give me any idea? thanks. (

Siddharth Joshi

Way to go!.... a very useful application...
Used it for my project...

Bob Schafer

Awesome, and simple! Should advertise that it can also find a *similar* target: for example, show it a scene with a face in it, give a different face as target, and it'll (often) find the face in the scene.
Can change the line
pixel = find(output == 1);
to something like
pixel = find(output >= thresh);
to find all instances of a target (or places similar to the target, e.g. all faces).

lissa anastasia

tq for the good programming.i just want to know is that the same method in this program for me to detect the car plate number as my target?

masoud saadatkhah

Kwok Denis

Super cool!!!!

Changchaiyo Wattana

I think,it's a good programm. Now,I am testing this programm and I feel good . If you have programm which can detect other part of object , I give a programm to test again please . Thank you very much

yanwan yan

Very good

Abdul Sultan

Nice Work.

Tashfeen Karamat

Good work.

farzad mazaherian

please send M-files of the matlab for image processing
best wishes

abhay kulkarni

well prepare

Shahzad Ahmad

C Dose

Very Well Done!!!

hennesa hennesa

Mina Saleh

MATLAB Release
MATLAB 6.0 (R12)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video