Questions tagged [color-space]

Color-space addresses the interface between human perception of color and the means of rendering this in a visual interface by means of coding. Use this tag for questions about the structure of and converting between various schemes of color representation.

Filter by
Sorted by
Tagged with
129 votes
2 answers
43k views

What are the practical differences when working with colors in a linear vs. a non-linear RGB space?

What is the basic property of a linear RGB space and what is the fundamental property of a non-linear one? When talking about the values inside each channel in those 8 (or more) bits, what changes? ...
Ken's user avatar
  • 2,115
81 votes
10 answers
34k views

Is there an algorithm for color mixing that works like mixing real colors?

The common mixing of RGB colors is very different from mixing colors for paintings, it's mixing of light instead mixing of pigments. For example: Blue (0,0,255) + Yellow (255,255,0) = Grey (128,128,...
Tom Pažourek's user avatar
71 votes
8 answers
19k views

Function for creating color wheels [closed]

This is something I've pseudo-solved many times and have never quite found a solution for. The problem is to come up with a way to generate N colors, that are as distinguishable as possible where N ...
Louis Brandy's user avatar
51 votes
5 answers
66k views

Convert an image RGB->Lab with python

What is the preferred way of doing the conversion using PIL/Numpy/SciPy today?
Antony Hatchkins's user avatar
48 votes
4 answers
77k views

What exactly is BGR color space?

An RGB color is composed of three components: Red (0-255), Green (0-255) and Blue (0-255). What exactly is BGR color space? How is it different from RGB color space?
user43076's user avatar
  • 671
33 votes
5 answers
10k views

Color similarity/distance in RGBA color space

How to compute similarity between two colors in RGBA color space? (where the background color is unknown of course) I need to remap an RGBA image to a palette of RGBA colors by finding the best ...
Kornel's user avatar
  • 97.9k
29 votes
7 answers
15k views

Best algorithm for matching colours.

I have an array of around 200 colours in RGB format. I want to write a program that takes any RGB colour and tries to match a colour from the array that is most "similar". I need a good definition ...
Maciek Sawicki's user avatar
29 votes
5 answers
6k views

Algorithm for finding the color between two others - in the colorspace of painted colors

When mixing blue and yellow paint, the result is some sort of green. I have two rgb colors: blue = (0, 0, 255) and yellow = (255, 255, 0) What is the algorithm for finding the rgb color that is the ...
Alexander's user avatar
  • 9,737
27 votes
6 answers
20k views

Is HSL Superior over HSI and HSV Color Spaces?

Is HSL superior over HSI and HSV, because it takes human perception into account.? For some image processing algorithms they say I can use either of these color spaces, and I am not sure which one to ...
user1509260's user avatar
  • 3,353
22 votes
6 answers
28k views

How can I use the HSL colorspace in Java?

I've had a look at the ColorSpace class, and found the constant TYPE_HLS (which presumably is just HSL in a different order). Can I use this constant to create a Color from hue, saturation, and ...
Eric's user avatar
  • 95.4k
22 votes
2 answers
12k views

ImageMagick: convert keeps changing the colorspace to Gray. How to preserve sRGB colorspace?

I have a batch script that converts my PNG-24 (with Transparency) images to 50% and 25% size (for mobile development). Usually these images have colors in them but now I am trying to convert an image ...
tayl0rs's user avatar
  • 561
19 votes
6 answers
24k views

Java: how to convert RGB color to CIE Lab

How can I present object Color in CIE Lab color model. Color c = ... float[] lab = {0,0,0}; ... c.getColorComponents(ColorSpace.getInstance(???), lab); But I wasn't able to force this work with CIE ...
user562527's user avatar
19 votes
6 answers
17k views

What's wrong with this RGB to XYZ color space conversion algorithm?

My goal is to convert an RGB pixel into CIELab color space for some special calculations only possible in CIELab. For this, I must convert RGB to XYZ first, which is the really hard part. I tried to ...
SecretService - not really's user avatar
19 votes
5 answers
10k views

Sorting a list of RGB triplets into a spectrum

I have a list of RGB triplets, and I'd like to plot them in such a way that they form something like a spectrum. I've converted them to HSV, which people seem to recommend. from PIL import Image, ...
Jason Sundram's user avatar
18 votes
6 answers
15k views

Generate unique colours

I want to draw some data into a texture: many items in a row. They aren't created in order, and they may all be different sizes (think of a memory heap). Each data item is a small rectangle and I want ...
Nick's user avatar
  • 27.6k
17 votes
1 answer
16k views

Converting RGB to HLS and back

I'm using python's colorsys library to convert RGB color values to HLS. Just to verify, I tried converting back to RGB and got a different value back. I can understand minor differences because of ...
user2175594's user avatar
16 votes
2 answers
45k views

Converting from RGB to LAB Colorspace - any insight into the range of L*A*B* values?

I was unable to find documentation on the range of L*A*B* values when converting an image from RGB to LAB in OpenCV (Python). Looking for some confirmation that my insight is correct, as the numbers ...
Daniel Castro's user avatar
16 votes
4 answers
26k views

OpenCV Error: (-215:Assertion failed) VScn::contains(scn) && VDcn::contains(dcn) && VDepth::contains(depth) in function 'CvtHelper'

Traceback (most recent call last): File "demo.py", line 132, in `result = find_strawberry(image)` File "demo.py", line 63, in find_strawberry `image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)` cv2....
TheSHETTY-Paradise's user avatar
15 votes
2 answers
19k views

Using PIL and NumPy to convert an image to Lab array, modify the values and then convert back

I am trying to convert a PIL image into an array using NumPy. I then want to convert that array into Lab values, modify the values and then convert the array back in to an image and save the image. I ...
betamax's user avatar
  • 13.5k
13 votes
5 answers
2k views

How to remove hidden marks from images using python opencv?

I wanted to work on a small project to challenge my computer vision and image processing skills. I came across a project where I want to remove the hidden marks from the image. Hidden here refers to ...
Hissaan Ali's user avatar
  • 2,289
12 votes
2 answers
10k views

Determining color space for JPEG

I am writing a code for determining a JPEG image's color space. I have found two references that may help me implementing this. One is on the oracle.com, the other one is a C source code from the ijg....
tobi's user avatar
  • 1,954
12 votes
1 answer
8k views

CGColor not defined for the UIColor, need to first convert colorspace. Swift 2, Xcode 7

I was trying to change the color of my app´s buttons by creating the color using sliders to select the values of Red, Green, Blue and Alpha. So I created an variable which held the color created by ...
giovannelucas_'s user avatar
12 votes
2 answers
2k views

How can I further optimize this color difference function?

I have made this function to calculate color differences in the CIE Lab colorspace, but it lacks speed. Since I'm not a Java expert, I wonder if any Java guru around has some tips that can improve the ...
João Dias's user avatar
12 votes
2 answers
4k views

Should WebGL shader output be adjusted for gamma?

Should a WebGL fragment shader output gl_FragColor RGB values which are linear, or to some 1⁄γ power in order to correct for display gamma? If the latter, is there a specific value to use or must a ...
Kevin Reid's user avatar
  • 37.9k
12 votes
2 answers
1k views

Does PDFBox Support Spot Colors and Separations?

I am interested in using PDFBox for a project that requires being able to specify spot colors and color separations in PDF output to go to a professional printer and am curious as to whether or not it ...
Joe Bane's user avatar
  • 1,566
11 votes
3 answers
3k views

Why does the CSS filter hue-rotate produce wierd results?

I'm trying to emulate Photoshop's "Color Overlay" using CSS filters, and while doing so, found out the CSS filters operate on colors as consistently as an epileptic seizure. Consider the color #...
Camilo Martin's user avatar
11 votes
2 answers
8k views

Lossless RGB to Y'CbCr transformation

I am trying to losslessly compress an image, and in order to take advantage of regularities, I want to convert the image from RGB to Y'CbCr. (The exact details of what I mean by RGB and Y'CbCr are not ...
Ruud's user avatar
  • 3,118
11 votes
4 answers
11k views

OpenCV: convert Scalar to different color space

I am using a Scalar to define the color of a rectangle I am drawing with OpenCV: rectangle(imgOriginal, Point(0, 0), Point(25, 50), Scalar(H, S, V), CV_FILLED); However, the color is defined in HSV ...
fuenfundachtzig's user avatar
11 votes
3 answers
6k views

Can I use libjpeg to read JPEGs with an alpha channel?

There seems to be some debate about whether JPEGs with alpha channels are valid or not. The answer I had always understood to be correct is that in the JPEG FAQ, which is essentially "No". (This is ...
Mark Longair's user avatar
11 votes
2 answers
12k views

RGB to HSV conversion using PIL

I'm trying to automate the enhancement of some images that are to be transfered to a digital frame. I have code in place that resizes, adds a date/time to the least-significant (least details) corner ...
tzot's user avatar
  • 93k
10 votes
3 answers
13k views

How to perform Bilinear Interpolation on RGB values?

Given the black pixel coordinates, I could interpolate the coordinate values of the blue pixel via the mathematical equation y = mx + c. But what about the new RGB pixel values? How do I go about ...
f0rfun's user avatar
  • 716
10 votes
3 answers
9k views

Emulate Photoshop's "Color Overlay" using CSS filters?

I have an icon which I'd like to change the color of, using CSS. It is in a data-uri'd optimized SVG inlined in the CSS. Normally, this wasn't possible. That's why icon fonts were invented; their ...
Camilo Martin's user avatar
10 votes
2 answers
940 views

Xcode 9 renders P3 PDF assets into SRGB

I've spent hours in trying to figure this one out. Goal Display P3 PDF Asset in UIImageView (the PDF is 100% in P3 Color Space). Issue I'm creating a P3 PDF asset and adding into the Xcode. Within ...
Roi Mulia's user avatar
  • 5,636
10 votes
1 answer
197 views

WICConvertBitmapSource BGR to Gray unexpected pixel format conversion

I am using WICConvertBitmapSource function to convert pixel format from BGR to Gray and I'm getting unexpected pixel values. ... pIDecoder->GetFrame( 0, &pIDecoderFrame ); pIDecoderFrame->...
cubiii's user avatar
  • 359
9 votes
3 answers
14k views

NV12 format and UV plane

i am a little confused about the NV12 format. i am looking the this page to understand the format. What i currently understand is that if you have an image or video of 640 x 480 diminsion then the Y ...
Madu's user avatar
  • 4,859
8 votes
1 answer
2k views

How to read jpeg image with Adobe RGB colorspace in OpenCV?

I am trying to read and write jpegs wth Adobe RGB colorspace in OpenCV. OpenCV assumes the jpeg has sRGB colorspace and when displaying or writing to file, the image loses some of its color intensity. ...
zindarod's user avatar
  • 6,328
8 votes
2 answers
4k views

Sort System.Media.Colors according to position in visible spectrum

Whats the quickest/easiest way to sort the colors in the System.Media.Colors according to its position in the visible spectrum (red to blue or blue to red doesn't matter) ? EDIT: Here is the result ...
NVM's user avatar
  • 5,442
8 votes
1 answer
2k views

Fast approximate algorithm for RGB/LAB conversion?

I am working on a data visualization tool using OpenGL, and the LAB color space is the most comprehensible color space for visualization of the data I'm dealing with (3 axes of data are mapped to the ...
Justin Olbrantz's user avatar
8 votes
1 answer
2k views

Should I set a color space for a CIImage or a CIContext?

Core Image lets us specify a color space for a CIContext, as in: let context = CIContext(options: [kCIContextOutputColorSpace: NSNull(), kCIContextWorkingColorSpace: NSNull()])...
Kartick Vaddadi's user avatar
7 votes
1 answer
6k views

CIColor to UIColor -> CIColor not defined for the UIColor UIExtendedSRGBColorSpace

I'm trying to implement CIColor from rgb-hex colorspace as follows: let bottomColor = UIColor.init(red: 235/255, green: 250/255, blue: 255/255, alpha: 1.0).ciColor However, I keep on hitting the ...
user594883's user avatar
  • 1,329
7 votes
1 answer
20k views

converting XYZ color to RGB

color-primary transformations Does anyone know of any formula for converting a XYZ to an RGB value? how find rgb from XYZ in this pic?
kamran amingalvani's user avatar
7 votes
2 answers
4k views

Use a LinearGradientBrush in another LinearGradientBrush?

I'm trying to use one LinearGradientBrush in the Definition of another LinearGradientBrush. But I've no idea weather this would even work, and if it works, I need to know how. For Example: <...
Tokk's user avatar
  • 4,499
7 votes
2 answers
5k views

How can one perform color transforms with ICC profiles on a set of arbitrary pixel values (not on an image data structure)?

I'd like to convert a set of pixel values from one profiled colorspace to another, without these values residing in an image file, such as (say) a list of RGB/RGBA/CMYK/etc data structures. I have ...
fish2000's user avatar
  • 4,289
7 votes
5 answers
5k views

CMYK + CMYK = ? CMYK / 2 =?

Suppose there are two colors defined in CMYK: color1 = 30, 40, 50, 60 color2 = 50, 60, 70, 80 If they were to be printed what values would the resulting color have? color_new = min(cyan1 + cyan2, ...
user avatar
7 votes
1 answer
1k views

How to generate different colors of same luminance for line chart in Java?

I want to generate different colors for my line graphs: I want to generate equally different colors (for human eye) I want them to be the same luminance (not computed brightness) (this rules out RGB ...
hakunin's user avatar
  • 4,041
6 votes
2 answers
28k views

ffmpeg Format settings, Matrix bt709

Does anyone know how I can achieve the following color space (bt.709) via FFmpeg? Here is what I have now in my files... As you can see there is Format settings, Matrix as default, how can I set it ...
user1722669's user avatar
6 votes
2 answers
3k views

How to calculate mix of 4 colors defined in CIELAB L*a*b* model?

I have 4 colors that I converted from RGB to CIELAB L*a*b* model. How can I calculate mix of these 4 colors when I have (L,a,b) for each such color? How can I calculate same mix, if I want to put ...
Ωmega's user avatar
  • 42.7k
6 votes
5 answers
8k views

Converting JPEG colorspace (Adobe RGB to sRGB) on Windows (.Net)

I need to generate thumbnail and medium sized images from large photos. These smaller photos are for display in an online gallery. Many of the photographers are submitting JPEG images using Adobe RGB....
Imageree's user avatar
  • 4,693
6 votes
1 answer
6k views

Init Generic RGB in Swift

I am attempting to convert a string containing a color in the Generic RGB color space into UIColor in Swift. For example, a typical string would look like this: 0.121569 0.129412 0.156863 1 Using the ...
Alexander MacLeod's user avatar
6 votes
2 answers
3k views

Calculate CMYK coverage on PDF

I don't suppose is there any free or open source libraries out there that able to calculate the CMYK coverage on a pdf file. I tried looking around I don't seem to able to find any. If there isn't any ...
madness800's user avatar

1
2 3 4 5
10