Find location of 2 black dots in the image

1 次查看(过去 30 天)
Hi,
I have a videfile with around 330 frames in each frame I have 2 dots whose location changes in each frame. How can i find the location(x, y value) of 2 dots in a given frame. See attached frame image.
Thanks,

采纳的回答

Walter Roberson
Walter Roberson 2023-2-6
See regionprops probably with 'Centroid'
  3 个评论
Walter Roberson
Walter Roberson 2023-2-6
filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/1286115/im1.png';
a = imread(filename);
BW = imbinarize(imcomplement(rgb2gray(a)));
BW = bwareafilt(BW, 2);
s = regionprops(BW, 'centroid');
centroids = cat(1, s.Centroid);
image(a);
hold on
scatter(centroids(:,1), centroids(:,2), 'r*')
hold off
The small black marks on the image are the place the time is written.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Segmentation and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by