matlab热度图确定色标_C++实现类似Matlab的colormap Jet(灰度图生成彩色热度图)

该博客介绍了如何在C++中模仿Matlab的colormap Jet功能,将灰度图像转换为彩色的热度图。通过GroundColorMix函数根据灰度值调整RGB颜色,实现从冷色调到暖色调的过渡效果,具体实现包括对每个像素应用不同的颜色映射公式。
摘要由CSDN通过智能技术生成

Matlab使用colormap Jet 可以将灰度图像生成彩色的热度图,灰度值越高,色彩偏向暖色调。相反亦然。

// ColorMap.h

#ifndef COLORMAP_H

#define COLORMAP_H

class colormap

{

public:

static void GroundColorMix(BYTE* color, double x, double min, double max);

static void Convert2Colormap(BYTE* Image, int *imSize);

};

#endif

//ColorMap.cpp

#include "ColorMap.h"

#define BChannel 2

#define GChannel 1

#define RChannel 0

void colormap::GroundColorMix(BYTE* color, double x, double min, double max)

{

double posSlope = (max-min)/60;

double negSlope = (min-max)/60;

if( x < 60 )

{

color[RChannel] = max;

color[GChannel] = posSlope*x+min;

color[BChannel] = min;

return;

}

else if ( x < 120 )

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值