You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
im novice developer using c#. I made User Control for playing rtsp from emgu.cv. I used this user control for my main program for playing 9 rtsp. but when i used my user control 9 times, it makes my cpu overflow, more than 70% cpu usage, also 1.3GB memory usage. i don't know what's wrong with my code. please help me anyone used emgu.cv in c#. it doesn't matter when playing only one rtsp. also tell me if my code seems bad, how to fix it! i don't know reason. please help me as fast as you can! this is my code
capture = new VideoCapture(rtspUrl, VideoCapture.API.Ffmpeg);
capture.SetCaptureProperty(CapProp.Fps, frame);
capture.Start();
Performance issue are usually a result of the Open CV implementation.
You can try Open CV for python. If the performance is the same as Emgu CV, you can report the bug to the Open CV team. It will need to be fixed on the Open CV side. Once it is fixed in Open CV, Emgu CV will have the fix included.
# import the opencv library
import cv2
# define a video capture object
vid = cv2.VideoCapture("{your_rtsp_url}")
while(True):
# Capture the video frame
# by frame
ret, frame = vid.read()
# Display the resulting frame
cv2.imshow('frame', frame)
# the 'q' button is set as the
# quitting button you may use any
# desired button of your choice
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# After the loop release the cap object
vid.release()
# Destroy all the windows
cv2.destroyAllWindows()
im novice developer using c#. I made User Control for playing rtsp from emgu.cv. I used this user control for my main program for playing 9 rtsp. but when i used my user control 9 times, it makes my cpu overflow, more than 70% cpu usage, also 1.3GB memory usage. i don't know what's wrong with my code. please help me anyone used emgu.cv in c#. it doesn't matter when playing only one rtsp. also tell me if my code seems bad, how to fix it! i don't know reason. please help me as fast as you can! this is my code
capture = new VideoCapture(rtspUrl, VideoCapture.API.Ffmpeg);
capture.SetCaptureProperty(CapProp.Fps, frame);
capture.Start();
Task.Run(async () =>
{
while (isPlaying)
{
UpdateFrame();
await Task.Delay(1000 / frame);
Thread.Sleep(1);
}
});
}
using (Mat frame = new Mat())
{
capture.Retrieve(frame, 0);
if (!frame.IsEmpty)
{
using (Image<Bgr, byte> image =
frame.ToImage<Bgr, byte>())
{
lock (captureLock)
{
try
{
if (!isRecording && videoWriter !=null)
videoWriter.Dispose();
else if (isRecording && videoWriter != null)
{
if(frame!=null)
videoWriter.Write(frame);
}
}
catch (System.AccessViolationException) { }
}
pictureBoxRTSP1.Invoke((MethodInvoker)(() =>pictureBoxRTSP1.Image = image.ToBitmap()));
}
}
else
{
}
}
The text was updated successfully, but these errors were encountered: