function f = HaePalikkaHaeKeskipisteet()
I = imread('Palikoita.bmp');
figure, imshow(I), title('Palikka.bmpkuva');
\[x,y,z\] = size(I); hold on % Checkingpitää whetherkuvan thetaustalla picturelisättäessä issiihen colored or
%monochromatic, if colored then converting to gray.
%I=RGB2GRAYkomponentteja
L = bwlabel(I);%numeroi alueet
%BWsOminaisuus2 = edgeregionprops(I, 'sobel', (graythresh(I) * .1));
%figure, imshow(BWs), title('binary gradient mask');
%selvitä strel komennon toiminta
%se90 = strel('line', 3, 90);
%se0 = strel('line', 3, 0);
%BWsdil = imdilate(BWs, \[se90 se0\]);
%figure,
%imshow(BWsdil), title('dilated gradient mask');
%BWdfill = imfill(BWsdil, 'holes');
%figure,
%imshow(BWdfill);
%title('binary image with filled holes');
%BWnobord = imclearborder(BWdfill, 4);
%figure,
%imshow(BWnobord), title('cleared border image');
%seD = strel('diamond',5);
%BWfinal = imerode(BWnobord,seD);
%BWfinal = imerode(BWfinal,seD);
%figure,
%imshow(BWfinal), title('segmented image');
%BWoutline = bwperim(BWfinal);
%imshow(BWoutline), title('kuva ulkoreunoista');
%Segout = I;
%Segout(BWoutline) = 255;
%figure,
hold on
%imshow(Segout), title('outlined original image');
%pic=I
%pic=BWfinal
%\[x,y,z\] = size(pic); % Checking whether the picture is colored or monochromatic, if colored then converting to gray.
%if(z==1)
;
%else
% pic = rgb2gray(pic);
%end
%im = pic;
\[rows,cols\all')
Maara=max(L(:))%hae kpl määrä kuvasta
for i=1:Maara
Keskipiste=Ominaisuus2(i).Centroid
plot(Keskipiste(1),Keskipiste(2),'X')
%plot(Keskipiste,'Z')
end
hold off
|