Filter löschen
Filter löschen

Find location of 2 black dots in the image

1 Ansicht (letzte 30 Tage)
Ankit Gupta
Ankit Gupta am 6 Feb. 2023
Kommentiert: Ankit Gupta am 6 Feb. 2023
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,

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 6 Feb. 2023
See regionprops probably with 'Centroid'
  3 Kommentare
Walter Roberson
Walter Roberson am 6 Feb. 2023
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.
Ankit Gupta
Ankit Gupta am 6 Feb. 2023
thanks a lot, this was helpful.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by