Newsgroups: sci.image.processing
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!travelers.mail.cornell.edu!news.tc.cornell.edu!news.cac.psu.edu!howland.reston.ans.net!news.sprintlink.net!dish.news.pipex.net!pipex!bbc!alanr
From: alanr@rd.bbc.co.uk (Alan Roberts)
Subject: Re: C code for RGB-> YCbCr convertion
Message-ID: <DBLM0s.GqK@bbc.co.uk>
Sender: usenet@bbc.co.uk
Nntp-Posting-Host: sung0.rd.bbc.co.uk
Organization: British Broadcasting Corporation, UK
X-Newsreader: TIN [version 1.2 PL0]
References: <3tuqeg$989@news.duke.edu> <GORELICK.95Jul11171543@emily>
Date: Wed, 12 Jul 1995 10:19:40 GMT
Lines: 47

Noel Gorelick (gorelick@emily) wrote:
: In article <3tuqeg$989@news.duke.edu> vnl@ee.ee.duke.edu (Vishal N. Lulla) writes:

: >   I am looking for some public domain software for RGB-> YCbCr convertion
: >   and viceversa...if anyone knows any sites from where I could pick it up, 
: >   please let me know.

: ImageMagick has routines in it to do this.  You can find it at
:     ftp://ftp.x.org/contrib/applications/...

: Basically, it looks like this:

:           Y =  0.299000*R+0.586000*G+0.114000*B
:           Cb= -0.172586*R-0.338828*G+0.511414*B
:           Cr=  0.511414*R-0.428246*G-0.083168*B

: and

:           R = Y            +1.370707*Cr
:           G = Y-0.336453*Cb-0.698195*Cr
:           B = Y+1.732445*Cb

: One thing to note, this assumes RGB values from 0.0 to 1.0 and Cb and Cr
: values from -0.5 to 0.5 (I think).

That's correct.

: Be aware I have *NO* idea what this colorspace is, I am merely quoting from
: the source, and may be speaking though my hat.

The colour space is highly non-linear, since the RGB values are assumed
to have been gamma corrected. So you can't use these values to get to
chromaticity coordinates or the like until you undo the gamma correction.

Without checking your figures, I believe that this conversion is for
ITU-R BT.601 (that used to be called CCIR Rec.601). 709 uses different
equations.

: -- Noel (ngorelic@emily.la.asu.edu)


--
************* Alan Roberts **************
* BBC Research & Development Department *
* My views, not necessarily Auntie's    *
*    but they might be, you never know. *
*****************************************
