Trying to determine locations of markers in image
Ältere Kommentare anzeigen
I'm trying to obtain the pixel coordinates of the dot pattern image data that is stored in the attached file; I'm using this image to spatially calibrate my camera image. Is there a way to automate the detection of these dots? Thanks in advance for any guidance.
5 Kommentare
What 'markers' are you referring to?
% type('CalImage_Grayscale.txt')
A = readmatrix('CalImage_Grayscale.txt');
figure
surfc(A, EdgeColor='none')
colormap(turbo)
view(65,45)
title('Surface Plot')
colorbar
figure
contourf(A)
colormap(turbo)
grid
title('''contourf'' Plot')
figure
imshow(A)
title('''imshow Plot')
figure
surf(A, EdgeColor='none')
colormap(turbo)
view(0,90)
axis('tight')
title('Surface Plot (Top View)')
colorbar
.
fid = fopen('CalImage_Grayscale.txt','r');
data = textscan(fid,'');
fclose(fid);
data = cell2mat(data);
imagesc(data)
Walter Roberson
am 18 Jul. 2025
Is the projection unequal? That is, is the distance between dots on (say) the lower left corner different from the distance between dots (say) near the upper right corner? If the distances are always the same, then you only need to locate a small number of dots in order to calculate the distance between pixels. If the distances are not always the same but the change is linear, then you only need to calculate based on a small number of locations. If, however, the projection is non-linear then the task becomes more difficult.
MBP
am 18 Jul. 2025
Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 21 Jul. 2025
0 Stimmen
I recommend you use the code in the other answer to get the "cleanMask" binary image above. Then use regionprops to get the centroids, or weighted centroids, of the dots. The contour and looping stuff is overly complicated and not needed, when regionprops gives you the centroids directly (but it requires the Image Processing Toolbox).
Then for the next step needed for calibration you can use kmeans to get the mean rows and columns of each linear series of dot. If the image is tilted, you might then use that to get the angle of tile and then use imrotate to square it up with the image edges. Then you can sum the binary image vertically and horizontally with sum() to get a 1-D horizontal or vertical profile. Then you can use regionprops to get the row and column numbers of each line of dots. Knowing that you can complete your calibration in terms of millimeters (or whatever) per pixel.
Kategorien
Mehr zu Image Arithmetic finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!











