A black and white filter for Matlab figures

Creating grayscale images from Matlab figures can be a big pain because you have to scale your colormaps and color limits just right so that the gray colormap picks up all the details. I've realized that Photoshop is very, very good for doing this. You load in an image and use the black and white filter, and then change the levels of reds, greens, blues, etc.
I think it would be extremely useful to have a function that one can call that takes in the same inputs as Photoshop requires. This function might be of the form
function bwfilter(h, C)
where C is a matrix that takes in the input of red, green, cyan, etc. percentages, and h is a figure handle. Upon running the function, the figure is converted to black and white and either kept as Matlab's .fig format, or if not possible, exported as a png, pdf, etc. perhaps using the excellent export_fig function by Oliver Woodford.
I'm not sure how to go about this. Can someone advise? Of course, if anybody wants to step to the challenge...

댓글 수: 4

P Velani
P Velani 2022년 12월 15일
Any update on this?
DGM
DGM 2022년 12월 15일
편집: DGM 2022년 12월 15일
I have this question noted in my potential list of things to write for MIMT, but it's not a priority, and I'm not really sure how I'd even do it if I were to answer the original question as asked. I don't have Photoshop, so I can't reverse-engineer the particular means by which PS decomposes the image. I would have no way of knowing whether any solution is equivalent.
That said, it's likely that your needs are not exactly those of the OP. So what exactly are your needs? There are other color adjustment tools or techniques which might work for you, but might not work for the original question.
millercommamatt
millercommamatt 2022년 12월 15일
편집: Walter Roberson 2022년 12월 15일
Where does the cmap2gray function fall short for you?
DGM
DGM 2022년 12월 15일
cmap2gray() does the same thing as rgb2gray() and im2gray(). It's a simple fixed BT601 luma conversion.

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Blue에 대해 자세히 알아보기

질문:

2013년 4월 18일

편집:

2022년 12월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by