rgb

How do I display the red channel of an image in Matlab?

你。 提交于 2019-12-20 12:28:27
问题 I have a 3D matrix im which represents an RGB image. I can do imshow(im) to display the image. I want to display only one of the RGB channels at a time: I want to display the red channel and I want it to appear red. I've tried imshow(im(:,:,1)) but it displays the grayscale image (which is not what I want). How do I display the red channel and make it appear red? 回答1: I have three proposals for you. 1. Use the imagesc function and choose a red color palette. 2. Clear the other color channels:

PHP generate RGB

人走茶凉 提交于 2019-12-20 10:47:43
问题 I'm facing this situation where I have an ID which comes from a database (so it can be 1, 100, 1000, ...) and I need to generate random colors, however equal ID's should result in the same color. Any suggestion on how I can achieve this? Thanks! 回答1: Use a cryptographic hash and clip the bytes you don't need: function getColor($num) { $hash = md5('color' . $num); // modify 'color' to get a different palette return array( hexdec(substr($hash, 0, 2)), // r hexdec(substr($hash, 2, 2)), // g

RGB to XYZ and LAB colours conversion

时光毁灭记忆、已成空白 提交于 2019-12-20 10:34:41
问题 I'm having problems converting colours from RGB to LAB space It should be straight forward using the formulas from here, only I'm getting back the wrong values RGB = 56,79,132 X = 8.592 Y = 8.099 Z = 22.940 and CIE-L*ab as L* 34.188 a* 8.072 b* -32.478 This is my code; but I can't see where I'm going wrong. It maybe due to floating points like this fella before me. Thank you. // user colour var Red = 56; var Green = 79; var Blue = 132; // user colour converted to XYZ space XYZ = RGBtoXYZ(Red

Fading Arduino RGB LED from one color to the other?

╄→гoц情女王★ 提交于 2019-12-20 10:10:58
问题 I've currently managed to get my LED to cycle through eight colors that I've selected. Everything is working correctly, except that I want to go for a more natural feel, and would like to fade / transition from one color to the next, instead of having them just replace one another. Here's my code so far: int redPin = 11; int greenPin = 10; int bluePin = 9; void setup() { pinMode(redPin, OUTPUT); pinMode(greenPin, OUTPUT); pinMode(bluePin, OUTPUT); } void loop() { setColor(250, 105, 0); //

How to initialize UIColor from RGB values properly?

谁说我不能喝 提交于 2019-12-20 08:43:28
问题 I am working on an iPhone application which uses various colors. When user selects the particular color button I set drawing color accordingly. I am getting the color for some but in the most of the cases I am getting white color. Here is my code: -(IBAction)colorSelected:(UIButton *)sender { switch (sender.tag) { case 1: self.drawcolor= [UIColor colorWithRed:200 green:191 blue:231 alpha:1]; break; case 2: self.drawcolor= [UIColor colorWithRed:163 green:73 blue:164 alpha:1]; break; case 3:

How to convert 24 bit RGB array into an image?

帅比萌擦擦* 提交于 2019-12-20 05:45:57
问题 My program result is giving 24 bit RGB data. It is very difficult verify my result by looking into the array of 24 bit data. If there is any easy method to convert this array to an image, I can easily verify my result. Expecting your help for the same. Please. Example: 4x3 Resolution Image, I have following data as text file. 110000001100000011000000 110000001100000011111111 110000001100000011111111 110000001100000011111111 110000001100000011111111 110000001100000011111111

Detect Values of RGB from CameraFrame using OpenCV in Android

不想你离开。 提交于 2019-12-20 05:20:52
问题 I want to detect which value is maximum from RGB. how can I detect that? I want to display which colour has highest occurrence with their RGB value. For example, In a image the RED colour has highest occurrence so it will display colour as RED and with their value in percentage. I have tried it by getting rows and cols of image like below: public Mat onCameraFrame(CvCameraViewFrame cvf) { mRgba = cvf.rgba(); int rows = mRgba.rows(); int cols = mRgba.cols(); // int ch = mRgba.channels();

Is QImage able to open and render pure 16-bit images?

一曲冷凌霜 提交于 2019-12-20 04:26:11
问题 I think the headline already explains what I want to know. Is there a possible way to open and save images with 16-bit with Qt? And I don't mean the 3*8=24bit or 4*8=32bit, what is quite the same as a pure 8-bit image, I mean pure 16-bit for R, G and B. 回答1: Contrary to what Patrice says, there is no 16 bits per component format in QImage . The most you can get is QImage::Format_ARGB32 at 8 bits per component. Even if you used 8 bits indexed mode, the color tables do not support more than 8

Why are Excel RGB values backwards? [closed]

情到浓时终转凉″ 提交于 2019-12-20 03:23:17
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . This function is an example. Note that the RGB values are actually BGR values. Why does excel do this? Function GetRGB(ByVal cell As Range) As String Dim R As String, G As String Dim b As String, hexColor As String hexCode = Hex(cell.Interior.Color) 'Note the order excel uses

Get Pixel Color on screen Java?

半城伤御伤魂 提交于 2019-12-20 03:09:40
问题 Hello I am trying to get the color of a particular pixel on my JFrame. This is my code. My frame is red. The problem I am having is when I click the Frame it should return me the RGB color for red that is (255,0,0) but when I click at different points i sometimes get the RGB color for white (255,255,255) what is the problem in my code guys? public class guiTest extends JFrame { private static Shape ellipse; private static Robot rb; public guiTest() { super("4-connected approach"); setLayout