Skip to main content

[JAI-IMAGEIO] Help needed with J2K applet + large files

9 replies [Last post]
Anonymous

Hi,

I've been struggling with the Jpeg2000 codec for a couple of weeks now, and
am about to give up on a JAI based solution and switch to Kakadu instead...

I'm trying to create an applet for a commercial project that can display
large (2MB to 11MB) Jpeg2000 files. It should be able to change the
contrast/brightness and zoom the image.

My first issues where the fact that reading the JP2 files took a long time.
I managed to speed it up to a couple of seconds, but after reading the
files, it takes another 5 seconds to display the images in a DisplayJAI
view. After it is finally displayed, any JAI operations (like rescale) take
about 8 seconds, and really make the applet unresponsive. When I display
normal JPEG files, everything runs smoothly.

All of this is happening on a windows machine with the native jpeg2000
reader. I've already created a workaround for bug #5076692
(http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5076692) and I've
verified that it's using the native reader, and not the pure java one.

Any thoughts? I'm willing to hire someone on a consultancy basis to help me
out, since our client is waiting for a solution ;-)

Regards,

Bart

--
Bart Matthaei bart@ambrero.nl

Ambrero Software Development
http://www.ambrero.nl/

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Nidel, Mike

> >> Do you know whether the images contain any TLM marker segments?
> >
> > Not sure. How do I check?
>
> Well I'm not sure. The jai-imageio metadata does not
> currently include marker
> segments, JJ2000 does not support TLM, JasPer does not have
> an info utlity,
> and it looks as if Kakadu does not either.
>
> Does anyone have a suggestion aside from writing code?
>
> Brian

well, we used to have a bailment copy of Pegasus jpeg2000 tools,
but i don't think we do anymore. i don't know if you can download
an evaluation copy (probably not) but it's worth a look. licenses
appear to be like $4999 so it's cost prohibitive if you can't get
a free version.

http://www.pegasusimaging.com/pictools.htm

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Simone Giannecchini

Ciao Bart,
I have played quite a lot with the JPEG2K reader/writer in ImageIO
along with big files (working in GIS field...) and yes, it has
limitation when it comes to reading jpeg2k files.

I would like to know a bit more about what you are doing because I
might have an easy solution for your problems. Here you have some
questions (besides the ones Mike asked)

1>Are you willing to use multiple levels jpeg2k?
2>Are your jpeg2k files tiled?
3>Are you scaling the high res image on the fly?
4>How much are you scaling it?

Simone.

On 10/25/06, Bart Matthaei wrote:
> Hi,
>
> I've been struggling with the Jpeg2000 codec for a couple of weeks now, and
> am about to give up on a JAI based solution and switch to Kakadu instead...
>
> I'm trying to create an applet for a commercial project that can display
> large (2MB to 11MB) Jpeg2000 files. It should be able to change the
> contrast/brightness and zoom the image.
>
> My first issues where the fact that reading the JP2 files took a long time.
> I managed to speed it up to a couple of seconds, but after reading the
> files, it takes another 5 seconds to display the images in a DisplayJAI
> view. After it is finally displayed, any JAI operations (like rescale) take
> about 8 seconds, and really make the applet unresponsive. When I display
> normal JPEG files, everything runs smoothly.
>
> All of this is happening on a windows machine with the native jpeg2000
> reader. I've already created a workaround for bug #5076692
> (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5076692) and I've
> verified that it's using the native reader, and not the pure java one.
>
> Any thoughts? I'm willing to hire someone on a consultancy basis to help me
> out, since our client is waiting for a solution ;-)
>
> Regards,
>
> Bart
>
> --
> Bart Matthaei bart@ambrero.nl
>
> Ambrero Software Development
> http://www.ambrero.nl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-imageio.dev.java.net
>
>

--
-------------------------------------------------------
Eng. Simone Giannecchini
President /CEO GeoSolutions

http://www.geo-solutions.it

-------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Bart Matthaei

Ciao Simone,

On Wed, Oct 25, 2006 at 04:10:00PM +0200, Simone Giannecchini wrote:
> Ciao Bart,
> I have played quite a lot with the JPEG2K reader/writer in ImageIO
> along with big files (working in GIS field...) and yes, it has
> limitation when it comes to reading jpeg2k files.
>
> I would like to know a bit more about what you are doing because I
> might have an easy solution for your problems. Here you have some
> questions (besides the ones Mike asked)
>

Here goes:

> 1>Are you willing to use multiple levels jpeg2k?

Please forgive me for asking, but what's 'Multiple levels jpeg2k'?
I'm pretty new to JAI and imaging, as you might have guessed ;-)

> 2>Are your jpeg2k files tiled?

Yes. kdu_show gives me Stiles = 512, 512.

> 3>Are you scaling the high res image on the fly?

Yeah, I apply the scale to the original image, and apply the brightness and
contrast to the scaled down image.

> 4>How much are you scaling it?

By default, it's about 8 times smaller.

Regards,

Bart

--
Bart Matthaei bart@ambrero.nl

Ambrero Software Development
http://www.ambrero.nl/

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Brian Burkhalter

On Wed, 25 Oct 2006, Bart Matthaei wrote:

>> 2>Are your jpeg2k files tiled?
>
> Yes. kdu_show gives me Stiles = 512, 512.

Then those are not JPEG2000 Profile-0 codestreams. Profile-0 requires either
untiled or 128x128 tiled images.

Are you using the most recent version of jai-imageio, 1.1-fcs?

Do you know whether the images contain any TLM marker segments?

Brian

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Bart Matthaei

On Wed, Oct 25, 2006 at 10:26:27AM -0700, Brian Burkhalter wrote:
> >Yes. kdu_show gives me Stiles = 512, 512.
>
> Then those are not JPEG2000 Profile-0 codestreams. Profile-0 requires
> either untiled or 128x128 tiled images.

What are the consequences?

> Are you using the most recent version of jai-imageio, 1.1-fcs?

I'm using 1.1-pre-dr-b04.

> Do you know whether the images contain any TLM marker segments?

Not sure. How do I check?

Regards,

Bart

--
Bart Matthaei bart@ambrero.nl

Ambrero Software Development
http://www.ambrero.nl/

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Brian Burkhalter

On Thu, 26 Oct 2006, Bart Matthaei wrote:

> On Wed, Oct 25, 2006 at 10:26:27AM -0700, Brian Burkhalter wrote:
>>> Yes. kdu_show gives me Stiles = 512, 512.
>>
>> Then those are not JPEG2000 Profile-0 codestreams. Profile-0 requires
>> either untiled or 128x128 tiled images.
>
> What are the consequences?

None if all the software involved can deal with your images. Profile-0 simply
provides a minimal interchange specification somewhat analogous to the
baseline portion of TIFF 6.0 and to the JFIF subset of JPEG.

>> Are you using the most recent version of jai-imageio, 1.1-fcs?
>
> I'm using 1.1-pre-dr-b04.

This does not contain numerous fixes to JPEG2000. Please try 1.1-fcs. The
fixes will likely not affect the speed of the native-based reader very much.
They do however have a large impact on certain types of images when using the
Java-based reader. I would give that a try as well.

>> Do you know whether the images contain any TLM marker segments?
>
> Not sure. How do I check?

Well I'm not sure. The jai-imageio metadata does not currently include marker
segments, JJ2000 does not support TLM, JasPer does not have an info utlity,
and it looks as if Kakadu does not either.

Does anyone have a suggestion aside from writing code?

Brian

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Nidel, Mike

I have a few clarification questions.

Your JPEG2000 files are 2MB to 11MB. I assume this is compressed?
If so, then what is the decompressed size in pixels?

You mentioned that JPEG files work fine. How large are those JPEG
files, decompressed?

The simple fact is that processing a lot of pixels takes time. It
sounds from your example like you are scaling or otherwise operating
on the whole image, which means if it is large that you will be
bound by the time to compute those pixels.

Now, if your JPEGs are roughly the same size as your JPEG2000 images,
and you are seeing slow performance with JPEG2000 only, there may be
some other issue.

Mike

> -----Original Message-----
> From: Bart Matthaei [mailto:bart@ambrero.nl]
> Sent: Wednesday, October 25, 2006 5:23 AM
> To: interest@jai-imageio.dev.java.net
> Subject: [JAI-IMAGEIO] Help needed with J2K applet + large files
>
>
> Hi,
>
> I've been struggling with the Jpeg2000 codec for a couple of
> weeks now, and am about to give up on a JAI based solution
> and switch to Kakadu instead...
>
> I'm trying to create an applet for a commercial project that
> can display large (2MB to 11MB) Jpeg2000 files. It should be
> able to change the contrast/brightness and zoom the image.
>
> My first issues where the fact that reading the JP2 files
> took a long time. I managed to speed it up to a couple of
> seconds, but after reading the files, it takes another 5
> seconds to display the images in a DisplayJAI view. After it
> is finally displayed, any JAI operations (like rescale) take
> about 8 seconds, and really make the applet unresponsive.
> When I display normal JPEG files, everything runs smoothly.
>
> All of this is happening on a windows machine with the native
> jpeg2000 reader. I've already created a workaround for bug #5076692
> (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5076692)
> and I've verified that it's using the native reader, and not
> the pure java one.
>
> Any thoughts? I'm willing to hire someone on a consultancy
> basis to help me out, since our client is waiting for a solution ;-)
>
> Regards,
>
> Bart
>
> --
> Bart Matthaei bart@ambrero.nl
>
> Ambrero Software Development
> http://www.ambrero.nl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail:
> interest-help@jai-imageio.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Bart Matthaei

Hey Mike,

On Wed, Oct 25, 2006 at 09:50:40AM -0400, Nidel, Mike wrote:
> I have a few clarification questions.
>
> Your JPEG2000 files are 2MB to 11MB. I assume this is compressed?
> If so, then what is the decompressed size in pixels?

I was misinformed, the files are confined to 1MB size.
They're 12 bits per channel and 4008 x 2672 pixels.

Uncompressed, that would be about 61MB, since 12 bits take 2 byte of
storage.

> You mentioned that JPEG files work fine. How large are those JPEG
> files, decompressed?

A lot smaller :-) The JPEG's are only ~ 500K.

So it's a bad comparison, I admit.

> The simple fact is that processing a lot of pixels takes time. It
> sounds from your example like you are scaling or otherwise operating
> on the whole image, which means if it is large that you will be
> bound by the time to compute those pixels.
>
> Now, if your JPEGs are roughly the same size as your JPEG2000 images,
> and you are seeing slow performance with JPEG2000 only, there may be
> some other issue.

They're not the same size, I admit, so it's bad for comparison. However,
I've heard of people displaying large (> 1MB) compressed JPEG2000 files and
having them displayed in under a couple of seconds.

But since scrolling the JScrollPane that holds the DisplayJAI doesn't
involve any JAI operations (right), why should it make my applet
unresponsive?

Also, I'm already scaling the image down first, and applying brightness /
contrast operations to the scaled down version, so that shouldn't take too
long, right?

Regards,

Bart

--
Bart Matthaei bart@ambrero.nl

Ambrero Software Development
http://www.ambrero.nl/

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Bob Deen

> They're 12 bits per channel and 4008 x 2672 pixels.
>
> They're not the same size, I admit, so it's bad for comparison. However,
> I've heard of people displaying large (> 1MB) compressed JPEG2000 files and
> having them displayed in under a couple of seconds.
>
> But since scrolling the JScrollPane that holds the DisplayJAI doesn't
> involve any JAI operations (right), why should it make my applet
> unresponsive?

Well I suspect it all has to do with tiling. Is the original image
tiled or untiled?
What about the intermediate images? If it's untiled, then the entire
image has
to be computed even if you're just displaying a small part of it.

> Also, I'm already scaling the image down first, and applying brightness /
> contrast operations to the scaled down version, so that shouldn't take too
> long, right?

Not only that, it's possible especially if it's all one tile, that the
one tile
representing the loaded image (before scaling down and doing brightness/
contrast) is getting flushed from the cache by the subsequent operations...
meaning the entire file would have to be read again each time you do
something.

So, some suggestions:

1) Make sure the source image is tiled. Use ImageLayout in a RenderingHint
to the imageread operator if necessary.

2) Make the tile cache bigger generally. The default is IIRC 16 MB, which
isn't even enough to hold ONE copy of your image.

3) Give the load a private cache shared by nobody, so it will always be
there
in memory.

4) Take a look at JadeDisplay; it's designed to efficiently render very
large
(tiled) images using background computation. Hopefully the license will
work
for you; we're trying to fix that but it's a glacially slow process.

http://www.openchannelfoundation.org/projects/JadeDisplay

Good luck...

-Bob

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net