how to load .mat file as image

i have a .mat file which was formed from image. i need to reload the image from .mat file. i have attached the data avaliable in my mat file as pic.i need to load images as sequence and process it. please help me to do this. thanks in advance

 Accepted Answer

load test.mat ;
n = length(result) ;
for i = 1:n
imshow(result{i}) ;
end
Read about Cell in matlab.

4 Comments

how can i use imread function in this
YOu need not tp use imread........already data is stored in matrices.
i need to process as the image like getting height, width, and depth
this is my code. instead of the coded portion i need to get data from .mat file
myFolder = 'G:\cnn work\matlab\New folder\train';
filePattern1 = fullfile(myFolder, '*.jpg');
jpegFiles1 = dir(filePattern1);
length(jpegFiles1)
result1 = cell(1,100);
for k = 1:length(jpegFiles1)
baseFileName1 = jpegFiles1(k).name;
fullFileName1 = fullfile(myFolder, baseFileName1);
%fprintf(1, 'Now reading %s\n', fullFileName1);
img= imread(fullFileName1);
%imshow(im);
%size(im);
im= double(img)./255;
[h, w, d] = size(im);
% initialize cnn
cnn.namaste{k}=1; % just intiationg cnn object
cnn=initcnn(cnn,[h w d]);
cnn=cnnAddConvLayer(cnn, 10, [3 3], 'rect');
cnn=cnnAddPoolLayer(cnn, 2, 'mean');
cnn=cnnAddConvLayer(cnn, 20, [3 3], 'tanh');
cnn=cnnAddPoolLayer(cnn, 2, 'mean');
cnn=cnnAddFCLayer(cnn,150, 'tanh' ); %add fully connected layer
cnn=cnnAddFCLayer(cnn,10, 'sigm' ); %add fully connected layer % last layer no of nodes = no of lables
no_of_epochs = 1;
batch_size=50;
display 'training started...Wait for ~200 seconds...'
tic
cnn=traincnn(cnn,im,train_y, no_of_epochs,batch_size);
toc
display '...training finished.'
end

Sign in to comment.

More Answers (0)

Categories

Products

Release

R2016b

Asked:

on 28 Feb 2019

Commented:

on 28 Feb 2019

Community Treasure Hunt

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

Start Hunting!