i got error when i using imwrite function

조회 수: 10 (최근 30일)
suraj singh
suraj singh 2019년 2월 5일
편집: KSSV 2019년 2월 5일
When i run the following code error occured:
Error using imwrite (line 442)
Cannot write signed integer data to a JPEG file.
Error in cnn (line 19)
imwrite( data1, outfile, 'jpg');
data1 is the 512x512 int16.
clc;
clear all;
close all;
dirpath='C:\Users\suraj\Desktop\Tumor\New folder\brainTumorDataPublic_1-766\';
dirpath1='D:\Thesis Work\Thesis Report\jpgdataset\';
type='mat';
type1='jpg';
oldvar = '';
for j=4:9
infile = fullfile(dirpath, sprintf('%d.mat', j));
outfile = fullfile(dirpath1, sprintf('HK%d.jpg', j));
datastruct = load(infile);
fn = fieldnames(datastruct);
firstvar = fn{1};
data = datastruct.(firstvar);
data1 = data.image;
imwrite( data1, outfile);
if ~strcmp(oldvar, firstvar)
fprintf('loading from variable %s as of file %d\n', firstvar);
end
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by