Apply colormap to a library of iamges

1 次查看(过去 30 天)
Is there a way to apply a specific colormap to a set of images?
I have lots of greyscale images (92) in my directory. Have tried lots of things but can't seem to apply one map to the entire set.
I can only achieve it by doing them separately. e.g.:
A = imread("1698_gs_histeq.jpg");
imshow(A)
colormap ("winter")
Thanks!
  2 个评论
jlouise2022
jlouise2022 2022-7-7
I can only get that to work with a single image, not the entire set. I'm trying to write a function/for loop so that the colormap is applied to all 92 and they are saved in the directory.

请先登录,再进行评论。

采纳的回答

jlouise2022
jlouise2022 2022-7-7
Nevermind, fixed it.
If anyone has the same issue, here is my code:
for k = 1:numel(filenames)
filename = filenames(k).name;
equalHist = imread(filename);
[~,name,~] = fileparts(filename);
gsFilename = sprintf('%s_autumn.jpg', name);
imwrite(equalHist, colormap(autumn), gsFilename);
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Blue 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by