i got error when i using imwrite function

15 ビュー (過去 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 Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by