Hello, don’t know if it’s the right place to ask question about colour utilisation. (I saw there was also a slack, don’t know how to join it).
I am trying to write a quick script that tells me if a give RGB value with given primaries is inside the Pointer’s Gamut or not.
Final goal is to input image and output something that’s tell which pixel is inside or not.
For now the script in basic, just with single RGB values.
I have been shared a document with sRGB value that should be in the PG, when comparing the value in the document i notice that most of them are not in the PG listening to my script while they should be.
So i would like to know if my script produce correct result.
Here is a snippet of my code:
def __init__(self, colorspace):
self.colorspace = colour.RGB_COLOURSPACES[colorspace]
def rgb_converter(self, in_rgb, tolerance_amnt):
"""
Args:
in_rgb(numpy.ndarray): Image pixels as a numpy array
Returns(bool): True if the in_rgb value in inside the Pointer's gamut
"""
xyz_conversion = colour.RGB_to_XYZ(in_rgb, self.colorspace.whitepoint,
self.colorspace.whitepoint,
self.colorspace.RGB_to_XYZ_matrix)
pg_result = colour.is_within_pointer_gamut(xyz_conversion, tolerance_amnt)
return pg_result
Example of test i made:
Are input rgb values inside Pointer's Gamut ?:
-- Parameters: tolerance: 0
----- - [rgb value](Colorspace primaries): answer
- [0.4985, 0.7630, 0.4471](ACEScg): True
- [1, 0.03, 0.03](sRGB): False
- [0.015, 0.5, 0.015](sRGB): False
Here all the values are supposed to be in PG
If in increased the tolerance to 0.25 all the values are in(True) .
So i also would like to know what is range of the tolerance parameter ?
Thanks.
LIam.