1
$\begingroup$

enter image description here I need to track an object in a video with MATLAB. There is an example frame from the video above. I need to track that car that carries the pendulum. But my problem is there is a bar behind the car that has similar color to the car. So I can not just apply img2bw with certain threshold to find the car.

What can I do to isolate it? Since it is my homework I am not asking for a complete code. I want your advice.

$\endgroup$
1
$\begingroup$

I think I can come up with two suggestion to address this problem.

  • First (simple)

You can simply use HSV color space, and try to find right thresholds. It seems in HSV colour space, the car is pretty distinguishable from the background but the rail is the problem now.

I=imread ( your image );
J=rgb2hsv(I);
imshow(0.1<J(:,:,2) & J(:,:,2)<0.2 & 0.2<J(:,:,1) & J(:,:,1)<0.54,[]);
  • Second (a bit more complex)

Since your background is presumably static, you can remove background and the remaining would be your car (and of course the rod). I suggest to use optical flow for this purpose.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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