Tracking object in video and plot path of object
조회 수: 3 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
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
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개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Point Cloud Processing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!