Use imwrite to save tif images
Mostra commenti meno recenti
I want to save a 3 color image as a lossless tif image. When i tried
imwrite(image,'test.tif','Mode','lossless')
I got an error message. Is there any way to save an image as a lossless tif? Thank you.
Risposta accettata
Più risposte (1)
Image Analyst
il 3 Ott 2018
Yes. Do NOT call your image variable image since that is the name of a built in function. Try
imwrite(yourImage,'test.tif');
6 Commenti
Puja Bharti
il 5 Ott 2018
if I save the enhanced image then using imshow(NSS_Img,[]) I get the same enhanced image. But if I use imshow(NSS_Img) the image is not the saved enhanced image. Please help. Actually, I want to enhance image X and save it and then crop a small portion from the saved enhanced image. But, the values of NSS_img and the image after saving is not same. my code is given below:
X = imread(imfile(image).name);
filename = imfile(image).name;
full_file = fullfile('C:\Users\Puja Bharti\Desktop\matlab\',filename);
[pathname, name, ext] = fileparts(full_file);
s1 = 'En';
s2 = filename;
s = strcat(s1,s2);
new_name = fullfile(pathname, s)
if size(X,3)==3
X = rgb2gray(X);
end
grayImage= im2double(X);
figure('Name','Original image'), imshow(grayImage)
NSS_img = NSS(grayImage); %NSS_img is enhanced image
whos NSS_img
figure('Name','final image'), imshow(NSS_img,[])
imwrite(NSS_img,new_name,'png','Mode','lossless');
Image Analyst
il 5 Ott 2018
What is NSS? And why are you using a double array as a linear index to NSS? I doubt that will work? And why are you casting to double()?
To "enhance", try using imadjust().
To crop, try using imcrop().
Angela
il 5 Ott 2018
Puja Bharti
il 5 Ott 2018
Thank you Image Analyst, NSS is the enhancement code I have made. It uses a filter which needs im2double() as input and output is also im2double(). The Image get enhanced with my code NSS(), image is shown correctly with imshow(NSS_img,[]). But I have to store this enhanced image and then use it for my future use (Region of interest segmentation). While using imwrite() enhanced image get saved but the if i open the saved enhanced image, then its not the same which i saved. Please help.
Guillaume
il 5 Ott 2018
@Puja Bharti, are your comments in any way related to Angela question or did you just try to highjack somebody's else question? If so, then please start your own question.
Puja Bharti
il 5 Ott 2018
Sorry Guillaume and Angela. I had no such intensions. I just want the solution to my problem. Please help me at:
https://in.mathworks.com/matlabcentral/answers/422212-enhanced-image-is-not-getting-saved-as-it-values-get-changed-after-imwrite
Categorie
Scopri di più su Convert Image Type in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!