public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Wouter Thielen <wouter@morannon.org>
Cc: linux-media@vger.kernel.org
Subject: Re: Mistake on the colorspace page in the API doc
Date: Tue, 18 Jun 2013 22:58:47 +0200	[thread overview]
Message-ID: <19880516.7ZPIjvT6Bx@avalon> (raw)
In-Reply-To: <CACySJQX-GUYax5MPounyFCUczgncPx=SV=8O6ORd_zwfn31jkQ@mail.gmail.com>

Hi Wouter,

On Sunday 26 May 2013 15:34:26 Wouter Thielen wrote:
> Hi all,
> 
> I have been trying to get the colors right in the images grabbed from my
> webcam, and I tried the color conversion code on
> http://linuxtv.org/downloads/v4l-dvb-apis/colorspaces.html.
> 
> It turned out to be very white, so I checked out the intermediate steps,
> and thought the part:
> 
> ER = clamp (r * 255); /* [ok? one should prob. limit y1,pb,pr] */
> EG = clamp (g * 255);
> EB = clamp (b * 255);
> 
> 
> should be without the * 255. I tried removing *255 and that worked.

Good catch. I would instead do

y1 = (Y1 - 16) / 219.0;
pb = (Cb - 128) / 224.0;
pr = (Cr - 128) / 224.0;

and keep the E[RGB] lines unmodified to keep lower-case variables in the [0.0 
1.0] or [-0.5 0.5] range.

Would you like to post a patch for the documentation ? If not I can take care 
of it.

-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2013-06-18 20:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-26  6:34 Mistake on the colorspace page in the API doc Wouter Thielen
2013-06-18 20:58 ` Laurent Pinchart [this message]
2013-06-24  5:47   ` Wouter Thielen
2013-06-24 10:02     ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19880516.7ZPIjvT6Bx@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=wouter@morannon.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox