rgb

Access pixels with Mat OpenCV

十年热恋 提交于 2019-12-31 02:14:10
问题 I would like to access pixels in RGB with OpenCV 2.3. I'm trying like this but it's like every pixels are equal frame after frame because I got no output. Images are from my webcam and I can see them. Btw RED = 0; THX Mat frame; Mat oldFrame; VideoCapture cap(0); cap >> oldFrame; sumFramePix = oldFrame.cols * oldFrame.rows; nbChannels = oldFrame.channels(); cout << "NbcHANNELs : " << nbChannels << endl; imshow("Video 1", oldFrame); while(1) { cap >> frame; imshow("Video 1", frame); for(int i

How to determine luminance %?

心已入冬 提交于 2019-12-31 00:58:09
问题 According to http://www.workwithcolor.com/color-luminance-2233.htm, RED (#FF0000) has Luminance: 54%. and light pink (#FF8080) has Luminance: 89%. Our designers like it but how is it determined? Try here: http://www.workwithcolor.com/hsl-color-schemer-01.htm I tried using relative luminance formula published by W3C and although the range is [0,1], red is 0.21 and white is 1.00 . I'm thinking, maybe what workwithcolor does is first covert the color into grayscale, and read the luminance of the

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

Mapping an Integer to an RGB color in C#

跟風遠走 提交于 2019-12-30 01:16:05
问题 So right now I have a number between 0 and 2^24, and I need to map it to three RGB values. I'm having a bit of trouble on how I'd accomplish this. Any assistance is appreciated. 回答1: You can do Color c = Color.FromArgb(someInt); and then use c.R , c.G and c.B for Red, Green and Blue values respectively 回答2: Depending on which color is where, you can use bit shifting to get the individual colors like this: int rgb = 0x010203; var color = Color.FromArgb((rgb >> 16) & 0xff, (rgb >> 8) & 0xff,

How do I create a UIColor from RGBA?

非 Y 不嫁゛ 提交于 2019-12-29 12:12:33
问题 I want to use NSAttributedString in my project, but when I'm trying to set color, which isn't from the standard set ( redColor , blackColor , greenColor etc.) UILabel displays these letters in white color. Here is my line of this code. [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:66 green:79 blue:91 alpha:1] range:NSMakeRange(0, attributedString.length)]; I tried to make color with CIColor from Core Image framework, but it showed the same results.

why the same color looks different on different android devices

前提是你 提交于 2019-12-28 20:37:11
问题 I find lots of colors look different on different android devices. For example, if I set #fff8f5ea as the background color of a View and run the app on different devices, I can easily tell the difference between them. Any body have the same problem? Does anyone know why? 回答1: Every piece of hardware will render the primary colours used in the individual pixels at different intensities. The display driver also implements colour profiles, sometimes user definable, which alter those intensities.

Algorithm to modify brightness for RGB image?

大城市里の小女人 提交于 2019-12-28 15:58:13
问题 I know there is formula for going RGB -> Luminance, but I need given a brightness parameter to modify the RGB values of an image. How do I do that? Thanks 回答1: Map from RGB to HSL (Hue/saturation/luminance), keep the hue and saturation the same, and just modify the luminance and then do the backward mapping from HSL to RGB. You can read more about the RGB to HSL and HSL to RGB transformations here. 回答2: The easiest way is to multiply each of the R,G,B values by some constant - if the constant

Getting RGB array from image in C#

让人想犯罪 __ 提交于 2019-12-28 15:39:30
问题 I'm currently writing a C# implementation of a little program which I have written in Java. I had used BufferedImage.getRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize) function in my Java app. But I couldn't exactly find a version of this in C# and I am not sure how to write it manually. 回答1: There's not a direct equivalent in the .NET Framework to this method. However, if your image is a System.Drawing.Bitmap, you can call the LockBits method, and this

How to get the wavelength of a pixel using RGB?

China☆狼群 提交于 2019-12-28 05:59:24
问题 I have a project that would classify the color of a pixel. Whether it is red,violet, orange or simply any color in the color wheel. I know that there are over 16 million color combination for pixels. But I was able to read a web page that says its possible for me to do my project using the wavelengths of color. Please give me the formula to compute for the wavelength using RGB values. Thanks! 回答1: A pure color has a wavelength (any single color LED will have a specific wavelength). Red, green

Convert 12-bit Bayer image to 8-bit RGB using OpenCV

萝らか妹 提交于 2019-12-28 05:29:47
问题 I am trying to use OpenCV 2.3.1 to convert a 12-bit Bayer image to an 8-bit RGB image. This seems like it should be fairly straightforward using the cvCvtColor function, but the function throws an exception when I call it with this code: int cvType = CV_MAKETYPE(CV_16U, 1); cv::Mat bayerSource(height, width, cvType, sourceBuffer); cv::Mat rgbDest(height, width, CV_8UC3); cvCvtColor(&bayerSource, &rgbDest, CV_BayerBG2RGB); I thought that I was running past the end of sourceBuffer, since the