How to access data with more than 524288 elements?
조회 수: 100 (최근 30일)
이전 댓글 표시
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
Rik
2018년 5월 26일
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.
채택된 답변
Image Analyst
2018년 5월 26일
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
ahmad Al sarairah
2020년 1월 14일
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
2020년 1월 14일
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;
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!