Opencv4.0学习记录(Day9 OpenCV自带颜色表操作)

OpenCV自带颜色表操作

由于我使用的是opencv4.0版本所以有几种颜色表是无法使用的,所以被我注释掉啦。

void QuickDemo::color_style_demo(Mat &image) {
	int colormap[] = {
		COLORMAP_AUTUMN ,
		COLORMAP_BONE,
		//COLORMAP_CIVIDIS,
		//COLORMAP_DEEPGREEN,
		COLORMAP_HOT,
		COLORMAP_HSV,
		//COLORMAP_INFERNO,
		COLORMAP_JET,
		//COLORMAP_MAGMA,
		COLORMAP_OCEAN,
		COLORMAP_PINK,
		COLORMAP_PARULA,
		COLORMAP_RAINBOW,
		COLORMAP_SPRING,
		//COLORMAP_TWILIGHT,
		//COLORMAP_TURBO,
		//COLORMAP_TWILIGHT,
		//COLORMAP_VIRIDIS,
		//COLORMAP_TWILIGHT_SHIFTED,
		COLORMAP_WINTER
	};

	Mat dst;
	int index = 0;
	while (true)
	{
		char c = waitKey(1000);//停顿100ms 做视频处理都是1
		if (c == 27) { //esc 退出应用程序
			break;
		}
		if (c == 49)//key#1 按下按键1时,保存图片到指定位置
		{
			std::cout << "you enter key #1" << std::endl;
			imwrite("D:/gray.jpg", dst);
		}
		applyColorMap(image, dst, colormap[index % 10]);//循环展示11种图片
		index++;
		imshow("循环播放", dst);
	}
}

你可能感兴趣的:(Opencv,opencv)