Tracking object in video and plot path of object

16 ビュー (過去 30 日間)
MA khan
MA khan 2019 年 12 月 6 日
コメント済み: Image Analyst 2021 年 11 月 15 日
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

採用された回答

Image Analyst
Image Analyst 2019 年 12 月 7 日
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 件のコメント
Nadine Shawky
Nadine Shawky 2021 年 11 月 15 日
What is FindCar?
Image Analyst
Image Analyst 2021 年 11 月 15 日
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.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by