필터 지우기
필터 지우기

To Find The Centroid Of Images Using Matlab

조회 수: 2 (최근 30일)
Pranjal Pathak
Pranjal Pathak 2012년 9월 9일
Hi, Below I am placing my code where I need some help to proceed further.
fx = 3.5:3.5:56; fy = 2; a=128; b=128; c=512;
[x1,y1]=meshgrid(-1:2/511:+1,-1:2/511:+1); circ1=sqrt(x1.^1+y1.^1)<1;
% Aberration z8=sqrt(8).*(3.*x1.^3+3.*x1.*y1.^2-2.*x1);
[x,y] = meshgrid(-1:2/127:+1,-1:2/127:+1); circ=sqrt(x.^2+y.^2)<1; for j1 = numel(fx):-1:1 h{j1} = circ.*cos(pi*(x*fx(j1) + y*fy)); end
M = cell(c/a); M(:) = h; M = cell2mat(M');
%Fourier Transform Before Adding Aberration z1=fftshift(fft2(M,512,512)); q1=abs(z1);
figure(1) imagesc(q1); colormap gray; axis image; axis off title('Focal Spots Without Aberration');
%Fourier Transform After Adding Aberration N=exp(sqrt(-1).*(M+z8)); z2=fftshift(fft2(N,512,512)); q2=abs(z2);
figure(2) imagesc(q2); colormap gray; axis image; axis off title('Focal Spots With Aberration'); %%%%%%%%%%%%%%%%% In the above code, two figures are obtained:fig(1) & fig(2). I need to find the centroid of those white spots(crop the image to consider only the lower row of 16 white spots) in both the figures separately. It will really be a great help for me if anyone helps me out in this regard.
Thanking You!

답변 (1개)

Image Analyst
Image Analyst 2012년 9월 9일
You code doesn't run. What is q1?
You can see how to get centroids from regions in an image (your row of "white spots") by looking at my BlobsDemo image segmentation tutorial: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by