在OpenCV中等效于MATLAB的caxis [英] Equivalent of MATLAB’s caxis in OpenCV

查看:144
本文介绍了在OpenCV中等效于MATLAB的caxis的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我使用OpenCV库处理灰度图像,并使用MATLAB平台进行处理(效果很好),如下所示:

Recently, I used the OpenCV library to process the gray image, and I used the MATLAB platform to process (it works well), just like this:

imagesc(I), colormap 'Jet',caxis[0 1];%want to show the Pseudocolor picture

如您所见,MATLAB有一个名为caxis的函数,该函数用于缩放伪色轴.

As you see, MATLAB has a function called caxis, which used to scale Pseudocolor axis.

我的问题是,OpenCV中是否有任何功能可以实现MATLAB的caxis功能?或者我应该如何实现该功能?

My question is, are there any functions in OpenCV that can realize the caxis function of MATLAB or how should I realize this function?

推荐答案

您拥有

You have the applyColorMap function. However it's always a mapping for values between 0 and 255, even if all your image's pixels have their value between 20 and 30 (for example).

如果要在最小值和最大值之间应用整个颜色图,则需要一个中间映射以将值规格化"为[0-255]比例.或者,您也可以创建自己的颜色映射,以最小和最大为参数,并相应地创建其完整表.

If you want to apply the whole colormap between your min and max values, you will need to have an intermediary mapping to "normalize" your values to a [0-255] scale. Or you could also create your own Color Map that would take a min and a max as arguments and create its full table accordingly.

这篇关于在OpenCV中等效于MATLAB的caxis的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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