No BSD License  

Highlights from
Find centroid of a monochrome laserspot within a dark background

image thumbnail
from Find centroid of a monochrome laserspot within a dark background by Rainer F.
Find centroid of a monochrome laserspot within a dark background using Fourier.

test.m
load('shot.mat');                                                   % loading image
colormap('gray');                                                   % choosing colourmap
image(shot);                                                        % showing image
[py, px] = findcentroidlaserspotusingfourier(shot)                  % calculating centroid
if (isnan(py) == 0) && (isnan(px) == 0)                             % if calculated values are not NaN
    line([px-10; px+10], [py, py], 'color', 'g', 'LineWidth', 1);   % showing haircross
    line([px, px], [py-10, py+10], 'color', 'g', 'LineWidth', 1);
end


Contact us at files@mathworks.com