-
Hello guys, I wonder what would be a good way to sample a certain amount of points that are equally spread around in the chromaticity diagram? If I try to randomize 256^2 points like the example on the documents, I see some focused areas in the top left. I wonder it is because that area is white? and I also wonder if there is a better way to sample points than randomize them? As I understand from reading the code, if I use the CIE1976 diagram, the RGB will be converted to Luv and the L would be drop which sometimes leads to some points overlapping another. Thank you so much for all the suggestions |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @Jerry2001, You could sample in CIE Luv uv space directly, convert to RGB, remove out-of-gamut RGB values and display the remaining colours: >>> import colour
>>> import numpy as np
>>> uv = np.random.rand(65535, 2)
>>> RGB = colour.convert(uv, 'CIE Luv uv', 'RGB', verbose={'mode': 'Long'})
===============================================================================
* *
* [ Conversion Path ] *
* *
* "uv_to_Luv" --> "Luv_to_XYZ" --> "XYZ_to_RGB" *
* *
===============================================================================
===============================================================================
* *
* [ "uv_to_Luv" ] *
* *
* [ Signature ] *
* *
* <Signature (uv: 'ArrayLike', illuminant: 'ArrayLike' = array([ 0.3127, *
* 0.329 ]), Y: 'Floating' = 1) -> 'NDArray'> *
* *
* [ Conversion Output ] *
* *
* [[ 1. 0.33405403 -0.12794825] *
* [ 1. 0.78619488 5.98544225] *
* [ 1. -2.0738391 3.84020283] *
* ..., *
* [ 1. -0.5873704 4.10480748] *
* [ 1. 6.84352552 0.19985262] *
* [ 1. 7.16952762 -1.99665285]] *
* *
===============================================================================
===============================================================================
* *
* [ "Luv_to_XYZ" ] *
* *
* [ Signature ] *
* *
* <Signature (Luv: 'ArrayLike', illuminant: 'ArrayLike' = array([ 0.3127, *
* 0.329 ])) -> 'NDArray'> *
* *
* [ Conversion Output ] *
* *
* [[ 1.09696595 1. 1.17773644] *
* [ 0.62578393 1. -1.97840705] *
* [ 0.11284738 1. -1.10947568] *
* ..., *
* [ 0.43804165 1. -1.31984645] *
* [ 3.36902319 1. 0.07926996] *
* [ 5.35694168 1. 2.74629276]] *
* *
===============================================================================
===============================================================================
* *
* [ "XYZ_to_RGB" ] *
* *
* [ Signature ] *
* *
* <Signature (XYZ: 'ArrayLike', illuminant_XYZ: 'ArrayLike', *
* illuminant_RGB: 'ArrayLike', matrix_XYZ_to_RGB: 'ArrayLike', *
* chromatic_adaptation_transform: "Union[Literal['Bianco 2010', 'Bianco *
* PC 2010', 'Bradford', 'CAT02 Brill 2008', 'CAT02', 'CAT16', *
* 'CMCCAT2000', 'CMCCAT97', 'Fairchild', 'Sharp', 'Von Kries', 'XYZ *
* Scaling'], str]" = 'CAT02', cctf_encoding: 'Optional[Callable]' = None) *
* -> 'NDArray'> *
* *
* [ Conversion Output ] *
* *
* [[ 1.43040846 0.86182576 1.10196842] *
* [ 1.47714914 1.18737406 -2.26032008] *
* [ -0.6183222 1.72041893 -1.3704302 ] *
* ..., *
* [ 0.54039322 1.39660781 -1.57467878] *
* [ 9.34093254 -1.38515687 0.06744294] *
* [ 14.45320363 -3.20056964 2.9972131 ]] *
* *
===============================================================================
>>> colour.plotting.plot_RGB_chromaticities_in_chromaticity_diagram_CIE1976UCS(RGB[np.all(RGB > 0, axis=-1)], scatter_kwargs={'s' : 1}, diagram_opacity=0.125) |
Beta Was this translation helpful? Give feedback.
Hi @Jerry2001,
You could sample in CIE Luv uv space directly, convert to RGB, remove out-of-gamut RGB values and display the remaining colours: