PeteyMi / openjpeg

Automatically exported from code.google.com/p/openjpeg
Other
0 stars 0 forks source link

opj_decompress.exe in openjpeg 2.0 fails to decompress Pléiades image #210

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. download and install openjpeg 2.0 on Windows PC
2. run opj_decompress.exe with a Pléiades image from French satellite agency 
CNES 
3.

What is the expected output? What do you see instead?

Instead of output a decompressed file, it gives the following message and then 
crashed

D:\bdata>opj_decompress.exe -i IMG_PHR1A_P_201212160445321_SEN_599332101-001_R1C
1.JP2 -o t.tif

[INFO] Start to read j2k main header (1849).
[INFO] Main header has been correctly decoded.
[INFO] No decoded area parameters, set the decoded area to the whole image
[INFO] Header of tile 0 / 319 has been read.
[INFO] Tile 1/320 has been decoded.

opj_decompress.exe has encountered a problem and needs to close.  We are sorry 
for the inconvenience.

What version of the product are you using? On what operating system?

I am using openjpeg 2.0 on Windows XP

Please provide any additional information below.

The image is JP2 format. opj_dump.exe works, and output the following 
information:

D:\bdata>opj_dump.exe -i IMG_PHR1A_P_201212160445321_SEN_599332101-001_R1C1.JP2

[INFO] Start to read j2k main header (1849).
[INFO] Main header has been correctly decoded.
Image info {
         x0=0, y0=0
         x1=40730, y1=32600
         numcomps=1
                 component 0 {
                 dx=1, dy=1
                 prec=8
                 sgnd=0
        }
}
Codestream info from main header: {
         tx0=0, ty0=0
         tdx=2048, tdy=2048
         tw=20, th=16
         default tile {
                 csty=0x1
                 prg=0x2
                 numlayers=5
                 mct=0
                 comp 0 {
                         csty=0x1
                         numresolutions=6
                         cblkw=2^6
                         cblkh=2^6
                         cblksty=0
                         qmfbid=1
                         preccintsize (w,h)=(6,6) (6,6) (7,7) (7,7) (8,8) (8,8)

                         qntsty=0
                         numgbits=1
                         stepsizes (m,e)=(0,9) (0,10) (0,10) (0,11) (0,10) (0,10
) (0,11) (0,10) (0,10) (0,11) (0,10) (0,10) (0,10) (0,9) (0,9) (0,10)
                         roishift=0
                 }
         }
}
Codestream index from main header: {
         Main header start position=1849
         Main header end position=1954
         Marker list: {
                 type=0xff4f, pos=1849, len=2
                 type=0xff51, pos=1851, len=43
                 type=0xff52, pos=1894, len=20
                 type=0xff5c, pos=1914, len=21
                 type=0xff64, pos=1935, len=19
         }
}

Original issue reported on code.google.com by zhangcs...@gmail.com on 7 Mar 2013 at 12:54

Attachments:

GoogleCodeExporter commented 9 years ago
Where can I download that

 IMG_PHR1A_P_201212160445321_SEN_599332101-001_R1C1.JP2

image?

winfried

Original comment by szukw...@arcor.de on 11 Mar 2013 at 6:22

GoogleCodeExporter commented 9 years ago
Hi 
Could you try to open your image with Monteverdi application please.
You can find the installer:  http://orfeo-toolbox.org/otb/monteverdi.html

Moreover could you please try to open one sample from spot image : 
http://www.astrium-geo.com/fr/364-produits-de-demonstration and try with it

Best
Mickael

Original comment by savmick...@gmail.com on 12 Mar 2013 at 4:18

GoogleCodeExporter commented 9 years ago
Hi Mickael,

thanks. I have downloaded Monteverdi, and found it can read and display my 
Pléiades data. I have also downloaded sample Pléiades image from the Astrium 
website.  Monteverdi works. But when I use opj_decompress.exe from openjpeg, I 
received the same errors. See below. 
IMG_PHR1A_PMS-N_201202250025599_SEN_PRG_FC_5844-001_R1C1.JP2 is a sample 
Pléiades image over Melbourne Australia I downloaded from the website. 

H:\Downloads\FCGC600031034\IMG_PHR1A_PMS-N_001>opj_decompress.exe -i 
IMG_PHR1A_PMS-N_201202250025599_SEN_PRG_FC_5844-001_R1C1.JP2 -o t.tif           

           [INFO] Start to read j2k main header (1850).                         
           [INFO] Main header has been correctly decoded.                       
           [INFO] No decoded area parameters, set the decoded area to the whole 
image      [INFO] Header of tile 0 / 259 has been read.                         
           [INFO] Tile 1/260 has been decoded.                                  
           [ERROR] Failed to decode the codestream in the JP2 file              

ERROR -> opj_decompress: failed to decode image!                                

Original comment by zhangcs...@gmail.com on 13 Mar 2013 at 12:09

GoogleCodeExporter commented 9 years ago
Hi winfried,

IMG_PHR1A_P_201212160445321_SEN_599332101-001_R1C1.JP2 is an image we received 
recently. I can send you for test. the file is around 700M. please tell me how 
I can upload?

Thanks,
CZhang

Original comment by zhangcs...@gmail.com on 13 Mar 2013 at 12:11

GoogleCodeExporter commented 9 years ago
CZhang,

please give me an address for downloading the file via 'wget'.

winfried

Original comment by szukw...@arcor.de on 13 Mar 2013 at 4:00

GoogleCodeExporter commented 9 years ago
Mikaël,

Monteverdi2-0.2.0

needs

OTB-3.16

needs

gdal-1.9.2:

checking for opj_decode_tile_data in -lopenjpeg... no

CONFIGURE obviously looks for the old V2 openjpeg, not
the new V2 openjp2 the is called '-lopenjp2'.

That is nothing for me: why shall I test an unused library?

winfried

Original comment by szukw...@arcor.de on 13 Mar 2013 at 4:48

GoogleCodeExporter commented 9 years ago
Hi Winfried,

I have downloaded a windows exe version of Monteverdi. it works perfectly with 
Pléiades imagery. 

czhang

Original comment by zhangcs...@gmail.com on 13 Mar 2013 at 11:30

GoogleCodeExporter commented 9 years ago
Winfried,

Please use the Monteverdi 1.x, the Monteverdi2 is just an alpha demo for the 
moment.
OTB don't use gdal to read jpeg2000, it used its own image reader 
JPEG2000ImageIO.cxx based on a specific version number of the trunk of openjpeg 
just before release.
However the next version of gdal will use the openjpeg 2.0.

Mickaël

Original comment by savmick...@gmail.com on 13 Mar 2013 at 1:09

GoogleCodeExporter commented 9 years ago
CZang,
Could you please indicate me more information :
* about your system (32/64 bit, size of you RAM) 
* about how you get openjpeg 2.0 : official package, compile from source ?
* confirm that one sample from the spot website give you a crash (please give 
me the name)

If you the right to transmit the file please give us a link. 

Original comment by savmick...@gmail.com on 13 Mar 2013 at 1:19

GoogleCodeExporter commented 9 years ago
Hi,

1) I am using 32 bit windows xp with 4G ram
2) I download openjpeg-2.0.0-win32-x86.exe from openjpeg 2.0 website and 
installed in my computer.
3) I can send a Pléiades image to openjpeg for research and testing. Please 
tell to how to upload. I will then do it tomorrow when I return to office.

Original comment by zhangcs...@gmail.com on 13 Mar 2013 at 1:46

GoogleCodeExporter commented 9 years ago
Hi,
Thanks for your information
You can use google drive and send me in private the link or http://dl.free.fr/ 
(this one is in french)
Mickaël

Original comment by savmick...@gmail.com on 13 Mar 2013 at 1:57

GoogleCodeExporter commented 9 years ago
Mickaël,

I compiled gdal-1.10 beta (the latest version) with openjpeg 2.0, and tried to 
open Pléiades image. Failed. 

Original comment by zhangcs...@gmail.com on 13 Mar 2013 at 2:04

GoogleCodeExporter commented 9 years ago
I sent a private email to zhangcs.06 with a link to my ftp server. The issue is 
that his image is 700Mo which is clearly above the limit for dl.free.fr AFAIK

Original comment by mathieu.malaterre on 13 Mar 2013 at 2:20

GoogleCodeExporter commented 9 years ago
hi,Mathieu 

I have uoloaded two Pléiades images to your ftp server at: ftp://voxxl.fr. the 
large size is panchromatic (~700M), the smaller size is multispectral. 
opj_decompress.exe works successfully on the MS data, but fails on the pan 
image. Please help to solve this problem. 

czhang

Original comment by zhangcs...@gmail.com on 14 Mar 2013 at 5:31

GoogleCodeExporter commented 9 years ago
Here is my very humble comments. Both files are corrupted the very same way. It 
looks as if they were received using an ftp/ASCII transfer protocol. Indeed the 
very first bytes are:

00 00 00 0C 6A 50 20 20  0A 87 0A 00 00 00 14 66

while I believe they should be:

00 00 00 0C 6A 50 20 20  0D 0A 87 0A 00 00 00 14

Original comment by mathieu.malaterre on 14 Mar 2013 at 9:48

GoogleCodeExporter commented 9 years ago
Here is what I have on my side:

$ md5sum IMG_PHR1A_*
f650616fb8490f0d7b5fab0695200908  
IMG_PHR1A_MS_201212160445321_SEN_599332101-002_R1C1.JP2
ce5ca60966ed3c55100584ff865ddcee  
IMG_PHR1A_P_201212160445321_SEN_599332101-001_R1C1.JP2

Original comment by mathieu.malaterre on 14 Mar 2013 at 9:57

GoogleCodeExporter commented 9 years ago
Mathieu, you are right. my mistake. let me do again tomorrow.

Original comment by zhangcs...@gmail.com on 14 Mar 2013 at 10:41

GoogleCodeExporter commented 9 years ago
Mikaël,

I have downloaded libproj4, libgeotiff, gdal, OTB and Monteverdi.

I have spent about 10 hours to compile and install these libraries.

When 'monteverdi' tries to uncompress I get the message:

 The kernel rejected CS, see dmesg for more information

And dmesg shows:

[ 2509.831161] radeon 0000:01:00.0: evergreen_surface_value_conv_check:332 
cb invalid array mode 6
[ 2509.831165] radeon 0000:01:00.0: evergreen_packet3_check:2149 
invalid cmd stream 502
[ 2509.831167] [drm:radeon_cs_ib_chunk] *ERROR* Invalid command stream !
(...)

I can only say: I shows something.

winfried

Original comment by szukw...@arcor.de on 14 Mar 2013 at 11:57

GoogleCodeExporter commented 9 years ago
The address

 ftp://voxxl.fr

shows a 'welcome.msg'.

winfried

Original comment by szukw...@arcor.de on 14 Mar 2013 at 12:04

GoogleCodeExporter commented 9 years ago
hi all,

I uploaded the two JP2 Pléiades images again today to ftp://voxxl.fr.

As I said, the opj_decompress.exe works on the MS data (smaller size), but 
fails on the panchromatic data (larger size).

Original comment by zhangcs...@gmail.com on 15 Mar 2013 at 9:57

GoogleCodeExporter commented 9 years ago
I have try your file, the fail is normal because opj_decompress application use 
functions which need to allocate all the data buffer before run decompression. 
The size of this buffer is based on the image size. So in the case of the PAN 
image it will be to big for a pc with not enough RAM.
In monteverdi we requested only tiles and not the entire image. 
Mickaël  

Original comment by savmick...@gmail.com on 21 Mar 2013 at 5:49

GoogleCodeExporter commented 9 years ago
Thank Mickael.

How can we read tile by tile for large JP2 Pléiades images? It will be nice 
openjpeg group helps us in this issue.

Original comment by zhangcs...@gmail.com on 22 Mar 2013 at 3:28

GoogleCodeExporter commented 9 years ago
Hi ,
You can take a look to the OTB code (JPEG2000ImageIO) to see how we do that. 
However its is true we need to upgrade the application to support tiling 
decompression.
For the moment we don't have funds to work on it. It depends only to the free 
time of few people.
Mickaël

Original comment by savmick...@gmail.com on 24 Mar 2013 at 11:31

GoogleCodeExporter commented 9 years ago
Seems to be working nicely now:

$ opj_decompress -i IMG_PHR1A_P_201212160445321_SEN_599332101-001_R1C1.JP2 -o 
toto.raw
[...]
[INFO] Header of tile 318 / 319 has been read.
[INFO] Tile 319/320 has been decoded.
[INFO] Image data has been updated with tile 319.

[INFO] Header of tile 319 / 319 has been read.
[INFO] Tile 320/320 has been decoded.
[INFO] Image data has been updated with tile 320.

[INFO] Stream reached its end !
Raw image characteristics: 1 components
Component 0 characteristics: 40730x32600x8 unsigned
Successfully generated Outfile toto.raw

Original comment by mathieu.malaterre on 25 Feb 2014 at 12:54

GoogleCodeExporter commented 9 years ago

Original comment by mathieu.malaterre on 28 Feb 2014 at 8:33