Hi Payal,
I think we're getting somewhere. =) Thanks for the image.
Questions:
1) Are you looking to segment out different cars? That is, do you want each car to have its own contour? With your current thresholding, you can see that the four cars on the right are all connected, so you would get a single contour of the whole blob, rather than a contour of each car.
2) I just saw the
doc for bwboundaries. Do you want the interior holes of the objects to have its own contour, or do you want just a contour *around* each object and don't care about the interior? Also, do you care about parent/child object relationships? My guess is no to both these questions. For example, do you want a contour around the windshield of each car?
Comments:
Note that when you do rgb2gray on a thresholded RGB image, you no longer have a binary image, but a grayscale image with levels 0, 0.333, 0.667, and 1.0. I think you probably mean to do rgb2gray followed by threshold.
Either way, my suspicion is that you want to segment the cars first (get one binary blob object per car), then find their contours. Am I right?
Juan.