dcsimg
Problems with huge images
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Roland_Galli
Posted On:   Friday, June 23, 2006 01:50 PM

For the last several days I tried to find a solution to my imaging problem but have not succeeded till now. I'm trying to animate weather radar images on top of a map. The map is 3700 by 2700 pixels. The corresponding part of the weather radar images is 184 by 133 pixels. Therefore I scale the radar images by x 20.108695 and y 20.300751. This works fine when I do the image processing at every new radar image in my displayImage method. But it is slow, mainly the scale filter! Below is the code, how I do this with the time consumption on the left side. I must animate 10 weather radar pictures. I've also done    More>>

			

For the last several days I tried to find a solution
to my imaging problem but have not succeeded till now.



I'm trying to animate weather radar images on top of a map.
The map is 3700 by 2700 pixels. The corresponding part of the
weather radar images is 184 by 133 pixels. Therefore I scale
the radar images by x 20.108695 and y 20.300751.



This works fine when I do the image processing at every new
radar image in my displayImage method. But it is slow, mainly
the scale filter! Below is the code, how I do this with the time
consumption on the left side.



I must animate 10 weather radar pictures. I've also done
this by producing 10 offscreen images in the manner as shown
below. But there's another problem. I've set the java runtime
to use more than 300 MB of memory (I wanted to allocate a lot more,
but there seems to be some limit). This memory just is good for
about 6 images, because one image as you can see (3700*2700*4)
consumes roughly 40 MB of space. Then the jvm runs out of memory
and throws an exception. One good thing however is, that the
6 images are animated very fast.



Would you be so kind and help me?



Thanking you in advance with best regards



Roland Galli



Here's my code and the time it consumes at run is on the left side:




[...] double scalex = 20.108695; // 3700 / 184
[...] double scaley = 20.300751; // 2700 / 133
[...] int wo = m_ImgOROMIO.getWidth(this); // MAP image
[...] int ho = m_ImgOROMIO.getHeight(this);
[...] int wi = m_Images[m_CurrImage].getWidth(this); // RADAR image
[...] int hi = m_Images[m_CurrImage].getHeight(this);

[...] // MAP processing
[070] BufferedImage bi = new BufferedImage(wo, ho, BufferedImage.TYPE_INT_ARGB);
[000] Graphics2D g2do = bi.createGraphics();
[130] g2do.drawImage(m_ImgOROMIO, 0, 0, wo, ho, null);
[...] // Buffered image for current weather radar image 184 by 133 pixels wide
[000] BufferedImage bir = new BufferedImage(wi, hi, BufferedImage.TYPE_INT_ARGB);
[000] Graphics2D g2di = bir.createGraphics();
[000] g2di.drawImage(m_Images[m_CurrImage], 0, 0, wi, hi, null);
[000] AffineTransform atx = new AffineTransform();
[000] atx.scale(scalex, scaley);
[000] AffineTransformOp op = new AffineTransformOp(atx, AffineTransformOp.TYPE_BILINEAR);
[871] bir = op.filter(bir, null);
[150] g2do.drawImage(bir, 0, 0, wo, ho, null);
[000] Image img = Toolkit.getDefaultToolkit().createImage(bi.getSource());
[...] // Drawing off screen img now to my normal graphics context
[...] g.drawImage(img, m_x, m_y, m_width, m_height, Color.black, null);



   <<Less
About | Sitemap | Contact