Colour Science

Check if a value is in the Pointer's Gamut

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):

            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,
        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 ?


Welcome @LiamCollod!

I did a quick check with the last sRGB value and it is outside the hull for me:

Google Colab notebook to reproduce the plot:



1 Like

Hey, thanks Thomas for your answer.
I will try to use the google collab to make further investigation, thanks a lot !

So if you perform chromatic adaptation from D65 to Pointer’s Illuminant, the sRGB value is within. You should do it because otherwise the colours being compared are under different illuminants.

1 Like

Thanks for the precision, I will include it in my script.