锘??xml version="1.0" encoding="utf-8" standalone="yes"?>韩国久久久久,久久精品免费电影,激情久久五月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");
}


]]>
主站蜘蛛池模板:
东山县|
临汾市|
南涧|
井冈山市|
白朗县|
田林县|
庐江县|
罗平县|
沽源县|
丰镇市|
大庆市|
抚顺县|
盖州市|
江源县|
洛阳市|
博爱县|
东港市|
土默特右旗|
盖州市|
务川|
天柱县|
淅川县|
论坛|
华坪县|
星子县|
桃园市|
龙海市|
前郭尔|
湖北省|
文水县|
郧西县|
化隆|
泰兴市|
重庆市|
满洲里市|
沙洋县|
遂溪县|
治县。|
高要市|
广元市|
福泉市|