How to access data with more than 524288 elements?
106 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
hana razak
il 26 Mag 2018
Commentato: Image Analyst
il 14 Gen 2020
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 Commenti
Rik
il 26 Mag 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.
Risposta accettata
Image Analyst
il 26 Mag 2018
Lots wrong with that.
- Don't call your variable image since it's the name of a built in function.
- I have no idea what the badly named "image" is or what the template image is supposed to do.
- You don't extract the image from the cell array, imagecolor{i} into its own variable.
- 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 Commenti
ahmad Al sarairah
il 14 Gen 2020
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?
Image Analyst
il 14 Gen 2020
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;
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!