how to load .mat file as image

4 Ansichten (letzte 30 Tage)
divya balu
divya balu am 28 Feb. 2019
Kommentiert: divya balu am 28 Feb. 2019
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

Akzeptierte Antwort

KSSV
KSSV am 28 Feb. 2019
load test.mat ;
n = length(result) ;
for i = 1:n
imshow(result{i}) ;
end
Read about Cell in matlab.
  4 Kommentare
divya balu
divya balu am 28 Feb. 2019
i need to process as the image like getting height, width, and depth
divya balu
divya balu am 28 Feb. 2019
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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Convert Image Type finden Sie in Help Center und File Exchange

Produkte


Version

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by