I want generate a random image using matlab which contains the object to be detected and the clutter images at random locations. I then want to detect this randomly generated object under the clutter images and outline the object based on the objects shape. I tried to look for code on mathworks but all I could find was to detect an object and draw a rectangular box around the detected object. What I want to do is to detect the object and draw the outline of the detected object.
Can anyone suggest me how to do this. Thanks
You may want to take a look at "Marching Squares" Algorithm. A well documented example is located here: http://devblog.phillipspiess.com/2010/02/23/better-know-an-algorithm-1-marching-squares/
The coordinates you obtain from the algorithm can then again be used as coordinates on where to place the contour pixels in another image.
Unfortunately, I cannot provide you with any Matlab-Code (just ported it to Fortran), but given the discussion of the algorithm, it should be straightforward to implement it.
Some advice from my experience in using the "Marching Squares":
edit: Have you seen isocontour in MatlabCentral? http://www.mathworks.com/matlabcentral/fileexcahange/30525-isocontour