自动围绕零值构建颜色图 [英] Automatic construction of a colormap around the value zero

查看:63
本文介绍了自动围绕零值构建颜色图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常想绘制一个差异图像,其范围从负数到正数.问题在于,matlab的色彩图仅从最小值缩放到最大值,而不关心某个中间值(在这种情况下为零).例如,我生成的peaks图像具有一个不同的单个像素:

I often want to plot a difference image that ranges from some negative number to some positive one. The issue with that is that matlab's colormaps scale only from the min value to the max value but do not care about some middle value (this case zero). For example, I have produced the peaks image with a single pixel different:

原始图片如下:

所以零值在顶部图像是蓝色,在底部图像是绿色...(以喷射彩色图为例)

So zero values are blue at the top image and green at the bottom... (using jet colormap as an example)

我想构建一个颜色图,无论最小值\最大值是多少,它都会自动将零值表示为相同的颜色.我该怎么办?

I'd like to built a colormap that will automatically represent zero values as the same color no matter what will be the min\max values. How can I do that?

推荐答案

您可以使用此工具(来自FEX).它生成蓝白红颜色图,零始终对应于白色.对于您要包括两种以上颜色的情况,请深入研究

you can use this tool from the FEX. It generates blue-white-red colormap, with zero always corresponds to white color. For the case you want to include more than two colors, dig into the code and adapt it to your needs.

FEX中还有其他一些选项可以做类似的事情(这是一个另一个)...

There are a few more options in the FEX that do similar things (here's one, and another one)...

这篇关于自动围绕零值构建颜色图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆