Skip to main content

reading JP2 one band at a time gives corrupted image in some cases

1 reply [Last post]
scyudits
Offline
Joined: 2005-07-15
Points: 0

Hi,

I have a number of test jp2 images, all 24 bit (i.e. 8 bits per pixel, 3 bands) RGB, from which I have been able to correctly read and retrieve one band at a time.

However, applying this same code to a certain other image, also 24 bit RGB, returns a portion of the desired band as just a gray area (all or most of the pixels in this area are corrupted to value -128).

When I try reading two bands at once from this image, there is no such corruption!

int[] srcBands = new int[1];
srcBands[0] = 0; //any of 0, 1, or 2 will reproduce it
Rectangle srcReg = new Rectangle(256,0,256,256); //I am extracting 256x256 windows from the image at a time. This particular window includes the corruption.
J2KImageReadParam jirp = new J2KImageReadParam();
jirp.setResolution(5);
jirp.setDecodingRate(24);
jirp.setSourceRegion(srcReg);
jirp.setDestinationOffset(new Point(0,0));
jirp.setSourceBands(srcBands);
RenderedImage decompIm = imread.readAsRenderedImage(0, jirp);

I can provide the image over email as needed.

Thanks,

Sophia

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bpb
Offline
Joined: 2004-06-23
Points: 0

Sophia,

Would you be able to post or send to me a test case?

Thanks,

Brain

> Hi,
>
> I have a number of test jp2 images, all 24 bit (i.e.
> 8 bits per pixel, 3 bands) RGB, from which I have
> been able to correctly read and retrieve one band at
> a time.
>
> However, applying this same code to a certain other
> image, also 24 bit RGB, returns a portion of the
> desired band as just a gray area (all or most of the
> pixels in this area are corrupted to value -128).
>
> When I try reading two bands at once from this image,
> there is no such corruption!
>
> int[] srcBands = new int[1];
> srcBands[0] = 0; //any of 0, 1, or 2 will reproduce
> it
> Rectangle srcReg = new Rectangle(256,0,256,256); //I
> am extracting 256x256 windows from the image at a
> time. This particular window includes the
> corruption.
> J2KImageReadParam jirp = new J2KImageReadParam();
> jirp.setResolution(5);
> jirp.setDecodingRate(24);
> jirp.setSourceRegion(srcReg);
> jirp.setDestinationOffset(new Point(0,0));
> jirp.setSourceBands(srcBands);
> RenderedImage decompIm =
> imread.readAsRenderedImage(0, jirp);
>
> I can provide the image over email as needed.
>
> Thanks,
>
> Sophia