= rgb2ycbcr =
== Syntax == :int rgb2ycbcr(int r, int g, int b, int z) == Arguments == :r ::Red value :g ::Green value :b ::Blue value :z ::Determines which value is returned. z=0 for Y, z=1 for Cb, z=2 for Cr == Return == :Returns the Y, Cb or Cr value from 0 to 255 depending on the value of z == Description == :Lets you convert RGB values to YCbCr values. == Example == <code> %ffp ctl(0):"Y (Luminancy)",Range=(-255,255),val=0 ctl(1):"Cb (Chroma Blue)",Range=(-255,255),val=0 ctl(2):"Cr (Chroma Red)",Range=(-255,255),val=0 ForEveryTile:{ int r,g,b,i,cb,cr; for (y= y_start; y < y_end; y++){ if(updateProgress(y,y_end)) abort(); for (x = x_start; x < x_end; x++){ r = src(x,y,0); g = src(x,y,1); b = src(x,y,2); i = rgb2ycbcr (r,g,b,0); cb = rgb2ycbcr (r,g,b,1); cr =rgb2ycbcr (r,g,b,2); //Do the adjustment i = i + ctl(0); cb = cb + ctl(1); cr = cr + ctl(2); pset( x, y, 0, ycbcr2rgb (i,cb,cr,0) ); pset( x, y, 1, ycbcr2rgb (i,cb,cr,1) ); pset( x, y, 2, ycbcr2rgb (i,cb,cr,2) ); }} return true; }</code> == Also see == == Comments == :Everyone can add his comments about his experiences with this function here. Tips for using it are welcome, too. |