MATLAB Answers

0

How to access data with more than 524288 elements?

Asked by hana razak on 26 May 2018
Latest activity Commented on by hana razak on 26 May 2018

Hi,

I've got the problem to access my data. There are 46 cells and each cell contains 480x640x3 uint8.

I cannot display summaries of variables with more than 524288 elements on the workspace.

Please have a look at the attached image since pictures speak louder than words.

I've tried to extract into individual RGB channel but it is not working for all frames. It's only showed the first frame and got an error 'Index exceeds matrix dimensions'.

load('X:\data_depth\cf1','imagecolor');
[a,~]=size(imagecolor{1,1});
image=imread('X:\data\template.png');
counter=1;
for i = 1:length(imagecolor)
    imagesc(imagecolor{i})
    redChannel = i(:, :, 1);
    greenChannel = i(:, :, 2); 
    blueChannel = i(:, :, 3);
      pause(0.1)
      counter = counter + 1;
  end

How to get the variables of 480x640x3 uint8 in each cell?

Help me, please...

Thank you

Regards

Hana

  2 Comments

Why are you incrementing a counter? You have a for-loop that can do that for you. Also, you are using i as you loop counter, but then you are treating it as your image. If you put in i=imagecolor{i}; after your call to imagesc, at least that error should be resolved.
I thought I need the counter to keep it looping. Thanks for pointing that out. i=imagecolor{i};,this really did resolve the error. You help me a lot.
Thank you so much

Sign in to comment.

1 Answers

Answer by Image Analyst
on 26 May 2018
 Accepted Answer

Lots wrong with that.
  1. Don't call your variable image since it's the name of a built in function.
  2. I have no idea what the badly named "image" is or what the template image is supposed to do.
  3. You don't extract the image from the cell array, imagecolor{i} into its own variable.
  4. You are trying to treat the loop index i as if it's an RGB image instead of a simple integer loop index.
You might try something like this:
storedStructure = load('X:\data_depth\cf1','imagecolor');
imagecolor = storedStructure.imagecolor;
% Find out how many images are in the cell array.
numberOfImages = length(imagecolor);
% Read in the template image (for some unknown reason).
templateImage = imread('X:\data\template.png');
for k = 1 : numberOfImages
% Extract this one image from the cell array.
thisImage = imagecolor{k};
imshow(thisImage);
% Extract individual color channels.
redChannel = thisImage(:, :, 1);
greenChannel = thisImage(:, :, 2);
blueChannel = thisImage(:, :, 3);
drawnow;
pause(0.1)
% Now do something with the four image variables.....
end

  3 Comments

Thanks a lot. You really made my day.
You've solved the problem.
I got another question. Is it possible to see numbers behind the image of 480x640x3 uint8 in each cell?
Thank you
Yes, redChannel, greenChannel, and blueChannel are those numbers.
Oh, yes. I found them.
Thank you so much for your time and patience.

Sign in to comment.



Translated by