the code is as follows:
in the following image it has 11 rows and 16 columns grayImage http://imageshack.us/photo/my-images/17/tanklb.jpg/
grayImage=rgb2gray(Imread('tank.jpg')); whos grayImage [rows columns numberOfBands]=size(grayImage); blockSizeR = 16;% Rows in block.
blockSizeC = 16; % Columns in block.
wholeBlockRows = floor(rows / blockSizeR); wholeBlockCols = floor(columns / blockSizeC); fprintf('\nSize of whole block is %d %d\n\n',wholeBlockRows,wholeBlockCols); blockNumber=1; for row = 1 : blockSizeR : rows for col = 1 : blockSizeC : columns row1 = row; row2 = row1 + blockSizeR - 1; row2 = min(rows, row2); % Determine starting and ending columns.
col1 = col; col2 = col1 + blockSizeC - 1; col2 = min(columns, col2); % Don't let it go outside the image.
% Extract out the block into a single subimage.
oneBlock = grayImage(row1:row2, col1:col2); glcm=graycomatrix(oneBlock,'NumLevels',16); disp(glcm); subplot(16,16,blockNumber); imshow(oneBlock); caption2 = sprintf('Block #%d\n of %d', blockNumber,256); title(caption2, 'FontSize', fontSize); %drawnow;
blockNumber = blockNumber + 1; end end
i has total of 11 rows and 16 columns i.e 185×256 when i calculate the GLCM
i got the error as
Index exceeds number of subplots.
can u tell me how to solve this error…
which line of code should i add to the above code so that it can work well…
i've to only deal with the size 185×256..i dont want to use the function imresize…
Best Answer