Camera - Refactor abit
This commit is contained in:
parent
5b90cee75b
commit
996a13013d
|
@ -20,9 +20,9 @@ namespace AIParkingApplication
|
|||
{
|
||||
this.streamUrl = streamUrl;
|
||||
isFrameRequested = false;
|
||||
videoCapture = new VideoCapture();
|
||||
readStreamThread = new Thread(new ThreadStart(ReadVideoStream));
|
||||
readStreamThread.IsBackground = true;
|
||||
videoCapture = new VideoCapture();
|
||||
}
|
||||
|
||||
~Camera()
|
||||
|
@ -48,13 +48,13 @@ namespace AIParkingApplication
|
|||
|
||||
public void ReadVideoStream()
|
||||
{
|
||||
Mat videoFrame = new Mat();
|
||||
if (!videoCapture.Open(streamUrl))
|
||||
{
|
||||
OnOpenVideoStreamFailed?.Invoke(Cv2.ImRead(AppConstant.CAMERA_FAILED_IMAGE_PATH));
|
||||
return;
|
||||
}
|
||||
|
||||
Mat videoFrame = new Mat();
|
||||
while (true)
|
||||
{
|
||||
Thread.Sleep(50); //Stream Thread Sleep
|
||||
|
@ -69,6 +69,10 @@ namespace AIParkingApplication
|
|||
isFrameRequested = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OnOpenVideoStreamFailed?.Invoke(Cv2.ImRead(AppConstant.CAMERA_FAILED_IMAGE_PATH));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user