Geodecode JP2

For discussion of LizardTech's free Decode SDK for MrSID and JPEG 2000.

Moderator: jskiffington

Geodecode JP2

Postby Brian Johnson » Fri Nov 06, 2009 7:32 am

I am trying to convert a JP2 file to another format so that I can use it with Microstation. When I use mrsidgeodecode and try to convert the jp2 to a tif, I get a black image. When I try to convert the JP2 to a jpg I get *** error: unsupported colorspace [50402]

Any help would be appreciated!
Thanks
Brian Johnson
 
Posts: 4
Joined: Fri Nov 06, 2009 7:25 am

Postby mpg » Fri Nov 06, 2009 9:11 am

Can you pls post the output from mrsidinfo for this file?

-mpg
mpg
 
Posts: 29
Joined: Thu Jan 24, 2008 1:50 pm
Location: LizardTech

Postby Brian Johnson » Fri Nov 06, 2009 10:06 am

MPG,

Here's the mrsidinfo output:

basic image info:
format: JPEG 2000 (Part 2)
width: 67911
height: 42810
nband: 4
color space: RGBA
datatype: uint8
precision: 8
dyn range min: (natural)
dyn range max: (natural)
background color: (0, 0, 0, 0)
nodata color: (none)
nominal size: 11629079640 (11 GB)
physical size: 1758936234 (2 GB)
compression ratio: 6.6 : 1
mag range: 0.000061 to 1.000000
metadata records: 15
num AOI regions: 0

geo coordinate info:
X UL: 320717.500000
Y UL: 4089573.500000
X res: 1.000000
Y res: -1.000000
X rot: 0.000000
Y rot: 0.000000

geo points (pixel centers):
upper left: (320717.500000, 4089573.500000)
upper right: (388627.500000, 4089573.500000)
lower left: (320717.500000, 4046764.500000)
lower right: (388627.500000, 4046764.500000)
center: (354672.500000, 4068169.000000)

JP2 image info:
number of resolution levels: 14
number of quality layers: 30
tile size: (4096,4096)
precision: 8
codeblock size: (64,64)
precincts: 0=(256,256) 1=(256,256) 2=(256,256) 3=(256,256) 4=(256,256) 5=(256,256) 6=(256,256) 7=(256,256) 8=(256,256) 9=(256,256) 10=(256,256) 11=(256,256) 12=(256,256) 13=(256,256) 14=(256,256)
progression order: RPCL
9-7 wavelet: true

Thanks again for your help!
Brian Johnson
 
Posts: 4
Joined: Fri Nov 06, 2009 7:25 am

Postby mpg » Fri Nov 06, 2009 10:15 am

The colorspace of the JP2 image is RGB4 -- it is a four-banded dataset of {red,green,blue,alpha}.

RGBA is not a supported colorspace for JPG, so a simple decoder conversion won't work.

I'm not sure why TIFF wouldn't work, though, since I'm pretty sure TIFF supports alpha channels. (Maybe it is because you've exceeded the 2GB tiff limit? (unless you're using a Bigtiff library))

-mpg
mpg
 
Posts: 29
Joined: Thu Jan 24, 2008 1:50 pm
Location: LizardTech

Postby Brian Johnson » Fri Nov 06, 2009 11:52 am

MPG,

Here's what I'm doing to produce a tif. As a test run I'm just using a 1000x1000 piece of it. so the command I'm using is as follows.

mrsidgeodecode -i temp.jp2 -o temp.tif -ulxy 0 0 -wh 1000 1000

and I get the following

mrsidgeodecode: (c) 2008 LizardTech, Inc. All rights reserved.


input:
width: 67911
height: 42810
upper-left X: 320717.500000
upper-left Y: 4089573.500000
X scale: 1.000000
Y scale: -1.000000

output:
width: 1000
height: 1000
upper-left X: 320717.500000
upper-left Y: 4089573.500000
X scale: 1.000000
Y scale: -1.000000
format: TIFF

however when I go to view the file its all black

here's the mrsidgeoinfo for the temp.tif that it created

mrsidgeoinfo: (c) 2008 LizardTech, Inc. All rights reserved.

basic image info:
format: TIFF
width: 1000
height: 1000
nband: 4
color space: RGBA
datatype: uint8
precision: 8
dyn range min: (natural)
dyn range max: (natural)
background color: (none)
nodata color: (none)
nominal size: 4000000 (4 MB)
physical size: 4001194 (4 MB)
compression ratio: 1.0 : 1
mag range: 1.000000 to 1.000000
metadata records: 11
num AOI regions: 0

geo coordinate info:
X UL: 0.000000
Y UL: 999.000000
X res: 1.000000
Y res: -1.000000
X rot: 0.000000
Y rot: 0.000000

geo points (pixel centers):
upper left: (0.000000, 999.000000)
upper right: (999.000000, 999.000000)
lower left: (0.000000, 0.000000)
lower right: (999.000000, 0.000000)
center: (499.500000, 499.500000)

Does any of this info help?
Is there something I'm missing?

Thanks
Brian Johnson
 
Posts: 4
Joined: Fri Nov 06, 2009 7:25 am

Postby mpg » Fri Nov 06, 2009 2:42 pm

Might it be that the upperleft of the image is, in fact, all black data? Try extracting some different sections of the image to make sure.

Then, you should next verify that the tiff reader you are using is properly interpreting the 4-banded RGBA data.

-mpg
mpg
 
Posts: 29
Joined: Thu Jan 24, 2008 1:50 pm
Location: LizardTech

Postby Brian Johnson » Tue Nov 10, 2009 1:51 pm

mpg,

I got it, I was indeed extracting a black portion of the image. Once I extracted a section that actually had the aerial on it I was good.

Thanks for your help!
Brian Johnson
 
Posts: 4
Joined: Fri Nov 06, 2009 7:25 am


Return to SDKs

Who is online

Users browsing this forum: No registered users and 1 guest