锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产精品福利在线观看网址,亚洲免费av一区二区,久久99精品国产http://www.aygfsteel.com/jorwen/category/7237.htmlzh-cnWed, 28 Feb 2007 11:42:51 GMTWed, 28 Feb 2007 11:42:51 GMT60- 鐢?Java 淇濆瓨浣嶅浘鏂囦歡http://www.aygfsteel.com/jorwen/articles/29422.html鏂逛匠鐜?/dc:creator>鏂逛匠鐜?/author>Wed, 01 Feb 2006 04:27:00 GMThttp://www.aygfsteel.com/jorwen/articles/29422.htmlhttp://www.aygfsteel.com/jorwen/comments/29422.htmlhttp://www.aygfsteel.com/jorwen/articles/29422.html#Feedback0http://www.aygfsteel.com/jorwen/comments/commentRss/29422.htmlhttp://www.aygfsteel.com/jorwen/services/trackbacks/29422.html闃呰鍏ㄦ枃

]]> - Java涓埄鐢↗MF緙栧啓鎽勫儚澶存媿鐓х▼搴?/title>http://www.aygfsteel.com/jorwen/articles/29421.html鏂逛匠鐜?/dc:creator>鏂逛匠鐜?/author>Wed, 01 Feb 2006 04:24:00 GMThttp://www.aygfsteel.com/jorwen/articles/29421.htmlhttp://www.aygfsteel.com/jorwen/comments/29421.htmlhttp://www.aygfsteel.com/jorwen/articles/29421.html#Feedback0http://www.aygfsteel.com/jorwen/comments/commentRss/29421.htmlhttp://www.aygfsteel.com/jorwen/services/trackbacks/29421.html棣栧厛鍒癝UN涓嬭澆鏈鏂扮殑JMF錛岀劧鍚庡畨瑁呫俬ttp://java.sun.com/products/java-media/jmf/index.jsp
銆銆鐒跺悗錛岃涓涓嬮渶姹?BR>
銆銆1錛?鐢ㄦ憚鍍忓ご鎷嶇収
銆銆2錛?鍦ㄦ枃鏈杈撳叆鏂囦歡鍚?BR>
銆銆3錛?鎸変笅鎷嶇収鎸夐挳錛岃幏鍙栨憚鍍忓ご鍐呯殑鍥懼儚
銆銆4錛?鍦ㄦ媿涓嬬殑鐓х墖涓婃湁涓綰㈡鎴彇鍥哄畾澶у皬鐨勭収鐗囥?BR>
銆銆5錛?淇濆瓨涓烘湰鍦板浘鍍忎負jpg鏍煎紡錛屼笉寰楀帇緙╃敾璐?BR>
銆銆鎶鏈叧閿紝鐩鎬俊涔熸槸澶у鏈鎰熷叴瓚g殑閮ㄥ垎涔熷氨鏄浣曡涓涓憚鍍忓ご宸ヤ綔錛屽茍鎷嶄笅涓寮犵収鐗囦簡銆?BR>
銆銆鍒╃敤JMF錛屼唬鐮佸緢綆鍗曪細
//鍒╃敤榪欎笁涓被鍒嗗埆鑾峰彇鎽勫儚澶撮┍鍔紝鍜岃幏鍙栨憚鍍忓ご鍐呯殑鍥懼儚嫻侊紝鑾峰彇鍒扮殑鍥懼儚嫻佹槸涓涓猄wing鐨凜omponent緇勪歡綾?/SPAN>

public static Player player = null;
private CaptureDeviceInfo di = null;
private MediaLocator ml = null;

//鏂囨。涓彁渚涚殑椹卞姩鍐欐硶錛屼負浣曡繖涔堝啓鎴戜篃涓嶇煡錛氾級

String str1 = "vfw:Logitech USB Video Camera:0";
String str2 = "vfw:Microsoft WDM Image Capture (Win32):0";
di = CaptureDeviceManager.getDevice(str2);
ml = di.getLocator();
try


{
銆player = Manager.createRealizedPlayer(ml);
銆player.start();
銆Component comp;
銆if ((comp = player.getVisualComponent()) != null)

銆
{
銆銆add(comp, BorderLayout.NORTH);
銆}
}
catch (Exception e)


{
銆e.printStackTrace();
}

銆銆鎺ヤ笅鏉ュ氨鏄偣鍑繪媿鐓э紝鑾峰彇鎽勫儚澶村唴鐨勫綋鍓嶅浘鍍忋?BR>
銆銆浠g爜涔熸槸寰堢畝鍗曪細

private JButton capture;
private Buffer buf = null;
private BufferToImage btoi = null;
private ImagePanel imgpanel = null;
private Image img = null;
private ImagePanel imgpanel = null;

JComponent c = (JComponent) e.getSource();
if (c == capture)//濡傛灉鎸変笅鐨勬槸鎷嶇収鎸夐挳


{
銆FrameGrabbingControl fgc =(FrameGrabbingControl) 銆player.getControl("javax.media.control.FrameGrabbingControl");
銆buf = fgc.grabFrame(); // 鑾峰彇褰撳墠紲茍瀛樺叆Buffer綾?/SPAN>
銆btoi = new BufferToImage((VideoFormat) buf.getFormat());
銆img = btoi.createImage(buf); // show the image
銆imgpanel.setImage(img);
}

銆銆淇濆瓨鍥懼儚鐨勫氨涓嶅璇翠簡錛屼互涓嬩負紺轟緥浠g爜

BufferedImage bi = (BufferedImage) createImage(imgWidth, imgHeight);
Graphics2D g2 = bi.createGraphics();
g2.drawImage(img, null, null);
FileOutputStream out = null;
try


{
銆out = new FileOutputStream(s);
}
catch (java.io.FileNotFoundException io)


{
銆System.out.println("File Not Found");
}

JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bi);
param.setQuality(1f, false);//涓嶅帇緙╁浘鍍?/SPAN>
encoder.setJPEGEncodeParam(param);
try


{
銆encoder.encode(bi);
銆out.close();
}
catch (java.io.IOException io)


{
銆System.out.println("IOException");
}


]]>
主站蜘蛛池模板:
民勤县|
乌什县|
吉水县|
通州区|
元阳县|
皋兰县|
红桥区|
高台县|
客服|
尼木县|
镇沅|
壤塘县|
偃师市|
砀山县|
读书|
新疆|
阜新|
香格里拉县|
贵德县|
株洲市|
大宁县|
湘潭县|
黑河市|
阳山县|
温泉县|
石城县|
惠州市|
宣化县|
龙泉市|
龙川县|
上林县|
宣威市|
青神县|
瑞丽市|
马关县|
聂荣县|
宜章县|
临澧县|
萝北县|
陈巴尔虎旗|
和龙市|