사람은 사용되는 매우 간단한 형태의 날이 VB.NET 작성된 라이브러리 또는 C#MJPEGStream 기능 예
여기답변
를 사용 PictureBox를 스트림의 이미지를 나타내는 완전한 예를 줄 수 AForge.Video.MJPEGStream 클래스
private MJPEGStream VideoStream = new MJPEGStream();
private void frmMain_Load(object sender, System.EventArgs e)
{
VideoStream.Source = "URL_HERE";
VideoStream.Login = "USERNAME_HERE";
VideoStream.Password = "PASSWORD_HERE";
VideoStream.Start();
}
private void frmMain_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e)
{
VideoStream.Stop();
}
private void VideoStream_NewFrame(object sender, AForge.Video.NewFrameEventArgs eventArgs)
{
Bitmap FrameData = new Bitmap(eventArgs.Frame);
pbStream.Image = FrameData;
}
private void VideoStream_VideoSourceError(object sender, AForge.Video.VideoSourceErrorEventArgs eventArgs)
{
Debug.WriteLine(eventArgs.Description);
}
public frmMain()
{
InitializeComponent();
this.FormClosing += new EventHandler(frmMain_FormClosing);
this.Load += new EventHandler(frmMain_Load);
VideoStream.NewFrame += new EventHandler(VideoStream_NewFrame);
VideoStream.VideoSourceError+= new EventHandler(VideoStream_VideoSourceError);
}
감사 로그인 만있다 왜 내 그림 상자에 이미지를 다시 그릴지 모르겠다 http://goo.gl/UuqnV –
그림 상자를 설정 한 후 pbStream.Refresh()를 추가하는 경우 참조하십시오. 나이가 수정됩니다. – QuantumPhysGuy
또한 내 예제 에서처럼 이벤트에 가입하는 방법을 보여주지 않았습니다. 예제를 업데이트했습니다. frmMain() 아래에서 새로운 이벤트 구독에 주목해야합니다. – QuantumPhysGuy
또 다른 예 :
Imports AForge.Video
Public Class Form1
Inherits Form
Private stopWatch As Stopwatch = Nothing
Private Sub MainForm_FormClosing(sender As Object, e As FormClosingEventArgs)
CloseCurrentVideoSource()
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
' create video source
Dim mjpegSource As New MJPEGStream("http://190.6.206.170/video/mjpg.cgi")
mjpegSource.Login = "admin"
mjpegSource.Password = ""
' open it
OpenVideoSource(mjpegSource)
End Sub
' Open video source
Private Sub OpenVideoSource(source As IVideoSource)
' set busy cursor
Me.Cursor = Cursors.WaitCursor
' stop current video source
CloseCurrentVideoSource()
' start new video source
videoSourcePlayer.VideoSource = source
videoSourcePlayer.Start()
' reset stop watch
stopWatch = Nothing
' start timer
timer.Start()
Me.Cursor = Cursors.[Default]
End Sub
' Close video source if it is running
Private Sub CloseCurrentVideoSource()
If videoSourcePlayer.VideoSource IsNot Nothing Then
videoSourcePlayer.SignalToStop()
' wait ~ 3 seconds
For i As Integer = 0 To 29
If Not videoSourcePlayer.IsRunning Then
Exit For
End If
System.Threading.Thread.Sleep(100)
Next
If videoSourcePlayer.IsRunning Then
videoSourcePlayer.[Stop]()
End If
videoSourcePlayer.VideoSource = Nothing
End If
End Sub
' New frame received by the player
Private Sub videoSourcePlayer_NewFrame(sender As Object, ByRef image As Bitmap)
Dim now As DateTime = DateTime.Now
Dim g As Graphics = Graphics.FromImage(image)
' paint current time
Dim brush As New SolidBrush(Color.Red)
g.DrawString(now.ToString(), Me.Font, brush, New PointF(5, 5))
brush.Dispose()
g.Dispose()
End Sub
Private Sub timer_Tick(sender As System.Object, e As System.EventArgs) Handles timer.Tick
Dim videoSource As IVideoSource = videoSourcePlayer.VideoSource
If videoSource IsNot Nothing Then
' get number of frames since the last timer tick
Dim framesReceived As Integer = videoSource.FramesReceived
If stopWatch Is Nothing Then
stopWatch = New Stopwatch()
stopWatch.Start()
Else
stopWatch.[Stop]()
Dim fps As Single = 1000.0F * framesReceived/stopWatch.ElapsedMilliseconds
Me.Text = fps.ToString("F2") & " fps"
stopWatch.Reset()
stopWatch.Start()
End If
End If
End Sub
End Class
필수 컨트롤 : 내가 IPCAM에서 이미지를 얻으려면
System.Windows.Forms.Timer 'For display fps
Aforge.Controls.VideoSourcePlayer 'For Display the video Img
- 1. MJPEGStream 스트림 표시 Aforge.Video.dll
- 2. indefiinitely 기다리는 기능 (예 : listen())
- 3. '예', '아니요'및 취소 JavaScript로 확인 기능
- 4. JavaScript의 공유 기능 (예 : 로거) 용 OOP 패턴
- 5. Qt/C++에서 실행 취소 기능 (예 : Ctrl + Z) 구현
- 6. 사용자 프로필 페이지에서 기능 제어 (예 : 메일 보내기)
- 7. 리눅스에서 트래픽 제어 기능 (예 : QOS) 라이브러리를 찾고 있습니다.
- 8. 메시지 상자가 올라간 상태에서 키 입력 (예 : 기능 키) 캡처
- 9. 구글의 '이동'및 범위/기능 golang.org에 주어진 예 서버 중 하나에서
- 10. Aptana Studio 3 (예 : PyDev)에서 추가 기능 제거
- 11. Emacs에 함수 작성을 요청하십시오 (예 : Eclipse/IntelliJ 제안/수정 기능)
- 12. 계산 예
- 13. 예 :
- 14. 예 :
- 15. 예
- 16. 예
- 17. 예
- 18. 예 :
- 19. 예
- 20. 예 :
- 21. 예 :
- 22. 예
- 23. 는 STL 컨테이너 예
- 24. 기능 기능
- 25. SpecFlow/BDD 예
- 26. 기능
- 27. 기능 제한 기능 사용 방법
- 28. Codeigniter & Gmaps v3 예
- 29. 예 : jquery와 둥근 모서리를 사용하여 예 :
- 30. jQuery를 기능 - 나는 기능 다음 한 기능
이 캠 인증 귀하의 답변 –