2
A
回答
5
您可以使用下面的代碼使一個應用程序捕獲和顯示視頻流:
public class CameraCapture
{
private Capture capture; //takes images from camera as image frames
private bool captureInProgress;
private void ProcessFrame(object sender, EventArgs arg)
{
Image<Bgr, Byte> ImageFrame = capture.QueryFrame(); //line 1
CamImageBox.Image = ImageFrame; //line 2
}
private void Form1_Load(object sender, EventArgs e)
{
if (capture == null)
{
try
{
capture = new Capture();
}
catch (NullReferenceException excpt)
{
MessageBox.Show(excpt.Message);
}
}
if (capture != null)
{
if (captureInProgress)
{ //if camera is getting frames then stop the capture and set button Text
// "Start" for resuming capture
btnStart.Text = "Start!"; //
Application.Idle -= ProcessFrame;
}
else
{
//if camera is NOT getting frames then start the capture and set button
// Text to "Stop" for pausing capture
btnStart.Text = "Stop";
Application.Idle += ProcessFrame;
}
captureInProgress = !captureInProgress;
}
}
}
2
不知道你想要什麼用數據來做,但是這將讓你從相機的單個幀(和在PictureBox顯示它在一個WinForm)
private void Form1_Load(object sender, EventArgs e)
{
var capture = new Emgu.CV.Capture();
using (var nextFrame = capture.QueryFrame())
{
if (nextFrame != null)
{
pictureBox1.Image = nextFrame.ToBitmap();
}
}
}
相關問題
- 1. EMGU CV攝像頭捕獲WPF?
- 2. 如何以角度從網絡攝像頭獲取視頻流
- 3. Emgu cv顯示攝像頭流作爲翻轉圖像
- 4. 如何提高攝像頭視頻輸入的幀速率? Emgu CV
- 5. Emgu攝像頭
- 6. 如何在C++中獲取攝像頭視頻流字節
- 7. 從攝像頭流到iPhone的視頻
- 8. 如何從IP攝像頭使用emgucv獲取視頻
- 9. Emgu CV從視頻文件中獲取所有幀
- 10. 從Safari攝像頭捕獲視頻
- 11. 從IP攝像頭捕獲視頻
- 12. 攝像頭視頻流處理
- 13. 從IP攝像頭獲取流
- 14. 如何流從攝像頭的視頻到<Image>
- 15. 如何使用vlc從IP攝像頭流式傳輸視頻
- 16. 如何從AXIS網絡攝像頭代理視頻流?
- 17. CAOpenGLLayer中的攝像頭視頻流
- 18. 如何記錄多個源攝像頭/ IP攝像頭視頻流?
- 19. 從我的攝像頭在WPF中顯示一個視頻流?
- 20. 如何拍攝有聲emgu CV
- 21. Emgu CV檢查網絡攝像頭連接
- 22. 如何通過HTTP從RTSP攝像頭獲取圖像流?
- 23. 如何獲取directshow網絡攝像頭視頻流的寬度和高度
- 24. 如何使用Java從網絡攝像機獲取視頻和音頻流?
- 25. 如何使用applet從java攝像頭捕獲視頻?
- 26. 如何從avfoundation攝像頭獲得視頻輸出
- 27. 如何使用OpenCV從網絡攝像頭讀取視頻?
- 28. Python:從交通攝像頭獲取10分鐘視頻
- 29. 如何顯示用Emgu拍攝的攝像頭圖像?
- 30. 如何使用emgu CV
出於興趣。請使用Google或至少訪問圖書館的官方網站:http://www.emgu.com/wiki/index.php/Camera_Capture_in_7_lines_of_code –