hsv

HSV colour space and CvInRangeS function

与世无争的帅哥 提交于 2019-12-21 21:42:58
问题 cvInRangeS(imgHSV, cvScalar(15, 234, 120), cvScalar(21, 234, 120), imgThreshed); I am wondering what each parameter in the cvScalar function represents. I thought it would be HSV but it doesnt seem to be thresholding the desired color. Could someone explain the parameters a bit clearer? 回答1: It means H - Hue, S - Saturation, V - Value take a look in here for understanding each one of those: http://en.wikipedia.org/wiki/HSL_and_HSV the color is mainly defined in the Hue component. There is a

Why is color segmentation easier on HSV?

☆樱花仙子☆ 提交于 2019-12-21 20:33:08
问题 I've heard that if you need to do a color segmentation on your software (create a binary image from a colored image by setting pixels to 1 if they meet certain threshold rules like R<100, G>100, 10< B < 123) it is better to first convert your image to HSV. Is this really true? And why? 回答1: The big reason is that it separates color information (chroma) from intensity or lighting (luma). Because value is separated, you can construct a histogram or thresholding rules using only saturation and

tracking multiple objects by color OpenCV 2.x

試著忘記壹切 提交于 2019-12-21 02:45:07
问题 Currently i am trying to track multiple objects by color. I've based on documentation code. import cv2 import numpy as np cap = cv2.VideoCapture(0) while(1): # Take each frame _, frame = cap.read() # Convert BGR to HSV hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) # define range of blue color in HSV lower_blue = np.array([110,50,50]) upper_blue = np.array([130,255,255]) # Threshold the HSV image to get only blue colors mask = cv2.inRange(hsv, lower_blue, upper_blue) # Bitwise-AND mask and

Exact Skin color HSV range

 ̄綄美尐妖づ 提交于 2019-12-20 09:45:16
问题 I have seen all questions on SO for range of HSV color space for skin But I can only figure out this Code - CvScalar hsv_min = cvScalar(0, 30, 60, 0); CvScalar hsv_max = cvScalar(20, 150, 255, 0); //range I am using is { 0,30,60,0 & 20,150,255,0 } cvCvtColor(src, hsv_image, CV_BGR2HSV); cvInRangeS (hsv_image, hsv_min, hsv_max, hsv_mask); cvDilate(hsv_mask,hsv_mask,0,1); cvErode(hsv_mask,hsv_mask,0,1); cvSmooth( hsv_mask, hsv_mask, CV_MEDIAN); Problem with this range ( { 0,30,60,0 & 20,150,255

Convert HSV to grayscale in OpenCV

被刻印的时光 ゝ 提交于 2019-12-18 17:25:41
问题 I'm newbie in OpenCV. I'm learning Segmentation by Watershed algorithm and i have a problem. I have to convert image color to image grayscale for using Watershed. When I use color space BGR, no problem but with space HSV, i'm not sure that the code belows is correct. Mat im = imread("./Image/118035.jpg", CV_LOAD_IMAGE_COLOR); Mat imHSV; cvtColor(im, imHSV, CV_BGR2HSV); imshow("HSV", imHSV); cvtColor(imHSV, imHSV, CV_BGR2GRAY); imshow("HSV to gray", imHSV); imshow("BGR", im); cvtColor(im, im,

Separate hsv channels in opencv

醉酒当歌 提交于 2019-12-18 09:41:32
问题 I am having an hsv mat file in opencv and I want to separate the channels. I found cvSplit( hsv, h, s, v, NULL ), but it doesn't work with Mat files. How is it then, to keep just the first channel h of from the Mat image file?? My result is the above. Basically is the image that I convert, I can see the face but in weird tones. The code used: cvtColor(cropped_rgb, cropped_hsv, CV_BGR2HSV); split(cropped_hsv, channels); cropped_hsv = channels[0]; imshow("cropped_hsv", cropped_hsv); 回答1: You

Should I use HSV/HSB or RGB and why?

时间秒杀一切 提交于 2019-12-18 06:55:34
问题 I have to detect leukocytes cells in an image that contains another blood cells, but the differences can be distinguished through the color of cells, leukocytes have more dense purple color, can be seen in the image below. What color methode I've to use RGB/HSV ? and why ?! sample image: 回答1: Usually when making decisions like this I just quickly plot the different channels and color spaces and see what I find. It is always better to start with a high quality image than to start with a low

Finding red color in image using Python & OpenCV

旧巷老猫 提交于 2019-12-17 22:23:16
问题 I am trying to extract red color from an image. I have code that applies threshold to leave only values from specified range: img=cv2.imread('img.bmp') img_hsv=cv2.cvtColor(img, cv2.COLOR_BGR2HSV) lower_red = np.array([0,50,50]) #example value upper_red = np.array([10,255,255]) #example value mask = cv2.inRange(img_hsv, lower_red, upper_red) img_result = cv2.bitwise_and(img, img, mask=mask) But, as i checked, red can have Hue value in range, let's say from 0 to 10, as well as in range from

HSB vs HSL vs HSV

旧时模样 提交于 2019-12-17 22:18:48
问题 I am making a Color class as a part of a very basic graphics API in c++. So I decided to take a look at Microsoft's .NET framework and noticed that their Color class has functions for HSB. Then I started a research to determine whether I should provide HSB, HSL or HSV or ALL of them in my class. So, I have 3 questions on HSB, HSL, HSV: Is HSB same as HSL? If not, why isn't there an HSBL or even HSBLV? I find many different methods of calculating these values, can someone show me the FASTEST

Calculate distance between colors in HSV space

二次信任 提交于 2019-12-17 18:44:51
问题 I intend to find a distance metric between two colours in HSV space. Suppose that each colour element has 3 components: hue, saturation, and value. Hue is ranged between 0 to 360, saturation is ranged between 0 to 1, and value is ranged between 0 to 255. Also hue has a circular property, for example, 359 in hue is closer to 0 in hue value than 10 in hue. Can anyone provide a good metric to calculate the distance between 2 colour element in HSV space here? 回答1: First a short warning: Computing