Analysing the matrix that we get after importing an image in matlab

1 view (last 30 days)
I want to analyse an image in matlab which of the form RGB (700x 600x3) , i need to analyse the all the columns of this image for which I will copy all the columns into a single column and all the rows in a single row . I imported the image and went for the preview but matlab showed an error that is matlab can not display the image because its size is more than 524678 something like this .....So , I broke the main matrix into three pieces R=(:,:1), B(:,:,2) and G(:,:,3) now as I wanted to get all the columns of the matrix together so will it be right to copy the single column of each of the R,G,B into a single column which is what needed .
  1 Comment
Geoff Hayes
Geoff Hayes on 10 Oct 2014
Note that B should be the third dimension of the RGB image
rImg = myImage(:,:,1);
gImg = myImage(:,:,2);
bImg = myImage(:,:,3);
What kind of analysis are you doing on each column (and on each row) that you need to create a "super" column of all the column data?

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 10 Oct 2014
That display size warning is harmless - ignore it. You can turn it off with this code:
% http://www.mathworks.com/help/matlab/matlab_prog/suppress-warnings.html
function TurnOffWarnings
try
% To set the warning state, you must first know the message identifier for the one warning you want to enable.
% Query the last warning to acquire the identifier. For example:
% warnStruct = warning('query', 'last')
% messageID = warnStruct.identifier
% messageID =
% MATLAB:concatenation:integerInteraction
% Turn off this warning "Warning: Image is too big to fit on screen; displaying at 33% "
warning('off', 'Images:initSize:adjustingMag');
% Get rid of warning about directory already existing:
% "Warning: Directory already exists."
warning('off', 'MATLAB:MKDIR:DirectoryExists');
% Turn off note "Warning: Added specified worksheet." that appears in the command window.
warning('off', 'MATLAB:xlswrite:AddSheet');
% Get rid of warning about roipolyold being deprecated:
% "Warning: Function ROIPOLYOLD will be removed in the future. Use ROIPOLY instead"
warning('off', 'images:removing:function');
% Get rid of warning about wavread() being deprecated:
% "Warning: WAVREAD will be removed in a future release. Use AUDIOREAD instead."
warning('off', 'MATLAB:audiovideo:wavread:functionToBeRemoved');
catch ME
errorMessage = sprintf('Error in function %s() at line %d.\n\nError Message:\n%s', ...
ME.stack(1).name, ME.stack(1).line, ME.message);
fprintf(1, '%s\n', errorMessage);
WarnUser(errorMessage);
end
return; % from TurnOffWarnings
Like Geoff I'm also wondering what kind of algorithmm requires you to do such a thing. Why not post your image and tell us what you want to measure?

Community Treasure Hunt

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

Start Hunting!