From e7fe1de33e2c5aea4b452390ee2e8c63ac846a07 Mon Sep 17 00:00:00 2001 From: DucDangAnh Date: Fri, 19 Jun 2020 10:06:56 +0700 Subject: [PATCH] Remove Commented Code In AIParkingApplicationForm --- .../AIParkingApplicationForm.cs | 121 +----------------- 1 file changed, 5 insertions(+), 116 deletions(-) diff --git a/AIParkingApplication/AIParkingApplicationForm.cs b/AIParkingApplication/AIParkingApplicationForm.cs index 0d69da9..35831bb 100644 --- a/AIParkingApplication/AIParkingApplicationForm.cs +++ b/AIParkingApplication/AIParkingApplicationForm.cs @@ -1,128 +1,17 @@ -using OpenCvSharp; -using OpenCvSharp.Extensions; -using System; -using System.Threading; -using System.Windows.Forms; +using System.Windows.Forms; namespace AIParkingApplication { public partial class AIParkingApplicationForm : Form { - private Camera camera; public AIParkingApplicationForm() { InitializeComponent(); - - string url = @"rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"; // @"C:\HS_test.mp4"; // @"rtsp://admin:admin@192.168.2.10" - camera = new Camera(url); - camera.OnVideoFrameReceived += Camera_OnVideoFrameReceived; - camera.Startcapture(); - //Thread thread1 = new Thread(ShowFrame); - //thread1.IsBackground = true; - //thread1.Start(); - //CaptureFrame(); LaneIn laneIn = new LaneIn(); - LaneOut laneOut = new LaneOut(); - this.Controls.Add(laneIn); - laneOut.Location = new System.Drawing.Point(550, 0); - this.Controls.Add(laneOut); + //LaneIn laneOut = new LaneIn(); + Controls.Add(laneIn); + //laneOut.Location = new System.Drawing.Point(550, 0); + //Controls.Add(laneOut); } - - private void Camera_OnVideoFrameReceived(Mat videoFrame) - { - //pictureBox1.Invoke(new Action(() => - //{ - // pictureBox1.Image?.Dispose(); - // pictureBox1.Width = videoFrame.Width; - // pictureBox1.Height = videoFrame.Height; - // pictureBox1.Image = videoFrame.ToBitmap(); - //})); - } - - //public void ShowFrame() - //{ - // while (true) - // { - // Thread.Sleep(1); - // if (camera.VideoFrames.Count == 0) - // { - // continue; - // } - // Mat videoFrame = camera.VideoFrames.Dequeue(); - // pictureBox1.Invoke(new Action(() => - // { - // pictureBox1.Image?.Dispose(); - // pictureBox1.Width = videoFrame.Width; - // pictureBox1.Height = videoFrame.Height; - // pictureBox1.Image = videoFrame.ToBitmap(); - // })); - // } - //} - - //public void CaptureFrame() - //{ - // Thread thread = new Thread(new ThreadStart(() => - // { - // Mat frame1 = new Mat(); - // Mat frame2 = new Mat(); - // Mat frame3 = new Mat(); - // Mat frame4 = new Mat(); - // VideoCapture capture1 = new VideoCapture(); - // VideoCapture capture2 = new VideoCapture(); - // VideoCapture capture3 = new VideoCapture(); - // VideoCapture capture4 = new VideoCapture(); - // capture1.Open(@"C:\HS_test.mp4"); - // capture2.Open(@"rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"); - // capture3.Open(@"C:\HS_test.mp4"); - // capture4.Open(@"rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"); - - // while (true) - // { - // Thread.Sleep(TimeSpan.FromMilliseconds(1)); - // try - // { - // capture1.Read(frame1); - // capture2.Read(frame2); - // capture3.Read(frame3); - // capture4.Read(frame4); - // pictureBox1.Image?.Dispose(); - // var image1 = frame1.ToBitmap(); - // pictureBox1.Invoke(new Action(() => - // { - // pictureBox1.Image = image1; - // })); - - // pictureBox2.Image?.Dispose(); - // var image2 = frame2.ToBitmap(); - // pictureBox2.Invoke(new Action(() => - // { - // pictureBox2.Image = image2; - // })); - - - // pictureBox3.Image?.Dispose(); - // var image3 = frame3.ToBitmap(); - // pictureBox3.Invoke(new Action(() => - // { - // pictureBox3.Image = image3; - // })); - - - // pictureBox4.Image?.Dispose(); - // var image4 = frame4.ToBitmap(); - // pictureBox4.Invoke(new Action(() => - // { - // pictureBox4.Image = image4; - // })); - // } - // catch (Exception ex) - // { - // Console.WriteLine("Error: " + ex.Message); - // } - // } - // })); - // thread.IsBackground = true; - // thread.Start(); - //} } }