【发布时间】:2014-05-20 10:36:26
【问题描述】:
我有一个倒立摆视频here,时长为 33 秒。目标是在钟摆的移动矩形部分的中心绘制一个红点,并沿着黑棒绘制一条线,计算每帧的角度。
我已经逐帧处理了视频。然后我使用了Object Detection In A Cluttered Scene Using Point Feature Matching。如果我可以访问匹配点的索引,然后我可以轻松计算角度,那就太好了。
我认为我可以得到移动矩形部分的区域并在下一帧中寻找相似的区域。但是这个解决方案似乎太本地化了。
我不知道该应用哪些技术。
clear all;
clc;
hVideoFileReader = vision.VideoFileReader;
hVideoPlayer = vision.VideoPlayer;
hVideoFileReader.Filename = 'inverted-pendulum.avi';
hVideoFileReader.VideoOutputDataType = 'single';
while ~isDone(hVideoFileReader)
grayFrame = rgb2gray(step(hVideoFileReader));
frame = step(hVideoFileReader);
if isFirstFrame
part = grayFrame(202:266,202:282); % #moving part's region
isFirstFrame = false;
subplot(1,2,1);
imshow(part);
end
partPoints = detectSURFFeatures(part);
grayFramePoints = detectSURFFeatures(grayFrame);
hold on;
subplot(1,2,1), plot(partPoints .selectStrongest(10));
subplot(1,2,2), imshow(grayFrame);
subplot(1,2,2), plot(grayFramePoints .selectStrongest(20));
frame2 = pointPendulumCenter(frame);
frame3 = plotLineAlongStick(frame2);
step(hVideoPlayer, frame3);
hold off;
end
release(hVideoFileReader);
release(hVideoPlayer);
%% #Function to find the moving part's center point and plot a red dot on it.
function f = pointPendulumCenter(frame)
end
%% #Function to plot a red line along the stick after calculating the angle of it.
function f = plotLineAlongStick(frame)
end
【问题讨论】:
-
据我所知,您发布的代码只是读取视频并运行
findCenterofRectangle(frame)和plotLineAlongStick(frame)。如果您可以添加一个 mcve 来显示(可能有两个图像)您已经走了多远,那就太好了。您应该发布这些功能的代码。您提供的代码不会增加太多价值。此外,添加一些人们可以使用的静态图像,添加一些其他图像,例如手绘以准确显示您想要实现的目标。我认为你需要缩小你的问题范围,因为它目前相当广泛。
标签: matlab image-processing matlab-cvst