how to load .mat file as image

4 ビュー (過去 30 日間)
divya balu
divya balu 2019 年 2 月 28 日
コメント済み: divya balu 2019 年 2 月 28 日
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

採用された回答

KSSV
KSSV 2019 年 2 月 28 日
load test.mat ;
n = length(result) ;
for i = 1:n
imshow(result{i}) ;
end
Read about Cell in matlab.
  4 件のコメント
divya balu
divya balu 2019 年 2 月 28 日
i need to process as the image like getting height, width, and depth
divya balu
divya balu 2019 年 2 月 28 日
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

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by