I have saved 10000 spectrograms as .jpeg images, in my hard drive, using the default "PARULA" colrmap. I want to change all of them to "AUTUMN" colormap. Is there any way to do that, without redrawing the spectrograms from audio from the scratch?

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 17 Sep. 2022

0 Stimmen

Use rgb2ind specifying the parabula map. Then ind2rgb that using the other color map.

5 Kommentare

Sania Gul
Sania Gul am 17 Sep. 2022
Bearbeitet: Walter Roberson am 17 Sep. 2022
Tnk u so much.
I am doing it, but getting this error.
A=imread(fullfile(SourceFolder1,filenames1(count).name));
B=rgb2ind(A,'parula');
Error using rgb2ind
Expected MAP to be one of these types:
double, single, uint8, uint16, uint32, uint64, int8, int16, int32, int64
in_cmap = parula;
out_cmap = autumn;
A = imread(fullfile(SourceFolder1,filenames1(count).name));
B = rgb2ind(A, in_cmap);
C = ind2rgb(B, out_cmap);
Tnk u so much. Its working perfectly fine now.
Wait, wait, wait. All matrix value of A were laying between 0 to 255 in RGB plane, but the values of C are in range [0:1]. and diplayed as
Although the summer map displays perfectly, but I want it to be stored in range [0:255]. When I did
C=255*ind2rgb(B,out_cmap);
and display it by imshow(C), the result transformed to
in_cmap = parula;
out_cmap = autumn;
A = imread(fullfile(SourceFolder1,filenames1(count).name));
B = rgb2ind(A, in_cmap);
C = im2uint8(ind2rgb(B, out_cmap)) ;

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by