From: Czterysta Czwarty on
Hi!

I need your help to finish my image compression project.

How to build a BufferedImage class to support YCbCr color scheme
(luminance channel and two chrominance)?
Can you give me some tips, what I should to change?

I was thinking about adding getYCbCr() method, which would be used
getRGB() and calculate new values for each pixel, but I would like to
build a class, which fully served by this model, only getting lost in
class ColorModel, Raster, etc.

Have anybody ever changed it and can help me?
From: Jeff Higgins on
On 5/3/2010 3:19 PM, Czterysta Czwarty wrote:
> Hi!
>
> I need your help to finish my image compression project.
>
> How to build a BufferedImage class to support YCbCr color scheme
> (luminance channel and two chrominance)?
> Can you give me some tips, what I should to change?
>
> I was thinking about adding getYCbCr() method, which would be used
> getRGB() and calculate new values for each pixel, but I would like to
> build a class, which fully served by this model, only getting lost in
> class ColorModel, Raster, etc.
>
> Have anybody ever changed it and can help me?

This is way outside of what I've done with images, but:
what happens if you construct a BufferedImage with a ColorModel
that has been constructed with a ColorSpace.getInstance(TYPE_YCbCr)
and appropriate values for all the other construction parameters?
Does a call to your BufferedImage's .getRGB() return an appropriate value?



From: Czterysta Czwarty on
On 4 Maj, 04:09, Jeff Higgins <oohigg...(a)yahoo.com> wrote:
> This is way outside of what I've done with images, but:
> what happens if you construct a BufferedImage with a ColorModel
> that has been constructed with a ColorSpace.getInstance(TYPE_YCbCr)
> and appropriate values for all the other construction parameters?

I wrote this:

ColorSpace cs = ColorSpace.getInstance(ColorSpace.TYPE_YCbCr);
int[] bits = { 8, 8, 8 };
ColorModel cm = new ComponentColorModel(cs, bits, false, false,
Transparency.OPAQUE, DataBuffer.TYPE_BYTE);

but I still don't know how to convert pixel colors there and back. I
need getLuminance() method etc.
From: Lew on
Czterysta Czwarty wrote:
> but I still don't know how to convert pixel colors there and back. I
> need getLuminance() method etc.

Do you have one minute? Because if you have one minute, you'll find
that the first hit on
<http://www.google.com/search?hl=en&q=ycbcr+Java>
is
<http://www.f4.fhtw-berlin.de/~barthel/ImageJ/ColorInspector//HTMLHelp/
farbraumJava.htm>
..

GIYF.

--
Lew
From: Czterysta Czwarty on
On 5 Maj, 21:15, Lew <l...(a)lewscanon.com> wrote:
> Czterysta Czwarty wrote:
> > but I still don't know how to convert pixel colors there and back. I
> > need getLuminance() method etc.
>
> Do you have one minute?  Because if you have one minute, you'll find
> that the first hit on
> <http://www.google.com/search?hl=en&q=ycbcr+Java>
> is
> <http://www.f4.fhtw-berlin.de/~barthel/ImageJ/ColorInspector//HTMLHelp/
> farbraumJava.htm>
> .
>
> GIYF.
>
> --
> Lew

I found this, but I want to do this with ColorModel and ColorSpace and
I don't know how?