Tracking object in video and plot path of object

Hello,
I have one video and in that video i am tracking a car's particular one point through the video and i got success in that one
but i want to plot that (point on a car) point's path at a same on video. How can i do that??
Please help me
thank you in adavance

 Accepted Answer

Extract a frame, find the car and add it's (x,y) coordinate to a growing list of them, then call "hold on" and plot the entire list of (x,y) coordinates on the frame. Here's a start
% Open up the VideoReader for reading an input video file.
inputVideoReaderObject = VideoReader(inputFullFileName)
% Determine how many frames there are.
numberOfFrames = inputVideoReaderObject.NumberOfFrames;
% Prepare a figure to show the images.
figure;
% screenSize = get(0, 'ScreenSize');
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
% Loop through the movie, writing all frames out.
allX = zeros(1, numberOfFrames);
allY = zeros(1, numberOfFrames);
for frame = 1 : numberOfFrames
% Extract the frame from the movie structure.
thisFrame = read(inputVideoReaderObject, frame); % Get the next frame in the video.
imshow(thisFrame);
[x,y] = FindCar(thisFrame); % however you do it...
allX(frameIndex) = x;
allY(frameIndex) = y;
plot(allX, allY, 'r.-', 'LineWidth', 2, 'MarkerSize', 25);
end
See several assorted, attached movie demos.

4 Comments

Can You help me in one more thing...
I want to locate car wheels through hough circle in video.
For that i convert video into edge only video but it's not working.
can you help me in that case, moreover i want to locate only one car wheels. in video 2 more car passing through it.
so i want to ignor those car wheel and just track one car wheel.
Thnak YOu...
I can't help that much (would take too much of my time). But I can just say to try imfindcircles() which uses hough.
That is a custom function that @MA khan or you write to find cars. That was not my concern - you can use whatever code you want to find the car(s) and return their location(s). My concern was what the poster asked and that was how to plot the one point he says he successfully got somehow. Perhaps if @MA khan sees this he can tell you how he got the location of the car, but personally I don't know or have that code.

Sign in to comment.

More Answers (0)

Categories

Find more on Image Processing and Computer Vision in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!