colour-science / colour-checker-detection

Colour checker detection with Python
https://www.colour-science.org/
BSD 3-Clause "New" or "Revised" License
224 stars 31 forks source link

How to obtain the raw linear values of every swatches? #83

Closed Hurricane-k closed 1 month ago

Hurricane-k commented 1 month ago

Question

Hi

I following the .ipynb about segmentation. When I using

detect_colour_checkers_segmentation(
        COLOUR_CHECKER_IMAGES, additional_data=True)

I hope I can get the absolute locations of every patch. I think quadrilateral of Tuple[DataDetectionColourChecker] can help me. However, even if parameter additional_data is set as True, I cannot get the last element 'quadrilateral'. I only get the first three elements swatch_colors, 'swatch_masks', 'colour_checker'.

How can I get the quadrilateral, or how can I get the absolute locations of every color patch?

Best Regards.

Hurricane-k commented 1 month ago

Actually, I wanna get the linear raw rgb values of every swatch. And my input is raw .png file without WB, and I use other default parameters in detect_colour_checkers_segmentation. But I check the results swatch_colours that are far away from my manual operation. I think there might be some secrets or tricks I missed. Surprisingly, I found this discussion #59. the input image must be sRGB or other standard device-independence color space. coz my aim is to get the exact raw value. how do I do?

Hurricane-k commented 1 month ago

Another question: At the every beginning, I completely follow the instruction of segmentation (jupyter notebook example), which means I use colour.cctf_decoding(colour.io.read_image(path)) to load IMG. Based on the discussion #59, About colour.cctf_decoding, its description is decoding non-linear RGB values to linear RGB, could you explain further the exact definiton of this decoding operion, is it inverse operation of Gamma correction?

Other interesting thing: when I load linear RAW .png directly, the recognition is not really good. image

But when I using colour.cctf_decoding(colour.io.read_image(path)) , it manage to detect color checker. image

KelSolaar commented 1 month ago

Hello,

Typically, a PNG file and because it tends to be 8-bit will be saved with a non-linear encoding to avoid quantization issues. An EXR 16-bit Half or 32-bit file would be linearly encoded on the other hand. You can call this gamma correction but usually the encodings are more complex than a simple power function.

How did you obtain/produce your RAW png file?

Hurricane-k commented 1 month ago

Hi

Thank you for your quick response.

From *.CR2 or *.DNG file, and then convert them to de-mosaicked images by dcraw.

Hurricane-k commented 1 month ago

Hi

in your example, examples_detection_segmentation.ipynb,

for image in COLOUR_CHECKER_IMAGES:
      for colour_checker_data in detect_colour_checkers_segmentation(
            image, additional_data=True):

            swatch_colours, swatch_masks, colour_checker_image = (
                   colour_checker_data.values)

why only three variables swatch_colours, swatch_masks, colour_checker_image?

Based on Reference API, return Tuple[colour_checker_detection.detection.DataDetectionColourChecker], there are four elements in the tuple, how to get the fourth variant quadrilateral?

Best Regards

Hurricane-k commented 1 month ago

Hi

in your example, examples_detection_segmentation.ipynb,

for image in COLOUR_CHECKER_IMAGES:
      for colour_checker_data in detect_colour_checkers_segmentation(
            image, additional_data=True):

            swatch_colours, swatch_masks, colour_checker_image = (
                   colour_checker_data.values)

why only three variables swatch_colours, swatch_masks, colour_checker_image?

Based on Reference API, return Tuple[colour_checker_detection.detection.DataDetectionColourChecker], there are four elements in the tuple, how to get the fourth variant quadrilateral?

Best Regards

no Tuple of DataDectectionColourChecker when passing additional_data=True

KelSolaar commented 1 month ago

Hello,

Sorry, I was abroad in US, which version of the package are you using? From develop or pypi?