Re: [OpenJPEG] Lossless compression ratio

541 views
Skip to first unread message

Mathieu Malaterre

unread,
Apr 15, 2013, 5:22:35 AM4/15/13
to open...@googlegroups.com
On Mon, Apr 15, 2013 at 11:11 AM, <tiany...@gmail.com> wrote:
> Hi,
>
> I use opj_compress (openjpeg v2.0) to compress a raw image (original size
> is 512K) losslessly, the compressed image size is 267K.
> The argument is like below:
> opj_compress -i image.raw -o image.j2k -n 3 -c
> [128,128],[128,128],[64,64],[64,64] -b 32,32 -p RPCL -F 512,512,1,16,u
>
> But I use kakadu to compress the same raw image with same parameters, the
> compressed image is only 82K.

Please include the *exact* command you used when compressing with kakadu.

Thanks,
--
Mathieu

Antonin Descampe

unread,
Apr 15, 2013, 5:53:12 AM4/15/13
to open...@googlegroups.com

Hi,

OpenJPEG defaults to lossless compression while Kakadu uses lossy compression (irreversible wavelet transform by default).

For lossy compression with openjpeg : use "-I" option.

For lossless compression with kakadu : use "Creversible=yes" option.

cheers,

A
> --
> You are subscribed to the mailing-list of the OpenJPEG project (www.openjpeg.org)
> To post: email to open...@googlegroups.com
> To unsubscribe: email to openjpeg+u...@googlegroups.com
> For more options: visit http://groups.google.com/group/openjpeg
> For more info about OpenJPEG main partners : visit www.tele.ucl.ac.be (UCL) and www.intopix.com
>
>

Mathieu Malaterre

unread,
Apr 15, 2013, 5:58:59 AM4/15/13
to open...@googlegroups.com
Well the other issue I see is that .raw means big endian for kakadu
while .raw simply means raw for openjpeg.
So reading a 16bits raw image is fairly different when reading big vs
little endian...
--
Mathieu

tiany...@gmail.com

unread,
Apr 15, 2013, 9:37:29 PM4/15/13
to open...@googlegroups.com
Hi Mathieu and Antonin,

 Thanks for your reply.
 The exact command I used to compress image using kakadu is below:

kdu_buffered_compress.exe -i image.raw -o image.j2k -little_endian Sdims={512,512} Sprecision=16 Ssigned=no Ckernels=W5X3 Catk=0 Clevels=3 Cprecincts={128,128},{128,128},{64,64},{64,64} Scomponents=1 Corder=RPCL

It is lossless compression. I add the option Creversible=yes, the result is same, the compressed image is 82K.

Thanks,

tiany...@gmail.com

unread,
Apr 15, 2013, 10:03:04 PM4/15/13
to open...@googlegroups.com

It is because the byte order.
The image is little endian. I use -little_endian to compress image using kakadu, the compressed file size is 82K.
When I removed the -little_endian option, the compressed file size is 263K.

Does openjpeg read the image in big endian order? Do I need to transform the raw image to big endian order?


On Monday, April 15, 2013 5:58:59 PM UTC+8, mathieu wrote:

Mathieu Malaterre

unread,
Apr 16, 2013, 5:40:15 AM4/16/13
to open...@googlegroups.com
On Tue, Apr 16, 2013 at 4:03 AM, <tiany...@gmail.com> wrote:
> Does openjpeg read the image in big endian order? Do I need to transform the
> raw image to big endian order?

Yes. I used

dd conv=swab if=in.raw of=out.raw

and now kakadu and openjpeg are giving similar results.

Please fill in a bug report saying something like '-F does not allow
specifying big endian vs little endian'

Thanks,
--
Mathieu
Reply all
Reply to author
Forward
0 new messages