hsv

关于汽车颜色识别

我的未来我决定 提交于 2020-01-20 06:44:44
#1,首先说说我自己做的一个小程序 有参考CSDN中的一篇博客,具体文章链接找不到了。 主要思想:将RGB颜色空间中的图像转换到HSV空间,根据常见九种颜色的H、S、V范围来判断给定图像中的汽车最大概率属于哪种色系的车。 常见颜色的HSV范围:(也是参考的网上的为主) 程序接口:【输入】Mat类型,汽车图片的patch;【输出】string类型,上面九种颜色中的一种; 算法流程图: #2,存在的问题 可能原因:我个人觉得,HSV空间中的值与实际肉眼中的颜色并不是线性的映射关系,所以单纯用一个线性范围来给出一中颜色的HSV值是有问题的,实验结果也验证了我这个猜想。很多车子在进去检测时都会有误,如下给出几种: 尽管代码有问题,但还是在此贴出,以备之后改进: /*********************************** ----------------------------------- Name: sophia Date: 20161206 Email: hxinwen1218@sina.com ----------------------------------- Function: Reco Identification the color of the cars. ************************************/ #include

物体跟踪

与世无争的帅哥 提交于 2020-01-16 06:24:55
用到的函数: np.array()创建数组 cv.cvtColor()转换颜色空间 参数: 图像名字 格式 cv.inRange() 参数: 原图像名字 HSV最低值,低于此值HSV值变成0 HSV最高值,高于此值HSV值变成0(在中间HSV值变成255) import cv2 as cv import numpy as np img = cv.imread("D://opencv_test//test_a.jpg") img_hsv = cv.cvtColor(img, cv.COLOR_BGR2HSV)#颜色空间转换成HSV low_black = np.array([156, 43, 46]) up_black = np.array([180, 255, 255])#注意是HSV值,各颜色范围去查 mask = cv.inRange(img_hsv, low_black, up_black) img_add = cv.add(img, 0, mask=mask) cv.imshow("win", mask) cv.imshow("win_1", img) cv.imshow("win_2", img_add) cv.waitKey(0) cv.destroyAllWindows() HSV颜色分量范围 一般对颜色空间的图像进行有效处理都是在HSV空间进行的

Why isn't inRange function detecting blue color when I have given it the entire possible Hue range for the blue color?

早过忘川 提交于 2020-01-07 08:46:51
问题 On the website colorizer.org, they have an HSV range of H=0-360, S=0-100, V=0-100. We are also aware that the HSV range in OpenCV is H=0-180, S=0-255, V=0-255. I wanted to select a range for any shade of (what we perceive as) blue color, so I looked at colorizer.org, and saw that blue Hue ranges roughly from 170 to 270. So I scaled this Hue range to OpenCV by dividing by 2, which gives 85-135. Now, I took the following screenshot of color [H=216, S=96, V=67] from the preview at the website

adding/mixing colors in HSV Space

坚强是说给别人听的谎言 提交于 2020-01-02 02:55:29
问题 I've been trying to get a visualisation going for a few days. I'm generating a diffraction image and want to color it depending on the wavelength of light. The easiest way to get the right color was by using the HSV space with H varying with the wavelength and S,V set to 1.0 Alas, I can't find a formula/algorithm/way to mix different colors in the HSV space. Is there a formula for mixing in HSV or maybe another comprehensible way? 回答1: Honestly, I'd convert the RGB, average the components and

Given a finite palette, how to sort from Hot to Cold, i.e. Diverging

試著忘記壹切 提交于 2020-01-01 04:44:06
问题 Update (Original question below) Issue is partially solved. Still trying to figure out how to extend to other color combinations If I use this code hLIM <- rgb2hsv(col2rgb('#8000ff'))['h', ] sLIM <- rgb2hsv(col2rgb('#8000ff'))['s', ] vLIM <- rgb2hsv(col2rgb('#8000ff'))['v', ] rankorder <- order((hLIM-tHSVcol[,1] + (hLIM < tHSVcol[,1])), (sLIM-tHSVcol[,2] + (sLIM < tHSVcol[,2])), (vLIM-tHSVcol[,3] + (vLIM < tHSVcol[,3]))) orderType <- "HSV Ordering" I am able to sort this Unsorted Color

Converting image using matlab / octave from rgb to hsv back to rgb

北城以北 提交于 2019-12-31 05:43:45
问题 I'm trying to convert a color image from rgb to hsv (make changes) then back to rgb. As a test I made this code just to test how to go from rgb to hsv back to rgb but when I view the image it just shows up as black. What am I missing? *PS I'm using octave 3.8.1 which works like matlab Here are the octave 3.8.1 packages I have loaded: >>> pkg list Package Name | Version | Installation directory --------------+---------+----------------------- control *| 2.6.2 | /usr/share/octave/packages

Read HSV value of pixel in opencv

心已入冬 提交于 2019-12-31 04:13:06
问题 how would you go about reading the pixel value in HSV format rather than RGB? The code below reads the pixel value of the circles' centers in RGB format. Is there much difference when it comes to reading value in HSV? int main(int argc, char** argv) { //load image from directory IplImage* img = cvLoadImage("C:\\Users\\Nathan\\Desktop\\SnookerPic.png"); IplImage* gray = cvCreateImage(cvGetSize(img), IPL_DEPTH_8U, 1); CvMemStorage* storage = cvCreateMemStorage(0); //covert to grayscale

Why does greyscale work the way it does?

若如初见. 提交于 2019-12-30 01:43:29
问题 My original question I read that to convert a RGB pixel into greyscale RGB, one should use r_new = g_new = b_new = r_old * 0.3 + g_old * 0.59 + b_old * 0.11 I also read, and understand, that g has a higher weighting because the human eye is more sensitive to green. Implementing that, I saw the results were the same as I would get from setting an image to 'greyscale' in an image editor like the Gimp. Before I read this, I imagined that to convert a pixel to greyscale, one would convert it to

Skin detection in the CIELab and HSV color space

左心房为你撑大大i 提交于 2019-12-24 01:24:19
问题 I've seen CIELab and HSV suggested a few times here on stackoverflow, but I haven't been able to find any values corresponding to skin. What are good values to look for when doing skin detection in the CIELab and HSV color spaces? For example in RGB I've seen this: R > 95 AND G > 40 AND B > 20 AND max{R, G, B} – min{R, G, B} >15 AND |R – G| > 15 AND R > G AND R > B OR R > 220 AND G > 210 AND B > 170 AND |R – G| <= 15 AND R > B AND G > B Are there similar expressions for CIELab and HSV? 回答1:

Increase Yellow Saturation only in RGB or HSV Image (Matlab)

老子叫甜甜 提交于 2019-12-23 05:26:06
问题 I have an image. I want to selectively increase the saturation of yellow in the image to max. How is this done in the RGB or HSV image space? Thanks. 回答1: This needs to be done in HSV (Hue Saturation Value) color space. If you have the image in HSV, it is very easy (else convert it to HSV). The H is the only variable that gives color information, and if you check the wikipedia page of Shades of Yellow, you'll notice they are all are between 45 to 60 deg. So take you HSV image, select the H in