Is it possible to plot a spectrogram of a wav file in just red color?

조회 수: 4 (최근 30일)
I know how to plot a spectrogram in different formats like jet, grayscale hsv etc. But I was wondering if its possible to plot a spectrogram of a wav file in just red colour or in green colour or in blue colour.
I have attached a screenshot to show an example. I made this by saving the original spectrogram in png format and converting it into Red, green and blue colour using usual image processing technique.
  댓글 수: 2
KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 8월 6일
Can you share the wav file and conversion code?
sangeet sagar
sangeet sagar 2018년 8월 6일
You can take any wav file and plot its spectrogram. After plotting the spectrogram save the file as .png format. like:
h=imagesc(t,f,S_log);
colormap('jet');
saveas(h,'spectro.png');
I did this using STFT. Now write:
img = imread('spectro.png'); % Read image
red = img(:,:,1); % Red channel
red=imshow(just_red);

댓글을 달려면 로그인하십시오.

채택된 답변

Adam Danz
Adam Danz 2018년 8월 6일
편집: Adam Danz 2018년 8월 6일
Couldn't you just create your own colormap that varies along one RGB column while the other two columns have a constant color such as black? Here's an example using the red axis.
colorMap = [linspace(0,1,256)', zeros(256,2)]
colormap(colorMap);
  댓글 수: 9
Adam Danz
Adam Danz 2018년 8월 6일
편집: Adam Danz 2018년 8월 6일
Oh, I see. So your ytick values aren't the same as your yticklabels (which always worries me a little). Glad you worked it out!
sangeet sagar
sangeet sagar 2018년 8월 8일
편집: sangeet sagar 2018년 8월 8일
Yes exactly. YtickLabels denote what you wish to label on the ytick which denotes the location. I manually found out the location.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Red에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by