First, i am extracting images from the video stream by taking a snap shot of each images from the video, and then I extracted the pixels data from those images using pixelGrabbers. This return a byte[] array of pixels information of the image. then i create BufferedImage using the method i posted above, but the way that i have written can cause out of heap memory error because i am declaring "new" everytime i got a new dataBuffer. the dimension of the byte[] dataBuffer is the same; the only change is the pixel info. Here is some part of my program:
public class ExtractImage{ //start video stream //then take a snap shot of video at every 5 seconds. //then extract the pixel info from the snap shot image using pixelsGrabber, and //then put that data in the byte[] dataBuffer array. //After that produce BufferedImage or RenderedImage by calling this //produceRenderedImage method. public BufferedImage produceRenderedImage(byte[] dataBuffer, int width, int height) { DataBuffer dBuffer = new DataBufferByte(dataBuffer, width * height); WritableRaster wr = Raster.createInterleavedRaster(dBuffer,width,height,width,1,new int[]{0},null); ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY); ColorModel cm = new ComponentColorModel(cs,false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE); BufferedImage bi = new BufferedImage(cm, wr, false, null); return bi; } } thanks for all your help. i really appreciated it. Francis [Message sent by forum member 'cohodetector' (cohodetector)] http://forums.java.net/jive/thread.jspa?messageID=289444 =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".