E
E. Naubauer
Hello folks, I have a huge problem and I'm pretty desperate now
For my diploma, I hav to code an app that basically reads jpeg images
from an Axis 2420 cameras mjpeg stream, decodes them, manipulates the
resulting rgb images an draws them back to the screen. I cannot use the
standard jai classes since every image is wrapped in a HTTP message
which I have to remove.
I can read the jfif data to a byte array. I also have access to an input
stream. I tried several options, but they all didn't give me the results
I needed:
- Getting an Image object with
Toolkit.getDefaultToolkit().createImage(myjfifbytedata, 0, j);
and drawing it with g.drawImage paint routine is VERY FAST.
However, since Image is an abstract class, I have no access to the pixel
data which I need to manipulate. So I tried option number 2:
- Getting a BufferedImage Object with
decoder = JPEGCodec.createJPEGDecoder(datainstream);
myBufferedImage = decoder.decodeAsBufferedImage();
This gives me direct access to the data, but I had to use a media
tracker so the images are correctly drawn. However, this took very long
(about 200 ms fon one image!) which is inacceptable since I still need
to manipulate the data.
I also tried
- Getting a RenderedImage with
ImageDecoder dec = ImageCodec.createImageDecoder(names[0], myinstream,
null);
image = dec.decodeAsRenderedImage();
and drawing it with
Graphics2D g2 = (Graphics2D)g;
g2.drawRenderedImage(image,AffineTransform.getTranslateInstance(0, 0));
It was even worse.
the fourth option, ImageIO didn't work at all. I fed it with my
InputStream Object via the read method, however it didn't seem to read
the jfif data from the stream right (it seemed to read more bytes than
it was supposed to).
I don't have any more clues how to speed this whole thing up. I have a
JNI dll which does the really hard image processing work. It takes a
byte array representing the image thats what I need that for. I tried a
couple of JIT compilers, also JET etc. and it didn't help.
My machine is a 1.25 Ghz Powerbook Alu with Mac Os X Tiger 10.4.4 and
Java Runtime 1.5 .
I would be really grateful for any ideas. Thank you in advance.
For my diploma, I hav to code an app that basically reads jpeg images
from an Axis 2420 cameras mjpeg stream, decodes them, manipulates the
resulting rgb images an draws them back to the screen. I cannot use the
standard jai classes since every image is wrapped in a HTTP message
which I have to remove.
I can read the jfif data to a byte array. I also have access to an input
stream. I tried several options, but they all didn't give me the results
I needed:
- Getting an Image object with
Toolkit.getDefaultToolkit().createImage(myjfifbytedata, 0, j);
and drawing it with g.drawImage paint routine is VERY FAST.
However, since Image is an abstract class, I have no access to the pixel
data which I need to manipulate. So I tried option number 2:
- Getting a BufferedImage Object with
decoder = JPEGCodec.createJPEGDecoder(datainstream);
myBufferedImage = decoder.decodeAsBufferedImage();
This gives me direct access to the data, but I had to use a media
tracker so the images are correctly drawn. However, this took very long
(about 200 ms fon one image!) which is inacceptable since I still need
to manipulate the data.
I also tried
- Getting a RenderedImage with
ImageDecoder dec = ImageCodec.createImageDecoder(names[0], myinstream,
null);
image = dec.decodeAsRenderedImage();
and drawing it with
Graphics2D g2 = (Graphics2D)g;
g2.drawRenderedImage(image,AffineTransform.getTranslateInstance(0, 0));
It was even worse.
the fourth option, ImageIO didn't work at all. I fed it with my
InputStream Object via the read method, however it didn't seem to read
the jfif data from the stream right (it seemed to read more bytes than
it was supposed to).
I don't have any more clues how to speed this whole thing up. I have a
JNI dll which does the really hard image processing work. It takes a
byte array representing the image thats what I need that for. I tried a
couple of JIT compilers, also JET etc. and it didn't help.
My machine is a 1.25 Ghz Powerbook Alu with Mac Os X Tiger 10.4.4 and
Java Runtime 1.5 .
I would be really grateful for any ideas. Thank you in advance.