# Image Compression Using Fourier Transforms

Started by April 23, 2009
```Correction:
...
> because the G multiplier above is 1.
> So in the end you need more multiplications?

Sorry, R and B are subtracted by a amount of G bevor, so G could be
correct calculated!
```
```> Y = 0.299 * R + 0.587 * G + 0.114 * B
> U = (B - Y) * 0.493
> V = (R - Y) * 0.877
>
> than YCbCr could be made this way, only by changing the factors
> for U and V to become Cb and Cr, with 5 multiplications?

That is not lossless.
```
```Mihai Cartoaje schrieb:
>> Y = 0.299 * R + 0.587 * G + 0.114 * B
>> U = (B - Y) * 0.493
>> V = (R - Y) * 0.877
>>
>> than YCbCr could be made this way, only by changing the factors
>> for U and V to become Cb and Cr, with 5 multiplications?
>
> That is not lossless.

What do you mean with losless?
You can add values (beside the right scaling) to the color components
to fit in every window you decide.
You get every time losses in case of rounding errors.

Btw the inverse transform from YUV to RGB needs only 4
multiplications.
But i dont wanted to degrade your code, because a general way
to do a 3x3 matrix transform with only 5 multiplications sounds very
good to me.

Jens

```
```I wrote,

> I posted a comparison between YIQ and YCbCr at,

I corrected an error and redid the comparison:

```
```> What do you mean with losless?
> You can add values (beside the right scaling) to the color components
> to fit in every window you decide.
> You get every time losses in case of rounding errors.

It is lossless because the rounding errors are reversed at
reconstruction. This is the reconstruction algorithm for the above
color transform that is similar to JPEG YCbCr:

B -= round(-0.171 * R)
R -= round(-0.167 * B)
B -= round(-0.171 * R)
G -= round(Kb * B + Kr * R)
B += G
R += G
```