How to Save image using imwrite?

4 views (last 30 days)
HG24
HG24 on 4 Jun 2019
Answered: KSSV on 4 Jun 2019
I1 = imread('DiseasedBW.tif') ;
I2 =imread('HealthyBW.tif') ;
I3 = imshow([I2, I2, I2; I2, I1, I2; I2, I2, I2]);
imwrite(I3,'Middisease.tif');
% Error using imwrite (line 442)
% Expected DATA to be one of these types:
% numeric, logical
% Instead its type was matlab.graphics.primitive.Image.
I want to save the following image from the above code using imwrite however keeps displaying this error. What is going wrong and how do I solve this?

Accepted Answer

KSSV
KSSV on 4 Jun 2019
I1 = imread('DiseasedBW.tif') ;
I2 =imread('HealthyBW.tif') ;
I3 = [I2, I2, I2; I2, I1, I2; I2, I2, I2];
imwrite(I3,'Middisease.tif');

More Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!