I have an image in YCbCr color space, what is the simplest method to
increase the saturate of the image by processing on each pixel?
Also, how to control the degree of saturation?
Thanks,
Jason
ycbcr is a formal specification, which can be found on the internet. the
y-component should have neatly defined borders (if you can't find them try
to convert every rgb-value to a ycbcr value and you'll find the borders
... ), which enable you to control the overall degree.
hope this helps,
richard
My understanding is that color coordinate systems come in two basic
flavors -- polar and rectangular. YCrCb is a rectangular color system
(like RGB), while saturation is a property of the polar coordinate
systems. Assuming that I am within shouting distance of reality, I
believe that one must convert to a different coordinate system before
saturation can be adjusted. FWIW
--Tom Clune
Thank you for your reply.
The saturation I mean is the color saturation. Are there a formula for
me to increase the color sturation of a ycbcr image?
Why I want to do this is that, for example, the photo is too dark now,
I want to brighten it so I increase the Y of the image. However, I
found the color of the resulting image is qiute dull. So I want to
increase the saturation of the image too. (I want to manipulate the
image in ycbcr color space only)
Anyone has ideas about this?
Thanks,
Jason
"RA Scheltema" <r.a.scheltema[viral][s][p]@[m]dacolian.nl> wrote in message news:<40435165$0$569$e4fe...@news.xs4all.nl>...
ah sorry for my confused answer :)
> Why I want to do this is that, for example, the photo is too dark now,
> I want to brighten it so I increase the Y of the image. However, I
> found the color of the resulting image is qiute dull. So I want to
> increase the saturation of the image too. (I want to manipulate the
> image in ycbcr color space only)
only way I see then is to go to another colorspace
hsv is most convenient, since this describes the values you require neatly
what you could do is strip the formula for
ycbcr -> rgb -> hsv -> rgb -> ycbr
so it will become more compact
I don't know if it's true, but I'm guessing you could lose a lot of the
overhead, since you only require the saturation channel
regards,
richard
The reason why I want to work only in YCbCr space is that the input
image is YCbCr and the complexity for transforming to another color
space is quite expensive and not efficient. e.g. in palm OS platform,
doing a color space transformation by purely software is quite slow.
In fact, my only purpose is to brighten up a dim photo. But if I just
increase the value of Y channel, the resulting image will be quite
dull(not colorful enough).
Rgds,
Jason
"RA Scheltema" <r.a.scheltema[viral][s][p]@[m]dacolian.nl> wrote in message news:<4044470d$0$562$e4fe...@news.xs4all.nl>...
>The saturation I mean is the color saturation. Are there a formula for
>me to increase the color sturation of a ycbcr image?
>Why I want to do this is that, for example, the photo is too dark now,
>I want to brighten it so I increase the Y of the image. However, I
>found the color of the resulting image is qiute dull. So I want to
>increase the saturation of the image too. (I want to manipulate the
>image in ycbcr color space only)
You would do well to look at the mathematics of the operations you want
to do. First figure out how you'd do them in RGB space. Then figure
out what you'd have to do to take pixels in YCbCr space, convert to RGB,
perform that operation, and convert back to YCbCr. For many operations,
the result can be expressed directly in YCbCr without converting to RGB
at all.
For example, to brighten an area in RGB, you simply multiply each of RGB
by a constant factor. To brighten an area in YCbCr, you also multiply
each component by a factor, but
- Remember that zero intensity is not at a pixel code value of zero
for Y. You want to multiply the intensity, not the pixel code.
- Note that Cb and Cr are signed quantities
- The scale factors used in the RGB to YCbCr transformation probably
mean that you have to use different scale factors for each of Y, Cb,
and Cr.
If you increase Y without proportionally changing Cb and Cr, of course
you end up with desaturated colour.
YCbCr is a particularly easy space to adjust saturation only: you just
scale the Cb and Cr values without changing Y. Beware that you can
create colours this way that cannot be converted back to RGB.
Dave
>In fact, my only purpose is to brighten up a dim photo. But if I just
>increase the value of Y channel, the resulting image will be quite
>dull(not colorful enough).
That's because increasing the Y channel only is the wrong way to
brighten a YCbCr image! You need to change all 3 values.
Dave
> You would do well to look at the mathematics of the operations you want
> to do. First figure out how you'd do them in RGB space. Then figure
> out what you'd have to do to take pixels in YCbCr space, convert to RGB,
> perform that operation, and convert back to YCbCr. For many operations,
> the result can be expressed directly in YCbCr without converting to RGB
> at all.
I know exactly what you mean. But the real implementation seems very
complicated.
> For example, to brighten an area in RGB, you simply multiply each of RGB
> by a constant factor. To brighten an area in YCbCr, you also multiply
> each component by a factor, but
The target operation I am going to do is to use a convex shaped
monotonic increasing 1D look up table (1D-LUT-RGB) to tranform the RGB
image. But the input image is YCbCr format now. What I want to have is
three 1D look up tables for Y, Cb and Cr respectively such that these
three transformations will make the same effect as 1D-LUT-RGB in RGB
domain.
e.g. below is a sample of 1D-LUT-RGB:
static const UInt8 curveMid[256] =
{0,2,4,5,7,9,11,13,15,16,18,20,22,23,25,27,29,31,32,34,36,38,39,41,43,45,46,48,50,51,53,55,56,58,60,62,63,65,66,68,70,71,73,75,76,78,79,81,83,84,86,87,89,90,92,93,95,96,98,99,101,102,104,105,107,108,110,111,112,114,115,116,118,119,121,122,123,124,126,127,128,130,131,132,133,134,136,137,138,139,140,141,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,162,163,164,165,1
6,167,168,169,170,171,172,173,173,174,175,176,177,178,179,180,181,182,182,183,184,185,186,187,188,189,189,190,191,192,193,194,195,195,196,197,198,199,200,200,201,202,203,204,204,205,206,207,208,208,209,210,211,212,212,213,214,215,215,216,217,218,218,219,220,220,221,222,222,223,224,225,225,226,227,227,228,229,229,230,230,231,232,232,233,233,234,235,235,236,236,237,237,238,239,239,240,240,241,241,24
,242,243,243,244,244,244,245,245,246,246,247,247,247,248,248,249,249,249,250,250,250,251,251,251,252,252,252,253,253,253,253,254,254,254,254,254,255,255,255};
Is it possible to get the three look up tables in YCbCr space as
described above?
Rgds,
Jason
Conterintuitively, perhaps not:
http://www.sgi.com/grafica/interp/
The sharpening example is ... surprising.
BugBear