How to find centroid of moving object in a video?

23 次查看(过去 30 天)
Hello, I am tryng to find velocity of a moving ball using Histogram tracking method, where I am able to track the ball successfully. Now I want to find the velocity of the moving ball, to do that first I have to find the centroids of the ball. So when I use function regionprops() it traces centroids of entire Frame, where as I only want to find the centroids of the ball which is been tracked. And after that I want to calculate the velocity of the same ball which is been tracked.
So how do I mark the centroid of only one object in entire frame?
  2 个评论
KALYAN ACHARJYA
KALYAN ACHARJYA 2020-1-3
As you already extracted the frame by frame, then see this answer, might be helpful.
BHAVIN JOISAR
BHAVIN JOISAR 2020-1-4
Hello Sir, I tried many ways in which I can only detect the centroid of the tracked object , I have even used some of the methods which are discussed in the link you shared. But again I am getting centroids of entire frame.
Can you suggest any function or method using which I can only get centroids of the tracked object.
I even tried using opticalFlow to avoid finding centroids, but I cannot get the velocity of the moving object which is my final task.

请先登录,再进行评论。

采纳的回答

Image Analyst
Image Analyst 2020-1-4
编辑:Image Analyst 2020-1-4
You need to segment your objects in the frame first. Then call regionprops() to get the centroid of each blob. If blobs enter or exit the scene, or overlap each other, then you'll have to have special code to handle those situations. See my Image Segmentation Tutorial and attached demo.
  11 个评论
Image Analyst
Image Analyst 2021-1-17
Save all the images to memory or disk, then use montage() or imtile().
Start your own question if you still have trouble, rather than here in BHAVIN's question where he'll continue to get emails about activity on his thread.
MD MOSTAKIM ALAM SOHAG
Dear sir, As i am new in matlab, could you provide me the full code. it will be vry help full for me .

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Computer Vision with Simulink 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by