How to access data with more than 524288 elements?

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 comentarios

Rik
Rik el 26 de Mayo de 2018
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.
hana razak
hana razak el 26 de Mayo de 2018
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

Iniciar sesión para comentar.

 Respuesta aceptada

Image Analyst
Image Analyst el 26 de Mayo de 2018
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

5 comentarios

hana razak
hana razak el 26 de Mayo de 2018
Editada: hana razak el 26 de Mayo de 2018
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
Image Analyst
Image Analyst el 26 de Mayo de 2018
Yes, redChannel, greenChannel, and blueChannel are those numbers.
hana razak
hana razak el 26 de Mayo de 2018
Oh, yes. I found them.
Thank you so much for your time and patience.
what do you mean by :
storedStructure = load('X:\data_depth\cf1','imagecolor');
how can i change this sentence to apply it on my computer ?
is this path or not?
storedStructure is a structure that has fields for every one of the variables you saved with the save() function. The first argument is the full file name of your .mat file. The second argument is what variable you want to pull out. If you want all variables in the .mat file, then don't include a second argument.
fullFileName = 'C:/users/ahmad/pictures/whatever.mat'; % Your .mat file.
% Read all the variables in.
% They will be put into fields of a structure variable.
storedStructure = load(fullFileName);
% Now get your variable(s) from the structure.
myVar1 = storedStructure.myVar1;
myVar2 = storedStructure.myVar2;

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Preguntada:

el 26 de Mayo de 2018

Comentada:

el 14 de En. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by