颜色的三要素:色调,饱和度,和亮度 HSI/HSV

  1. 1
  2. 颜色 要素 色调 饱和度 亮度
  3. The3 colour directories : hue , saturation , and brightness .
  4. 同时使用色调饱和度亮度组合情况这些区域定义

    Each of these regions is definable using a combination of hue, saturation and luminance values simultaneously.

    Provided by gtcom

  5. 可以更改色调饱和度亮度透明度流动比例其他许多方面

    You can change color hue, saturation, lightness, opacity, fluidity scale, and many more aspects.

    www.ibm.com

  6. 背景视频包括像素每个像素表示色调饱和度亮度hsl

    The background video is comprised of pixels, each of which represents a value of hue, saturation and luminance ( hsl).

    Provided by gtcom

  7. 这种颜色空间示例使用者更有直观意义hsl色调饱和度亮度空间

    An example of one such color space is the hsl ( h ue, saturation, luminance) space, which is more intuitively meaningful to the user.

    Provided by gtcom

  8. 本文提出基于色调饱和度亮度联合概率分布彩色图象分割方法

    In this paper, we propose a new color image segmentation method, which bases on union probability density of hue, light and saturation.

    dict.cnki.net

  9. 本文快速HSI色调饱和度亮度变换空间基础采用利用移动网格动态窗口技术结合算法进行目标识别达到预期效果

    Based on rapid HSI transform space, a target identification algorithm is adopted, which combined a mobile grid and dynamic window technology.

    www.fabiao.net

  10. 纹理图象探讨基于色调饱和度亮度联合概率分布彩色图象分割方法

    To non-texture images, a new color image segmentation method is proposed in this chapter, which based on union probability density of hue, light and saturation.

    dict.cnki.net

  11. 图像RGB转换色调饱和度亮度色调饱和度结合产生融合图像消除地表天空背景影响

    The color image was translated from RGB system to HSI system, and the hue, lightness and saturation images were acquired. In order to eliminate the influence of background of soil and sky, the hue and saturation data was combined and produced fusion image.

    dict.cnki.net

  12. 由于RGB空间利用亮度信息较少利用颜色信息并且空间分量高度相关人类视觉倾向色调饱和度亮度共同描述彩色物体一致适合边缘检测任务

    RGB color space using only the brightness information and less use of color information, and the space three components are highly correlated, human vision prefers to use hue, saturation and brightness to describe the color object is inconsistent, not suitable for edge detection task.

    www.fabiao.net

  13. 本文通过HSI空间色调饱和度进行合理划分图像色调饱和度亮度进行匹配加权给出根据局部累积直方图计算图片相似具体算法

    Through experiment, we provide a concrete color image retrieval algorithm, which divides the hue and saturation in HSI color space, uses matching algorithm to two pictures and calculates similar amount.

    dict.cnki.net

  14. 本文介绍适用PAL制式电视终端模拟实时装置装置色调饱和度亮度彩色图象进行分解显示显示背景适当处理

    A real time analogue apparatus is presented, which can be suitable for terminals of PAL television system and can segment-display color images with appropriate background by hue, saturation and brightness.

    dict.cnki.net

  15. 本文提出系统评价思路方案整体外观表现颜色多少分布特征均匀程度颜色要素色调饱和度亮度结合成因进行讨论

    A systemic way is suggested for appraisement, from the appearance to the 3 elements of color, i.e. from the amount, distributing, uniformity to the tone, saturation, brightness, and include the causing of color.

    dict.cnki.net

  16. 图形背景除了色调不同饱和度亮度应有区别如果可能尽量避免彩色背景运用彩色文本

    Objects and background should vary in brightness or saturation, in addition to hue, and color text on color backgrounds should also be avoided when possible.

    Provided by gtcom

  17. 亮度饱和度大于各自阈值颜色色调饱和度代表忽略不同亮度影响

    Otherwise color is represented by its hue and saturation, thus the influence of intensity is ignored.

    dict.cnki.net

  18. 研究四诊客观采用数码采集计算机图像软件PHOTOSHOP60分别计算RGB数值然后换算色调H饱和度S亮度V进行分析

    To objectify the Chinese medical diagnosis, the RGB values of hind paws were calculated by Photoshop 6.0 and converted into hue, saturation and luminance, and contrasted with paw color.

    dict.cnki.net

  19. 结果表明样品色调主要集中绿色其中3样品饱和度亮度最高色调

    The result shows that the color tone of the broken films mainly focuses on green. The saturation and brightness of sample No. 3 is the highest, but its color tone is somewhat yellow.

    dict.cnki.net

  20. 色调饱和度投影直方图反映颜色空间分布亮度投影直方图体现图像形状

    The projective histograms of hue and saturation discribe the color distribution in space, and the projective histogram of intensity reflects the shape of the image.

    dict.cnki.net

  21. 对于给定色调具有包括颜色空间集中饱和度亮度范围进行加宽效果

    This would have the effect, for a given hue, of widening the ranges of saturation and luminance that are to be included in the subset of the color space.

    Provided by gtcom

  22. 通过球体彩色图像亮度色调饱和度分布特征分析发现球体图像颜色失真主要颜色亮度分量有关色调饱和度分量关系不大

    After analyzing the distribution characteristics of brightness, hue and saturation of ball images, it was found that the image color distortion was only related to brightness, but hue and saturation of images.

    dict.cnki.net

openCv RGB到HSV空间的学习


标签: opencvRGBHSV
556人阅读 评论(0) 收藏 举报
本文章已收录于:


分类:


这次我主要说说颜色空间,包括三个方面:RGB颜色空间,HSV颜色空间以及颜色空间的转换


RGB颜色空间介绍:


1:RGB颜色空间简介



         三基色原理:大多数的颜色可以通过红、绿、蓝<数学中基的概念>三色按照不同的比例合成产生,同样绝大多数单色光也可以分解成红绿蓝三种色光


         红绿蓝三基色按照不同的比例相加合成混色称为相加混色。其中一些混色的规律有:


                   红色+绿色 = 黄色


                   绿色+蓝色 = 青色


                   红色+蓝色 = 品红


                   红色+绿色+蓝色 = 白色


                   红色+青色 = 白色


                   绿色+品红 = 白色


                   蓝色+黄色 = 白色


2:互补光的定义:


         当两种光按照适当比例混合得到白光时,称这两种光为互补光。所以上述的混色规律我们可以得到青色、黄色、品红分别是红色、蓝色、绿色的补色。


 


3:亮度的定义:


         单色光的亮度强度各不相同,根据人的感受是:绿光最高,红光次之,蓝光最弱,假设得到的白光的强度为100%。如果用Y表示景物的亮度,则通常有:


                   Y= 0.299R + 0.587G + 0.114B


因为红﹑绿﹑蓝三基色能够合成自然界所有的色彩,因此在电子设备和软件中,经常使用红绿蓝三基色合成五颜六色的图像。用以上的相加混色所表示的颜色模式成为RGB模式


注意:


1:CvLoadImage(“”,0)所得到的图像即为灰度单通道图像,所对应的像素即为Y;而与split函数得到的单通道图像R,G,B不一样,但其亮度显示也是按照下图的直线来显示的<即为RGB空间的直线>


2:三通道图像也可能是灰度图像,当三通道值相等时,所对应的三通道图像就是灰度图像<可以通过以下程序画出来>。即RGB space空间中(0,0,0)和(1,1,1)两线上所有点就是灰度图像—>三通道图不一定是彩色的,彩色图一定是三通道的



3:单通道图像亮度显示也是通过下图来显示的



得到上图的代码为:


  1. #include <iostream>  
  2. #include "cv.h"  
  3. #include "highgui.h"  
  4. #include "cxcore.h"  
  5. using namespace std;  
  6. int main()  
  7. {  
  8.     IplImage *dst = cvCreateImage(cvSize(255, 255), 8, 3);  
  9.     for(int y = dst->height - 1; y >= 0; y--)  
  10.     {  
  11.         cvSet2D(dst, y,  dst->height - y - 1, cvScalar(255-y, 255-y, 255-y));  
  12.     }  
  13.     cvNamedWindow("show");  
  14.     cvShowImage("show", dst);  
  15.     cvWaitKey(0);  
  16.     cvReleaseImage(&dst);  
  17.     cvDestroyWindow("show");  
  18.     return 0;  
  19. }  
#include <iostream>
#include "cv.h"
#include "highgui.h"
#include "cxcore.h"
using namespace std;
int main()
{
	IplImage *dst = cvCreateImage(cvSize(255, 255), 8, 3);
	for(int y = dst->height - 1; y >= 0; y--)
	{
		cvSet2D(dst, y,  dst->height - y - 1, cvScalar(255-y, 255-y, 255-y));
	}
	cvNamedWindow("show");
	cvShowImage("show", dst);
	cvWaitKey(0);
	cvReleaseImage(&dst);
	cvDestroyWindow("show");
	return 0;
}





HSV颜色空间



H:色调 0°对应红色, 120°对应绿色, 240°对应蓝色---对应不同的颜色 取值范围0~360


S:饱和度  比若说:红色的纯度,越白纯度越低,取值范围0~1


V:亮度  比如你穿了一件红色衣服 在白天亮度较高(0~255之间)傍晚或者黄昏就比较低(0~255之间)即多少的光照上去反射出来被看见,取值范围0~255


如图:


颜色空间的转换


用到的核心函数有: cvConvertScale, cvSplit, cvMerge, cvCvtColor


需要注意的是:由于加载进来图像是uchar,最多只能是255,而opencv正常程序的结构显示H色调都会小于等于180<因为程序知道表示不了360,直接全部缩小到180>,而H色调的取值范围0~360,因此我们需要将图像转换成float类型,而cvConvertScale 可以实现放大缩小偏移同时可以做类型转换;之后我们可以将hsv各通道转换到0~255之间,使用到的函数仍然是cvConvertScale 。最后需要注意的一点是:CvShowImage显示的图像都会被当做RGB颜色空间的图像来处理.


下面给出这之间范围变化的代码:


1:没有考虑H(色调)范围的代码,此时H的范围只能在0~180之间。


代码:



  1. #include <iostream>  
  2. #include "cv.h"  
  3. #include "highgui.h"  
  4. #include "cxcore.h"  
  5.   
  6. using namespace std;  
  7.   
  8. int main()  
  9. {  
  10.     IplImage *src = cvLoadImage("F:\\tongtong.jpg", 1);  
  11.     IplImage *hsv_img = cvCreateImage(cvGetSize(src), 8 , 3);  
  12.     IplImage *h_img = cvCreateImage(cvGetSize(src), 8, 1);  
  13.     IplImage *s_img = cvCreateImage(cvGetSize(src), 8, 1);  
  14.     IplImage *v_img = cvCreateImage(cvGetSize(src), 8, 1);  
  15.   
  16.     cvCvtColor(src, hsv_img, CV_BGR2HSV);  
  17.     cvSplit(hsv_img, h_img, s_img, v_img, NULL);  
  18.     for(int y = 0; y < hsv_img->height; y++){  
  19.         for(int x = 0; x < hsv_img->width; x++)  
  20.         {  
  21.             cout << cvGetReal2D(h_img, y, x) << " ";  
  22.         }  
  23.         cout << endl;  
  24.     }  
  25.     cvNamedWindow("src", 0);  
  26.     cvShowImage("src", hsv_img);  
  27.     cvWaitKey(0);  
  28.     cvReleaseImage(&src);  
  29.     cvDestroyWindow("src");  
  30.     return 0;  
  31. }  
#include <iostream>
#include "cv.h"
#include "highgui.h"
#include "cxcore.h"

using namespace std;

int main()
{
	IplImage *src = cvLoadImage("F:\\tongtong.jpg", 1);
	IplImage *hsv_img = cvCreateImage(cvGetSize(src), 8 , 3);
	IplImage *h_img = cvCreateImage(cvGetSize(src), 8, 1);
	IplImage *s_img = cvCreateImage(cvGetSize(src), 8, 1);
	IplImage *v_img = cvCreateImage(cvGetSize(src), 8, 1);

	cvCvtColor(src, hsv_img, CV_BGR2HSV);
	cvSplit(hsv_img, h_img, s_img, v_img, NULL);
	for(int y = 0; y < hsv_img->height; y++){
		for(int x = 0; x < hsv_img->width; x++)
		{
			cout << cvGetReal2D(h_img, y, x) << " ";
		}
		cout << endl;
	}
	cvNamedWindow("src", 0);
	cvShowImage("src", hsv_img);
	cvWaitKey(0);
	cvReleaseImage(&src);
	cvDestroyWindow("src");
	return 0;
}


2:将色调H的取值范围转换到0~360之间



  1. #include <iostream>  
  2. #include "cv.h"  
  3. #include "highgui.h"  
  4. #include "cxcore.h"  
  5.   
  6. using namespace std;  
  7.   
  8. int main()  
  9. {  
  10.     IplImage *src = cvLoadImage("F:\\tongtong.jpg", 1);  
  11.     IplImage *src_float = cvCreateImage(cvGetSize(src),IPL_DEPTH_32F, 3);  
  12.     <span style="color: rgb(255, 0, 0);">cvConvertScale(src, src_float, 1.0, 0.0);  
  13.     IplImage *hsv_img = cvCreateImage(cvGetSize(src), IPL_DEPTH_32F , 3);  
  14.     IplImage *h_img = cvCreateImage(cvGetSize(src), IPL_DEPTH_32F, 1);  
  15.     IplImage *s_img = cvCreateImage(cvGetSize(src), IPL_DEPTH_32F, 1);  
  16.     IplImage *v_img = cvCreateImage(cvGetSize(src), IPL_DEPTH_32F, 1);  
  17. </span>  
  18.     cvCvtColor(src_float, hsv_img, CV_BGR2HSV);  
  19.     cvSplit(hsv_img, h_img, s_img, v_img, NULL);  
  20.     for(int y = 0; y < hsv_img->height; y++){  
  21.         for(int x = 0; x < hsv_img->width; x++)  
  22.         {  
  23.             cout << cvGetReal2D(h_img, y, x) << " ";  
  24.         }  
  25.         cout << endl;  
  26.     }  
  27.     cvNamedWindow("src", 0);  
  28.     cvShowImage("src", hsv_img);  
  29.     cvWaitKey(0);  
  30.     cvReleaseImage(&src);  
  31.     cvDestroyWindow("src");  
  32.     return 0;  
  33. }  
#include <iostream>
#include "cv.h"
#include "highgui.h"
#include "cxcore.h"

using namespace std;

int main()
{
	IplImage *src = cvLoadImage("F:\\tongtong.jpg", 1);
	IplImage *src_float = cvCreateImage(cvGetSize(src),IPL_DEPTH_32F, 3);
	<span style="color: rgb(255, 0, 0);">cvConvertScale(src, src_float, 1.0, 0.0);
	IplImage *hsv_img = cvCreateImage(cvGetSize(src), IPL_DEPTH_32F , 3);
	IplImage *h_img = cvCreateImage(cvGetSize(src), IPL_DEPTH_32F, 1);
	IplImage *s_img = cvCreateImage(cvGetSize(src), IPL_DEPTH_32F, 1);
	IplImage *v_img = cvCreateImage(cvGetSize(src), IPL_DEPTH_32F, 1);
</span>
	cvCvtColor(src_float, hsv_img, CV_BGR2HSV);
	cvSplit(hsv_img, h_img, s_img, v_img, NULL);
	for(int y = 0; y < hsv_img->height; y++){
		for(int x = 0; x < hsv_img->width; x++)
		{
			cout << cvGetReal2D(h_img, y, x) << " ";
		}
		cout << endl;
	}
	cvNamedWindow("src", 0);
	cvShowImage("src", hsv_img);
	cvWaitKey(0);
	cvReleaseImage(&src);
	cvDestroyWindow("src");
	return 0;
}

3:将H,S,V的范围转化到0~255之间


  1. #include <iostream>  
  2. #include "cv.h"  
  3. #include "highgui.h"  
  4. #include "cxcore.h"  
  5.   
  6. using namespace std;  
  7.   
  8. int main()  
  9. {  
  10.     IplImage *src = cvLoadImage("F:\\tongtong.jpg", 1);  
  11.     IplImage *src_float = cvCreateImage(cvGetSize(src),IPL_DEPTH_32F, 3);  
  12.     cvConvertScale(src, src_float, 1.0, 0.0);  
  13.     IplImage *hsv_img = cvCreateImage(cvGetSize(src), IPL_DEPTH_32F , 3);  
  14.     IplImage *h_img = cvCreateImage(cvGetSize(src), IPL_DEPTH_32F, 1);  
  15.     IplImage *s_img = cvCreateImage(cvGetSize(src), IPL_DEPTH_32F, 1);  
  16.     IplImage *v_img = cvCreateImage(cvGetSize(src), IPL_DEPTH_32F, 1);  
  17. <span style="color: rgb(255, 0, 0);">  
  18.     IplImage *h = cvCreateImage(cvGetSize(src), 8, 1);  
  19.     IplImage *s = cvCreateImage(cvGetSize(src), 8, 1);  
  20.     IplImage *v = cvCreateImage(cvGetSize(src), 8, 1);  
  21.   
  22.     cvCvtColor(src_float, hsv_img, CV_BGR2HSV);  
  23.     cvSplit(hsv_img, h_img, s_img, v_img, NULL);  
  24.     cvConvertScale(h_img, h, (1.0/360)*255, 0.0);  
  25.     cvConvertScale(s_img, s, 255.0, 0.0);  // 因为S的取值范围为0~1  
  26.     cvConvertScale(v_img, v, 1.0, 0.0);</span>  
  27.     for(int y = 0; y < hsv_img->height; y++){  
  28.         for(int x = 0; x < hsv_img->width; x++)  
  29.         {  
  30.             if(cvGetReal2D(h, y, x) > 200)cout << cvGetReal2D(h, y, x) << " ";  
  31.         }  
  32.         cout << endl;  
  33.     }  
  34.     cvNamedWindow("src", 0);  
  35.     cvShowImage("src", hsv_img);  
  36.     cvWaitKey(0);  
  37.     cvReleaseImage(&src);  
  38.     cvDestroyWindow("src");  
  39.     return 0;  
  40.   
  41. }  


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值