Re: JPEG2000 compression [message #43466 is a reply to message #41151] |
Wed, 13 April 2005 12:55   |
Roberto Monaco
Messages: 11 Registered: August 2002
|
Junior Member |
|
|
>> I have a question regarding JPEG2000:
>>
>> How do you control compression ratio when you save an image as JPEG2000
>> using the IDL object?
>
> Looks like the N_LEVELS property.
Yes, from the documentation you would expect N_LEVELS to be responsible for
compression.
This is the code I am using:
jp2 = obj_new('IDLffJPEG2000', jp2_file, /WRITE)
jp2->SetProperty, N_LEVELS=15
jp2->SetProperty, TILE_DIMENSIONS=[2048.,2048.]
jp2->SetData, image, /ORDER
obj_destroy, jp2
If I set N_LEVELS to 5 in the second line (the default) and run it again for
the same image (same input file) I get both times jp2 files of the same
dimension (31 MB) ?!?! I am obviously missing something here.
Perhaps one could define N levels and somehow store only some of these
levels, discarding for example the 2 higher resolution levels? But I don't
see a way of doing something like this, in SetData or elsewhere.
>> The following is curious: within a Photoshop plug-in I use to save
JPEG2000
>> images, "they" define a compression factor. If I save the same image
with
>> different compressions ratios (e.g. 1:1, 1:10, 1:40) I obviously get big
>> differences in the resulting file sizes. But if you read these files
into
>> IDL objects, surprisingly all properties are exactly the same!! Same
>> dimensions for the data array, same bit_depth, same number of layers,
etc.
>> ?? This does not make any sense to me ... I must be overlooking at
something
>> stupid?
>
> Well, I know nothing about JPEG2000 but I would hope that all of the
> properties that you have specified *would* be identical. The only
> property that should change would be the compression factor. Don't know
> where that would be though. Maybe the N_LEVELS property again? Don't
> know if that would be set after reading a file or if it only applies to
> writing.
These images were created ouside IDL, in Photoshop saving the same TIFF
image as JP2 using different compression ratios each time. Afterwards when I
read them within IDL I would expect to see differences in their properties,
since one corresponds to 1:1 (~30 MB of data) and another to 1:40 (~3 MB of
data). But N_LEVELS, as ALL the other properties, are exactly the same for
all cases...
By the way there is no compression property in 'IDLffJPEG2000' object
structure.
Roberto
|
|
|