1
$\begingroup$

I am new to matlab and computer vision. I used the code given in the link to detect cars. But the problem is the shadow is also being detected and tracked. Can anyone tell me how to modify the code so that only car are detected. Link:http://in.mathworks.com/help/vision/examples/detecting-cars-using-gaussian-mixture-models.html Thanks in advance

$\endgroup$
  • $\begingroup$ Welcome to DSP.SE! Please rephrase your question to ask about the algorithm you would use to fix the problem. THAT is a signal processing question. The way you have posed the question may belong more about code, which belongs on Stack Overflow. I'm voting to close until this is reworded. $\endgroup$ – Peter K. Mar 5 '15 at 22:45
2
$\begingroup$

What I would try is to :

  1. Get the HSL (Hue Saturation Lightness) decomposition of the original picture
  2. Only keep the L component
  3. Multiply the image you have from the last steps with the image you get after the morphological operation (the black and white one, after deleting the noise)
  4. Do some thresholding on that
  5. Use what you obtained from that instead of the image after the morphological operation for the following part of the algorithm.

I don't know well Matlab so I can't provide function names, but I guess you can find it easily with a bit of googling. And please keep me updated if you try this, I would like to know if it works well or not.

| improve this answer | |
$\endgroup$
0
$\begingroup$

In the example you've cited you feed RGB frames into vision.ForegroundDetector. To get rid of shadows you can try converting the frame into a color space that separates luma from chroma, using rgb2ycbcr or rgb2hsv. Then you can feed only the chroma components, cb and cr, or H and S respectively into vision.ForegroundDetector. The downside of this approach is that you will not be able to detect gray objects. So you will probably not detect wheels and windows of the cars, and you may lose the entire car if it is not colorful.

| improve this answer | |
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.