Saving a grayscale image with scaled values
Afficher commentaires plus anciens
Hello, here is my problem:
I have a 196*196 image, and such matrix looks like that for example:

using imshow("img",[]) displays the image correctly because it's scaled, while not using it produces something like that:

I want to save the correct output that should looke like this:

But I can't find the correct parameters for imwrite...
Also I have to say that Im running it with a loop, and planning later on to do image processing, with batch processor and registration and etc.
6 commentaires
KALYAN ACHARJYA
le 8 Nov 2022
Pls attach the image/data, so that we can try on it.
"while not using it produces something like that:" - Please avoid to explain, what you do not do, but mention, what you do to get this image.
Did you try to scale the data by your own?
img = rand(1, 10)
tmp = min(img(:));
img = (img - tmp) / (max(img(:)) - tmp)
Zinoviy
le 8 Nov 2022
Jan
le 8 Nov 2022
folder = "directory"
for i = 1:100
% Scale the image:
img = fisp1(:,:,1,i);
tmp = min(img(:));
img = (img - tmp) / (max(img(:)) - tmp);
% Save the file:
name = fullfile(folder, sprintf('rep%d.png', i));
imwrite(img, name);
end
Zinoviy
le 8 Nov 2022
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Introduction to Installation and Licensing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!