Camera - use videoCapture as a field.
This commit is contained in:
parent
5259eba6b5
commit
f63da8a968
|
@ -10,6 +10,7 @@ namespace AIParkingApplication
|
|||
private string streamUrl;
|
||||
private volatile bool isFrameRequested;
|
||||
private Thread readStreamThread;
|
||||
private VideoCapture videoCapture;
|
||||
public volatile Mat CurrentFrame;
|
||||
|
||||
public event CameraEvent OnVideoFrameReceived;
|
||||
|
@ -21,11 +22,13 @@ namespace AIParkingApplication
|
|||
isFrameRequested = false;
|
||||
readStreamThread = new Thread(new ThreadStart(ReadVideoStream));
|
||||
readStreamThread.IsBackground = true;
|
||||
videoCapture = new VideoCapture();
|
||||
}
|
||||
|
||||
~Camera()
|
||||
{
|
||||
Stop();
|
||||
videoCapture.Dispose();
|
||||
}
|
||||
|
||||
public void Start()
|
||||
|
@ -45,7 +48,6 @@ namespace AIParkingApplication
|
|||
|
||||
public void ReadVideoStream()
|
||||
{
|
||||
VideoCapture videoCapture = new VideoCapture(); //TODO: Need to dispose this videoCapture?
|
||||
Mat videoFrame = new Mat();
|
||||
if (!videoCapture.Open(streamUrl))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user