saving images into ImageDatastore

조회 수: 4 (최근 30일)
Robert Eggleston
Robert Eggleston 2019년 9월 13일
댓글: Walter Roberson 2019년 9월 13일
Hello all, I am working with some code where I am tasked with recreating a new imageDatastore in order to retrain a neural network. The entire code is in a for loop and I am having trouble saving a reproduced image to a datastore without it getting overwritten every iteration. I need to save Irec into a datastore so that I can then move to retraning the neural network however I am at a bit of a loss regarding how to do this.
% set negative values to zero and scale reconstructed image
% to integers in range [0,255];
Irec = max(0,Irec);
Irecmax = max(max(Irec));
Irec = 255*Irec/Irecmax;
%Irec = floor(Irec+.5-eps);
subplot(222)
imshow(Irec,[0 255]);
title(['Reconstructed with ' num2str(pview) ' views in [0, ' num2str(thetamax) ']']);
dr = classify(netTransfer,Irec);
xlabel(['Classified as: ' char(dr)]);
subplot(223);
plotrow=14;
plot(Irec(plotrow,:));
title(['Reconstruction: Plot of row ' num2str(plotrow)])
  댓글 수: 1
Walter Roberson
Walter Roberson 2019년 9월 13일
When you go through the image data store, if you use readImage instead of read, then you can be tracking which image you are reading. Use the image number to index into the Files property of the datastore in order to find the source for the current file. fileparts() to extract the directory and base name and extension, and create a modified version of the name, put the parts back together to get an output file name. Now save content to that output file.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by