New Color Space for GMIC - 1981 Xerox's YES, Ohta, YDbDr,Kodak-1

As @David_Tschumperle did rgb2ryb, I think it is my turn to add color space support for G’MIC. This time, I have pushed changes to gmic-community which adds YES support. If you haven’t heard of it, it’s a forgotten color space that only right now exists in the one single page on the web. I found that enables Nebulous, and a smoother Color Modulo Texture to look more interesting, but there’s barely anything much that isn’t already solved by YIQ/YUV and friends, and LAB.

#@cli rgb2yes
#@cli : Convert color representation of selected images from RGB to YES. 
#@cli : Source: Xerox Color Encoding Standard, (tech rep?) XNSS 289005 (1989?) ; https://hbfs.wordpress.com/2018/05/01/xerox-yes-colorspaces-iv/
#@cli : $ image.jpg rgb2yes split c
rgb2yes:
e[^-1] "Convert color representation of image$? from RGB to YES."
f [.253*i0+.684*i1+.063*i2,.5*i0-.5*i1,.25*i0+.25*i1-.5*i2]
#@cli yes2rgb
#@cli : Convert color representation of selected images from RGB to YES. 
#@cli : Source: Xerox Color Encoding Standard, (tech rep?) XNSS 289005 (1989?) ; https://hbfs.wordpress.com/2018/05/01/xerox-yes-colorspaces-iv/
#@cli : $ image.jpg yes2rgb split c
yes2rgb:
e[^-1] "Convert color representation of image$? from YES to RGB."
f [i0+1.431*i1+.126*i2,i0-.569*i1+.126*i2,i0+.431*i1-1.874*i2]
#@cli rgb2yes8
#@cli : Convert color representation of selected images from RGB to Yes8. 
#@cli : Source: Xerox Color Encoding Standard, (tech rep?) XNSS 289005 (1989?) ; https://hbfs.wordpress.com/2018/05/01/xerox-yes-colorspaces-iv/
#@cli : $ image.jpg rgb2yes8 split c
rgb2yes8:
e[^-1] "Convert color representation of image$? from RGB to Yes8."
f [.253*i0+.684*i1+.063*i2,(.5*i0-.5*i1)+127.5,(.25*i0+.25*i1-.5*i2)+127.5]
#@cli yes82rgb
#@cli : Convert color representation of selected images from Yes8 to RGB. 
#@cli : Source: Xerox Color Encoding Standard, (tech rep?) XNSS 289005 (1989?) ; https://hbfs.wordpress.com/2018/05/01/xerox-yes-colorspaces-iv/
#@cli : $ image.jpg yes82rgb split c
yes82rgb:
e[^-1] "Convert color representation of image$? from Yes8 to RGB."
f [i0+1.431*(i1-127.5)+.126*(i2-127.5),i0-.569*(i1-127.5)+.126*(i2-127.5),i0+.431*(i1-127.5)-1.874*(i2-127.5)]

Additional note : I plan to add more modes, and I found a good set of them here - https://hbfs.wordpress.com/ (Scroll down to find some, and that’s where I found Xerox’s YES) . There is also the TSL color space which is used for facial recognization.

2 Likes

I’ll be adding TSL Color Space as well. I tested some of the new modes. Otha does actually segment colors pretty well when used in Nebulous filter (The result is terrible looking, but it does the job.).

https://github.com/dtschump/gmic-community/commit/1af0b97f60e2c8432c0a1f621ed055aa78ac3d5f

You have a typo for rgb2ohta8. Didn’t check the others.

I’m not seeing it. What line number?

EDIT: Line 50, never mind.

Found this - HWB to RGB Transform Pair

The math. See comparison:

gmic sp tiger +rgb2ohta8 rgb2ohta[0] s c n 0,255 round montage A o tigerohta.jpg

If you are feeling keen, here is another colour space you might like.

1 Like

@Iain I went straight-forward to the conversion, and got this so far. It gives me NAN result, but I think you understand that paper better and could get something.

This is RGB2IHLS

/ 255
f "YCC=[.2125*i0+.7154*i1+.0721*i2,i0-.5*i1-.5*i2,(-sqrt(3)/2)*i1+(sqrt(3)/2)*i2];
C=sqrt(YCC[1]^2+YCC[2]^2);
if(YCC[2]<=0&&!C,H=acos(YCC[1]/C);,
if(YCC[2]>0&&!C,H=pi*2-acos(YCC[1]/C),
H=0;
);
);
S=(2*C*sin(6/9*2*pi-H))/sqrt(3);
[H,S,YCC[0]]
"
* 255

Unfortunately, I don’t understand the paper as much as I’d like to. I get the concepts but the specifics elude me.

For code, see: colour_resources [Allan Hanbury].

2 Likes