当前位置:网站首页>Opencv has its own color operation
Opencv has its own color operation
2022-07-24 17:08:00 【When will we get ashore?】
The sample code is as follows :
void demo::color_style(Mat& image)
{
int colormap[] = {
COLORMAP_AUTUMN,
COLORMAP_BONE,
COLORMAP_CIVIDIS,
COLORMAP_COOL,
COLORMAP_HOT,
COLORMAP_HSV,
COLORMAP_INFERNO,
COLORMAP_JET,
COLORMAP_MAGMA,
COLORMAP_OCEAN,
COLORMAP_PARULA,
COLORMAP_PINK,
COLORMAP_PLASMA,
COLORMAP_RAINBOW,
COLORMAP_SPRING,
COLORMAP_SUMMER,
COLORMAP_TWILIGHT,
COLORMAP_TWILIGHT_SHIFTED,
COLORMAP_VIRIDIS,
COLORMAP_WINTER};
Mat dsc;
int index = 0;
while (true)
{
int c = waitKey(500);
if (c == 27)
break;
applyColorMap(image, dsc, colormap[index % 20]);
index++;
imshow(" Image type ", dsc);}
}
Here's the point applyColorMap() function , It states in imgproc.hpp
CV_EXPORTS_W void applyColorMap(InputArray src, OutputArray dst, int colormap);
In front of the definition of this function above , We can also see the following :
enum ColormapTypes
{
COLORMAP_AUTUMN = 0, //!< 
COLORMAP_BONE = 1, //!< 
COLORMAP_JET = 2, //!< 
COLORMAP_WINTER = 3, //!< 
COLORMAP_RAINBOW = 4, //!< 
COLORMAP_OCEAN = 5, //!< 
COLORMAP_SUMMER = 6, //!< 
COLORMAP_SPRING = 7, //!< 
COLORMAP_COOL = 8, //!< 
COLORMAP_HSV = 9, //!< 
COLORMAP_PINK = 10, //!< 
COLORMAP_HOT = 11, //!< 
COLORMAP_PARULA = 12, //!< 
COLORMAP_MAGMA = 13, //!< 
COLORMAP_INFERNO = 14, //!< 
COLORMAP_PLASMA = 15, //!< 
COLORMAP_VIRIDIS = 16, //!< 
COLORMAP_CIVIDIS = 17, //!< 
COLORMAP_TWILIGHT = 18, //!< 
COLORMAP_TWILIGHT_SHIFTED = 19 //!< 
};
It can be found in the definition colormap( Chromaticity diagram ) When , Enumeration used , So we can define a int Type to store 20 Kind of colormap.
The index of the array is from 0 At the beginning , So it is index%20, If it is index%21 You're going to report a mistake .
applyColormap() The first parameter of the function is the input image , The second parameter is the output image , The third parameter is the provided color map code value .( Namely colormap Enumeration type in )
applyColorMap() Function has another use :
CV_EXPORTS_W void applyColorMap(InputArray src, OutputArray dst, InputArray userColor);
userColor: Custom colors (CV_8UC1 or CV_8UC3 and size 256).
Result display :

over!!!
边栏推荐
- GDB online debugging of work notes
- Buffer overflow vulnerability lab experiment record
- 剑指 Offer 25. 合并两个排序的链表
- C font usage effect
- MySQL basic commands
- 一个实际使用SwiftUI 4.0中ViewThatFits自适应视图的例子
- I'll teach you how to use NPs to build intranet penetration services. When you go out, you can easily connect your lightweight notebook to your home game console to play remotely
- Xxx.pro learning in QT
- Parental delegation mechanism
- Live review | wonderful playback of Apache pulsar meetup (including PPT download)
猜你喜欢

Transformer structure analysis -- learning notes
![[matlab]: basic knowledge learning](/img/8c/d13597e402c55df6cbd5e008aef0a5.png)
[matlab]: basic knowledge learning

Live review | wonderful playback of Apache pulsar meetup (including PPT download)

Xxx.pro learning in QT

自定义类型:枚举

【GNN报告】腾讯AI lab 徐挺洋:图生成模型及其在分子生成中的应用

JVM class loading subsystem

调整图像亮度的滚动条演示实验
![Why can't sizeof (ARR) / size (arr[0]) be used to calculate the array length inside the called function?](/img/e6/1d2213f3eb9bd0ff537a66d2b01f98.png)
Why can't sizeof (ARR) / size (arr[0]) be used to calculate the array length inside the called function?

通道的分离与合并
随机推荐
Notebook computer purchase guide (specific brand and model are not recommended)
Internet Download Manager配置
EF miscellaneous
Want to make sandbox games? Then you must not miss this plug-in (unity3d)
MODIS data WGet Download
How to effectively avoid memory leakage when customizing the handler?
JS, call in the for loop is asynchronously converted to synchronous execution
2022年最新浙江建筑安全员模拟题库及答案
PS pull out logo
JS to implement a promise of promises/a+ specification
AI opportunities for operators: expand new tracks with large models
Delay and jitter in network
Template method mode
IP第十三天笔记
Summary of ROS master-slave communication experience
调整图像亮度的滚动条演示实验
Small end format and big end format (little endian & big endian)
[sequential logic circuit] - counter
[matlab]: basic knowledge learning
MySQL basic commands