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,
0 个评论
采纳的回答
Walter Roberson
2023-2-6
3 个评论
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 Center 和 File Exchange 中查找有关 Image Segmentation and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!