Saving a grayscale image with scaled values
Ältere Kommentare anzeigen
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 Kommentare
KALYAN ACHARJYA
am 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
am 8 Nov. 2022
Jan
am 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
am 8 Nov. 2022
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Introduction to Installation and Licensing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!