dcsimg
To grab a frame from avi vedio and convert it to image using JMF
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Mike_Han
Posted On:   Friday, March 30, 2001 07:41 AM

Here's my code: ... Buffer buffer=fgcontrol.grabFrame(); Format format=buffer.getFormat(); BufferToImage bti=new BufferToImage((VideoFormat)format); Image img=null; if (bti!=null) { try{ img=bti.createImage(buffer); }catch(Exception e){ System.out.println(e); } } if (img!=null){ Graphics gra=img.getGraphics(); gra.drawImage(img,20,30,this); } ... neither buffer nor bti is null, I can get correct "format" from them, but for the line " img=bti.createImage(buffer);" I always got a NullPointerException error,could you give any help? thanks!    More>>

Here's my code:
...
Buffer buffer=fgcontrol.grabFrame();
Format format=buffer.getFormat();
BufferToImage bti=new BufferToImage((VideoFormat)format);
Image img=null;
if (bti!=null) {
try{

img=bti.createImage(buffer);
}catch(Exception e){
System.out.println(e);
}
}
if (img!=null){
Graphics gra=img.getGraphics();
gra.drawImage(img,20,30,this);
}
...
neither buffer nor bti is null, I can get correct "format" from them, but for the line " img=bti.createImage(buffer);" I always got a NullPointerException error,could you give any help?
thanks!

   <<Less
About | Sitemap | Contact