hsv

Translating Obj-C RGBtoHSV() function to Swift. min = MIN( r, MIN(g, b )); etc

柔情痞子 提交于 2019-12-13 04:53:09
问题 Could someone please help me with this function? This function is inside of a camera app that uses a filter algorithm to detect differences in colour variants etc. The syntax is very difficult for me. I don't know how to deal with the pointers in the arguments, the min and max variable syntax, what is delta etc? Could someone please translate for me? Much appreciated. Also should I be doing something with UIColor? Someone mentioned it below. I have no idea how to convert though. // r,g,b

python opencv HSV range finder creating trackbars

ε祈祈猫儿з 提交于 2019-12-13 03:52:43
问题 I want to find the HSV value of a LASER dot using opencv and python. I got the code http://opencv-srf.blogspot.com.au/2010/09/object-detection-using-color-seperation.html from here but it is in c++, installing visual studio and opencv takes time so i changed the code in python import cv2 import numpy as np def callback(x): pass cap = cv2.VideoCapture(0) cv2.namedWindow('image') ilowH = 0 ihighH = 179 ilowS = 0 ihighS = 255 ilowV = 0 ihighV = 255 # create trackbars for color change cv2

The formulars in HSV triangle

与世无争的帅哥 提交于 2019-12-12 19:20:04
问题 I do not know how the following two formulas are derived. Please kindly explain. My reputation point is so low that I can't ask the person who wrote the formula. HSV triangle in C# var sat = (1 - 2*y1) / (sqrt3*x1 - y1 + 2); var val = (sqrt3*x1 - y1 + 2) / 3; 回答1: After the transformation, I needed the corners of the triangle to touch the unit circle at the points <0,-1> "top", <-√3/2,1/2> "bottom-left" and <√3/2,1/2> "bottom-right". I picked bottom-left to be the black point ( val = 0), and

Weird phenomenon when converting RGB to HSV manually in Matlab

雨燕双飞 提交于 2019-12-12 04:23:09
问题 I have written a small Matlab funcion which takes an image in RGB and converts it to HSV according to the conversion formulas found here. The problem is that when I apply this to a color spectrum there is a cut in the spectrum and some values are wrong, see images (to make the comparison easier I have used the internal hsv2rgb() function to convert back to RGB. This does not happen with Matlabs own function rgb2hsv() but I can not find what I have done wrong. This is my function function [ I

Error when converting from HSV to BGR, or HSV to JPEG in openCV after using inRange

懵懂的女人 提交于 2019-12-12 00:09:08
问题 I am using openCV 3.1.0 (I have tried with 2.4.9, with same problem). I want to output a HSV mat to jpeg: // .. Getting JPEG content into memory // JPEG to mat Mat imgBuf=Mat(1, jpegContent, CV_8UC3, jpegSize); Mat imgMat=imdecode(imgBuf, CV_LOAD_IMAGE_COLOR); free(jpegContent); if(imgMat.data == NULL) { // Some error handling } // Now the JPEG is decoded and reside in imgMat cvtColor(imgMat, imgMat, CV_BGR2HSV); // Converting to HSV Mat tmp; inRange(imgMat, Scalar(0, 0, 0), Scalar(8, 8, 8),

How do I convert RGB into HSV in Cocoa Touch?

这一生的挚爱 提交于 2019-12-11 04:06:19
问题 I want to set the background color of a label using HSV instead of RGB. How do I implement this into code? Code: //.m file #import "IBAppDelegate.h" @implementation IBAppDelegate @synthesize label; { self.label.backgroundColor = [UIColor colorWithRed:1.0f green:0.8f blue:0.0f alpha:1.0f]; } 回答1: You can use the following convenience constructor of the UIColor object: + (UIColor *)colorWithHue:(CGFloat)hue saturation:(CGFloat)saturation brightness:(CGFloat)brightness alpha:(CGFloat)alpha 来源:

how to set hue value of some pixel with opencv

六月ゝ 毕业季﹏ 提交于 2019-12-11 03:35:57
问题 I need to change the hue of some pixels of my image, but i don't know how to set them! I converted the image in HSV with CV_BGR2HSV and now i'm cycling with a for by rows and cols... how can I access each pixel's hue? for setting RGB i'm using this code... CvScalar s; s=cvGet2D(imgRGB,i,j); // get the (i,j) pixel value printf("B=%f, G=%f, R=%f\n",s.val[0],s.val[1],s.val[2]); s.val[0]=240; s.val[1]=100; s.val[2]=100; cvSet2D(imgRGB,i,j,s); // set the (i,j) pixel value 回答1: You already

Convert YUV into HSL or HSV bypassing the RGB step

纵然是瞬间 提交于 2019-12-10 16:17:57
问题 Wikipedia and plethora of online resources provide detailed and abundant help with various color space conversions from/to RGB. What I need is a straight YUV->HSL/HSV conversion . In fact what I need is just the Hue (don't care much for the Saturation or the brightness Lightness/Value). In other words I just need to calculate the "color angle" for a given YUV color. Code in any language would suffice, though my preference is C-style syntax. Note that by YUV I mean specifically Y′UV, a.k.a.

how to obtain a single channel value image from HSV image in opencv 2.1?

你。 提交于 2019-12-09 16:11:50
问题 I am a beginner in opencv. I am using opencv v2.1. I have converted an RGB image to HSV image. Now I want to obtain single channels Hue, Value and Saturation separately. What should I do? I have seen similar questions here but No-one answered that. Kindly help. 回答1: You can access the same way you were accessing for RGB image where 1st channel will be for H, 2nd channel for S and 3rd channel for V. If you are using OpenCV 2.1, you must be using IplImage then, right? like if your HSV image is

HSV ranges for color filter

試著忘記壹切 提交于 2019-12-09 06:58:00
问题 I am working on a project on detecting traffic signs in opencv. I need a good HSV range to filter out red, blue and yellow traffic signs in the urban environment. This is just so that I have a smaller region of interest. So I do not want a highly accurate range but a rough estimate. Can anyone help me out?? 回答1: You might want to read this link. I extract the interesting part here: How to find HSV values to track? This is a common question found in stackoverflow.com. It is very simple and you