No License

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

» Watch video

Highlights from
Target Detection

4.3 | 33 ratings Rate this file 39 Downloads (last 30 days) File Size: 2.04 KB File ID: #4446 Version: 1.0
image thumbnail

Target Detection


M M (view profile)


04 Feb 2004 (Updated )

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

| Watch this File

File Information

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

Required Products Image Processing Toolbox
MATLAB release MATLAB 6.0 (R12)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (47)
29 Jan 2015 Keerthi Js

how to give an value for output

Comment only
26 Jul 2014 mahum pervez

can anyone tell me how to extract that detected portion?

Comment only
06 Mar 2014 Navya k

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

07 Feb 2012 Chandra Kurniawan

12 Jul 2011 sahil

sahil (view profile)

08 Jul 2011 sahil

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..

Comment only
04 Jan 2010 Mohamed

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

23 Nov 2009 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;

22 Oct 2009 Raymond Cheng

Thanks for your sharing.

16 Jul 2009 Jun wan

very done,thanks

02 Feb 2009 WTF WTF

22 Jan 2009 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);

Comment only
05 Jan 2009 Alberto Cantillo

20 Dec 2008 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 ....

Comment only
22 Sep 2008 kum jinlong


Comment only
30 Apr 2008 majid chababi

indexed images by color,textur and forme

Comment only
14 Feb 2008 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.

12 Oct 2007 raffaele pappaterra

08 Oct 2007 jingkun guo


Comment only
25 Sep 2007 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.

Comment only
21 Aug 2007 mamadoe86 mamadoe

good work

Comment only
08 Jul 2007 arnold jansen

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

Comment only
04 Jul 2007 ABHAY PRATAP

18 Feb 2007 rajarao chatla

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

14 Feb 2007 hana qudah

15 Jan 2007 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

05 Jan 2007 Harold Odom

26 Sep 2006 Fernando Castro

Very good!!!

06 Apr 2006 siyao fu

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

09 Mar 2006 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?

Comment only
06 Mar 2006 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.

04 Mar 2006 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. (

03 Mar 2006 Siddharth Joshi

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

22 Jan 2006 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).

03 Jan 2006 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?

14 Dec 2005 masoud saadatkhah

29 Aug 2005 Kwok Denis

Super cool!!!!

16 Aug 2005 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

Comment only
25 Feb 2005 yanwan yan

Very good

14 Oct 2004 Abdul Sultan

Nice Work.

06 Oct 2004 Tashfeen Karamat

Good work.

08 Aug 2004 farzad mazaherian

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

Comment only
27 May 2004 abhay kulkarni

well prepare

16 Mar 2004 Shahzad Ahmad

05 Mar 2004 C Dose

Very Well Done!!!

09 Feb 2004 hennesa hennesa

06 Feb 2004 Mina Saleh

Contact us