Re: Writing JPEG2000 file [message #45401] |
Fri, 09 September 2005 06:26  |
raval.chintan
Messages: 54 Registered: May 2005
|
Member |
|
|
Hello,
One more thing i want to know is that When i m writing my file with
above ( In my previous Query) parameter, My original data is being lost
, So what parameter i should pass to IDLffJPEG2000 so that i can
generate a loss less JPEG2000 file.
Again Thanks In Advance.
Chintan Raval
|
|
|
|
Re: Writing JPEG2000 file [message #45406 is a reply to message #45402] |
Thu, 08 September 2005 16:26   |
Andrew Cool
Messages: 219 Registered: January 1996
|
Senior Member |
|
|
Haje Korth wrote:
> Raval,
> If displayed on a single monitor, the image will not reflect the resolution
> of the data set and thereofre you can safely used 'rebin' to turn the data
> into a 1000x1000 array, which inturn should work with your code. If this
> resolution is insuffient, try tiling the image.
>
> Haje
>
>
> <raval.chintan@gmail.com> wrote in message
> news:1126087454.579398.30090@g44g2000cwa.googlegroups.com...
>> Hello,
>>
>> I want to generate the JPEG2000 file from the tiff file which is
>> containing 20000 samples and 20000 lines, I am writing the following
>> code.
>>
>>
>> jp2filename = 'abc'
>> Data = read_tiff('c:\satellite.tif')
>> imageDims = Size(data,/Dimension)
>>
>> ; Prepare JPEG2000 object property values.
>> ncomponents = 3
>> nLayers = 20
>> nLevels = 6
>> offset = [0,0]
>> jp2TileDims = [1024, 1024]
>> jp2TileOffset = [0,0]
>> bitdepth = [8,8,8]
>>
>> ; Create the JPEG2000 image object.
>> oJP2File = OBJ_NEW('IDLffJPEG2000',jp2filename , WRITE=1)
>> oJP2File->SetProperty, N_COMPONENTS=nComponents, $
>> N_LAYERS=nLayers, $
>> N_LEVELS=nLevels, $
>> OFFSET=offset, $
>> TILE_DIMENSIONS=JP2TileDims, $
>> TILE_OFFSET=JP2TileOffset, $
>> BIT_DEPTH=bitDepth, $
>> DIMENSIONS=[imageDims[1],ImageDims[2]]
>>
>>
>> oJP2FILE->SetData, Data
>> OBJ_DESTROY, oJP2FILE
>>
>>
>>
>> Now the problem is that IDL 6.2 is unable to allocate the memory for
>> storing the data.
>>
>> Is there any other way to do this? If yes Then How one can do it?
>>
>> Thanks In Advance.
>>
>> Chintan Raval.
>>
Haje,
Raval's code comes from RSI's example tilingjp2.pro, which demonstrates
progressive zooming into more detailed image layers using the pyramid
functionality of JPEG2000 files.
Hence rebinning the image down probably won't tie in with why Raval is
using
that code.
I've tried using the same code for a *large* chunk of SRTM 3 arcsec
data,
and have concluded that using a 32 bit OS (Windows) just ain't gonna do
it for me.
I'll be switching to 64 bit IDL on Linux.
Andrew
|
|
|
Re: Writing JPEG2000 file [message #45429 is a reply to message #45406] |
Thu, 08 September 2005 05:03   |
Haje Korth
Messages: 651 Registered: May 1997
|
Senior Member |
|
|
Raval,
If displayed on a single monitor, the image will not reflect the resolution
of the data set and thereofre you can safely used 'rebin' to turn the data
into a 1000x1000 array, which inturn should work with your code. If this
resolution is insuffient, try tiling the image.
Haje
<raval.chintan@gmail.com> wrote in message
news:1126087454.579398.30090@g44g2000cwa.googlegroups.com...
> Hello,
>
> I want to generate the JPEG2000 file from the tiff file which is
> containing 20000 samples and 20000 lines, I am writing the following
> code.
>
>
> jp2filename = 'abc'
> Data = read_tiff('c:\satellite.tif')
> imageDims = Size(data,/Dimension)
>
> ; Prepare JPEG2000 object property values.
> ncomponents = 3
> nLayers = 20
> nLevels = 6
> offset = [0,0]
> jp2TileDims = [1024, 1024]
> jp2TileOffset = [0,0]
> bitdepth = [8,8,8]
>
> ; Create the JPEG2000 image object.
> oJP2File = OBJ_NEW('IDLffJPEG2000',jp2filename , WRITE=1)
> oJP2File->SetProperty, N_COMPONENTS=nComponents, $
> N_LAYERS=nLayers, $
> N_LEVELS=nLevels, $
> OFFSET=offset, $
> TILE_DIMENSIONS=JP2TileDims, $
> TILE_OFFSET=JP2TileOffset, $
> BIT_DEPTH=bitDepth, $
> DIMENSIONS=[imageDims[1],ImageDims[2]]
>
>
> oJP2FILE->SetData, Data
> OBJ_DESTROY, oJP2FILE
>
>
>
> Now the problem is that IDL 6.2 is unable to allocate the memory for
> storing the data.
>
> Is there any other way to do this? If yes Then How one can do it?
>
> Thanks In Advance.
>
> Chintan Raval.
>
|
|
|
|
Re: Writing JPEG2000 file [message #45441 is a reply to message #45440] |
Wed, 07 September 2005 14:17   |
David Alexander
Messages: 26 Registered: August 2005
|
Junior Member |
|
|
Chintan,
What are the dimensions of the image in your tiff file?
One thing you might try: write each tile individually. So, let's say
you have a 2048x2048 tiff file, and you want to write a jpeg2000 file
with tile dimensions of 1024x1024 (so there are four tiles), you could
do something like this:
oJP2FILE->SetData, Data[*,0:1023,0:1023],TILE_INDEX=0
oJP2FILE->SetData, Data[*,1024:2047,0:1023],TILE_INDEX=1
oJP2FILE->SetData, Data[*,0:1023,1024:2047],TILE_INDEX=2
oJP2FILE->SetData, Data[*,1024:2047],TILE_INDEX=3
You probably have larger tiff files, but this is the idea.
David
|
|
|
Re: Writing JPEG2000 file [message #45535 is a reply to message #45402] |
Mon, 12 September 2005 10:52  |
David Alexander
Messages: 26 Registered: August 2005
|
Junior Member |
|
|
Chintan,
The default when writing JPEG2000 is lossy compression. To get lossless
compression, you need to set the REVERSIBLE property to true. The best
way is probably to set it when you create your JPEG2000 object.
Something like this:
oJP2=OBJ_NEW('IDLffJPEG2000',filename,/WRITE,/REVERSIBLE)
adding, of course, any other properties you additionally want to set.
David
|
|
|