全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:2899
推到 Plurk!
推到 Facebook!

請問用JAVA抓取CCD影像並儲存的問題

尚未結案
marksman7296
一般會員


發表:1
回覆:1
積分:0
註冊:2004-08-04

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-08-04 19:32:16 IP:218.165.xxx.xxx 未訂閱
我們現在要寫個程式,第一步必須能從CCD上擷取影像並在螢幕上秀出, 第二步是能將影像儲存成MPEG1或MPEG4的格式。 這應該已經有CLASS可以使用八,不知道是不是有人能提提供, 因為我是新手,那希望大家幫幫忙,而且希望能講解的詳盡一些, 謝謝
neoart
版主


發表:22
回覆:582
積分:425
註冊:2003-05-09

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-08-04 20:56:58 IP:211.78.xxx.xxx 未訂閱
http://www.javaworld.com.tw/jute/post/view?bid=20&id=45890&tpg=1&ppg=1&sty=1&age=0#45890
懶懶泥
一般會員


發表:22
回覆:41
積分:12
註冊:2003-02-11

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-08-06 01:08:43 IP:140.124.xxx.xxx 未訂閱
我有一個sample,不過不知道合不何你用! import java.io.*; import java.util.*; import java.awt.*; import java.awt.image.*; import javax.imageio.*; import javax.media.*; import javax.media.control.*; import javax.media.format.*; import javax.media.util.*; /** * Grabs a frame from a Webcam, overlays the current date and time, and saves the frame as a PNG to c:\webcam.png * * @author David * @version 1.0, 16/01/2004 */ public class FrameGrab { public static void main(String[] args) throws Exception { // Create capture device CaptureDeviceInfo deviceInfo = CaptureDeviceManager.getDevice("vfw:Microsoft WDM Image Capture (Win32):0"); Player player = Manager.createRealizedPlayer(deviceInfo.getLocator()); player.start(); // Wait a few seconds for camera to initialise (otherwise img==null) Thread.sleep(2500); // Grab a frame from the capture device FrameGrabbingControl frameGrabber = (FrameGrabbingControl)player.getControl("javax.media.control.FrameGrabbingControl"); Buffer buf = frameGrabber.grabFrame(); // Convert frame to an buffered image so it can be processed and saved Image img = (new BufferToImage((VideoFormat)buf.getFormat()).createImage(buf)); BufferedImage buffImg = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_RGB); Graphics2D g = buffImg.createGraphics(); g.drawImage(img, null, null); // Overlay curent time on image g.setColor(Color.RED); g.setFont(new Font("Verdana", Font.BOLD, 16)); g.drawString((new Date()).toString(), 10, 25); // Save image to disk as PNG ImageIO.write(buffImg, "png", new File("c:\\webcam.png")); // Stop using webcam player.close(); player.deallocate(); System.exit(0); } }
懶懶泥
一般會員


發表:22
回覆:41
積分:12
註冊:2003-02-11

發送簡訊給我
#4 引用回覆 回覆 發表時間:2004-08-06 01:09:01 IP:140.124.xxx.xxx 未訂閱
我有一個sample,不過不知道合不何你用! import java.io.*; import java.util.*; import java.awt.*; import java.awt.image.*; import javax.imageio.*; import javax.media.*; import javax.media.control.*; import javax.media.format.*; import javax.media.util.*; /** * Grabs a frame from a Webcam, overlays the current date and time, and saves the frame as a PNG to c:\webcam.png * * @author David * @version 1.0, 16/01/2004 */ public class FrameGrab { public static void main(String[] args) throws Exception { // Create capture device CaptureDeviceInfo deviceInfo = CaptureDeviceManager.getDevice("vfw:Microsoft WDM Image Capture (Win32):0"); Player player = Manager.createRealizedPlayer(deviceInfo.getLocator()); player.start(); // Wait a few seconds for camera to initialise (otherwise img==null) Thread.sleep(2500); // Grab a frame from the capture device FrameGrabbingControl frameGrabber = (FrameGrabbingControl)player.getControl("javax.media.control.FrameGrabbingControl"); Buffer buf = frameGrabber.grabFrame(); // Convert frame to an buffered image so it can be processed and saved Image img = (new BufferToImage((VideoFormat)buf.getFormat()).createImage(buf)); BufferedImage buffImg = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_RGB); Graphics2D g = buffImg.createGraphics(); g.drawImage(img, null, null); // Overlay curent time on image g.setColor(Color.RED); g.setFont(new Font("Verdana", Font.BOLD, 16)); g.drawString((new Date()).toString(), 10, 25); // Save image to disk as PNG ImageIO.write(buffImg, "png", new File("c:\\webcam.png")); // Stop using webcam player.close(); player.deallocate(); System.exit(0); } }
marksman7296
一般會員


發表:1
回覆:1
積分:0
註冊:2004-08-04

發送簡訊給我
#5 引用回覆 回覆 發表時間:2004-08-08 01:20:04 IP:218.165.xxx.xxx 未訂閱
感謝提供資料,請問一下,懶懶泥所提供的 是儲存成圖片對八,我想要的是能存影片 不知道是否有人知道怎麼寫呢 JMF是否有提供這樣的CLASS能使用呢??
系統時間:2024-03-29 23:33:28
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!