Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Code Block
function f = HaePalikka()
I = imread('Palikoita.bmp');
figure, imshow(I), title('Palikka.bmp');
hold on
[rows,cols] = size(I)
 
x = ones(rows,1)*\[1:cols\];    % MatrixMatriisi x with each pixel set to its x coordinate
y = \[1:rows\]'*ones(1,cols);   %   "     "     "    "    "  "   "  y    "
 
area = sum(sum(I));
meanx = sum(sum(double(I).*x))/area
meany = sum(sum(double(I).*y))/area
%Segout=Segout  
imshow(I), title('kuva ja keskipiste'),;
plot(meanx,meany,'X')
hold off