LaneIn - Add TryCatch For Methods: OverviewCamera_OnOneVideoFrameRequested, PlateCamera_OnOneVideoFrameRequested, OverviewCameraOnVideoFrameReceived, PlateCameraOnVideoFrameReceived
This commit is contained in:
parent
2caffc6adf
commit
2bd45cf43f
|
@ -15,7 +15,8 @@ namespace AIParkingApplication
|
|||
public LaneIn()
|
||||
{
|
||||
InitializeComponent();
|
||||
string overviewCameraVideo = @"rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"; //@"C:\HS_test.mp4"
|
||||
string overviewCameraVideo = @"rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov";
|
||||
//string overviewCameraVideo = @"C:\HS_test.mp4";
|
||||
string plateCameraVideo = @"C:\HS_test.mp4";
|
||||
//string plateCameraVideo = @"C:\CongRa_1.mp4";
|
||||
|
||||
|
@ -36,48 +37,76 @@ namespace AIParkingApplication
|
|||
|
||||
private void OverviewCamera_OnOneVideoFrameRequested(Mat videoFrame)
|
||||
{
|
||||
pictureBoxOverviewImage.Invoke(new Action(() =>
|
||||
try
|
||||
{
|
||||
pictureBoxOverviewImage.Image?.Dispose();
|
||||
pictureBoxOverviewImage.Image = videoFrame.ToBitmap();
|
||||
}));
|
||||
pictureBoxOverviewImage.Invoke(new Action(() =>
|
||||
{
|
||||
pictureBoxOverviewImage.Image?.Dispose();
|
||||
pictureBoxOverviewImage.Image = videoFrame.ToBitmap();
|
||||
}));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"{Util.GetCurrentMethodName()}\texMessage: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void PlateCamera_OnOneVideoFrameRequested(Mat videoFrame)
|
||||
{
|
||||
Task.Factory.StartNew(new Action(async () =>
|
||||
{
|
||||
var finalPlateResult = await plateProcessor.ProcessPlate(videoFrame);
|
||||
|
||||
lblPlateString.Invoke(new Action(() =>
|
||||
try
|
||||
{
|
||||
lblPlateString.Text = finalPlateResult.PlateString;
|
||||
}));
|
||||
var finalPlateResult = await plateProcessor.ProcessPlate(videoFrame);
|
||||
|
||||
pictureBoxPlateImage.Invoke(new Action(() =>
|
||||
lblPlateString.Invoke(new Action(() =>
|
||||
{
|
||||
lblPlateString.Text = finalPlateResult.PlateString;
|
||||
}));
|
||||
|
||||
pictureBoxPlateImage.Invoke(new Action(() =>
|
||||
{
|
||||
pictureBoxPlateImage.Image?.Dispose();
|
||||
pictureBoxPlateImage.Image = finalPlateResult.PlateImage;
|
||||
}));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
pictureBoxPlateImage.Image?.Dispose();
|
||||
pictureBoxPlateImage.Image = finalPlateResult.PlateImage;
|
||||
}));
|
||||
Console.WriteLine($"{Util.GetCurrentMethodName()}\texMessage: {ex.Message}");
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
private void OverviewCameraOnVideoFrameReceived(Mat videoFrame)
|
||||
{
|
||||
pictureBoxOverviewVideo.Invoke(new Action(() =>
|
||||
try
|
||||
{
|
||||
pictureBoxOverviewVideo.Image?.Dispose();
|
||||
pictureBoxOverviewVideo.Image = videoFrame.ToBitmap();
|
||||
}));
|
||||
pictureBoxOverviewVideo.Invoke(new Action(() =>
|
||||
{
|
||||
pictureBoxOverviewVideo.Image?.Dispose();
|
||||
pictureBoxOverviewVideo.Image = videoFrame.ToBitmap();
|
||||
}));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"{Util.GetCurrentMethodName()}\texMessage: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void PlateCameraOnVideoFrameReceived(Mat videoFrame)
|
||||
{
|
||||
pictureBoxPlateVideo.Invoke(new Action(() =>
|
||||
try
|
||||
{
|
||||
pictureBoxPlateVideo.Image?.Dispose();
|
||||
pictureBoxPlateVideo.Image = videoFrame.ToBitmap();
|
||||
}));
|
||||
pictureBoxPlateVideo.Invoke(new Action(() =>
|
||||
{
|
||||
pictureBoxPlateVideo.Image?.Dispose();
|
||||
pictureBoxPlateVideo.Image = videoFrame.ToBitmap();
|
||||
}));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"{Util.GetCurrentMethodName()}\texMessage: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void CaptureAllCamera()
|
||||
|
|
Loading…
Reference in New Issue
Block a user