%Ihsan Yalcinkaya - DEU Computer Science Dep. - Turkey %28.03.2005 % Subsamples 2D image(im) (whose gray levels are represented by 8 bits) %to newX and newY by deleting approprite rows and columns. function newim = shrink(imsrc, newX, newY) im = imread(imsrc); [x, y] = size(im); if(newX > x) newX = x; end if(newY > y) newy = y; end cofactorx = floor(x/newX); cofactory = floor(y/newY); newim = im(1:cofactorx:end,1:cofactory:end); imshow(newim);