Saving a grayscale image with scaled values
Mostrar comentarios más antiguos
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 comentarios
KALYAN ACHARJYA
el 8 de Nov. de 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
el 8 de Nov. de 2022
Jan
el 8 de Nov. de 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
el 8 de Nov. de 2022
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Introduction to Installation and Licensing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!