a video in which I have to get the exact motion of a moving object and calculate the coordinates of that object before and after the movement.
3 次查看(过去 30 天)
显示 更早的评论
回答(2 个)
William Rose
2022-3-29
@Haniye R, if the object is a well defined point in image 1 and image 2, then you can compute the motion in pixel coordinates:
PixelMotion=[px2-px1,py2-py1]
where px1,py1; px2,py2 are the pixel coordinates in images 1 and 2.
If you need motion in physical units such as meters, and if you only have one camera, then you need to make some assumptions and calibrate the image. For example, you assume the object is moving in a plane perpendicular to the camera view axis, and you orient the camera so that this is approximately true. You place a meterstick in the scene at that distance, to calibrate the image. Better yet, two perpendicular meter sticks. Then you can compute how many x pixels equals 1 meter (nx) and how many y pixels equals 1 meter (ny). Use those conversion factors to convert PixelMotion to MeterMotion:
MeterMotion=[(px2-px1)/nx,(py2-py1)/ny]
For motion in 3D, you need at least two, and preferably more, cameras. Calibration is complicated, to put it mildly.
6 个评论
yanqi liu
2022-4-2
yes,sir,may be use image background and frame diff,such as
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/949994/image.jpeg)
then,we can diff background from video,and get
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/949999/image.gif)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!