0

I am developing a real-time computer vision application using C#. But I am not able to optimize Emgucv decoding. I have 800-millisecond delay from the ground truth and 600-millisecond delay from the Ip camera provider application AXIS.

How can I optimize the code that I can have at-most 250-milliseconds delay?

Here is code for grabbing an image.

capture1 = new Capture(IpFirstCamTxt.Text);     //create a camera captue from RTSP Stream
capture2 = new Capture(Ip2ndCamTxt.Text);
capture3 = new Capture(Ip3rdCamTxt.Text);
capture4 = new Capture(Ip4thCamTxt.Text);

capture1.Start();
capture2.Start();
capture3.Start();
capture4.Start();
capture1.ImageGrabbed += ProcessFrame1;
capture2.ImageGrabbed += ProcessFrame2;
capture3.ImageGrabbed += ProcessFrame3;
capture4.ImageGrabbed += ProcessFrame4;



private void ProcessFrame1(object sender, EventArgs arg)
{
    _capture.RetrieveBgrFrame().ToBitmap());
    capture1.Retrieve(img1, 3);
    pictureBox1.Image = img1.ToBitmap();
}
private void ProcessFrame2(object sender, EventArgs arg)
{
    capture2.Retrieve(img2, 3);
    pictureBox3.Image = img2.ToBitmap();

}
private void ProcessFrame3(object sender, EventArgs arg)
{
    capture3.Retrieve(img3, 3);
    pictureBox4.Image = img3.ToBitmap();
}
private void ProcessFrame4(object sender, EventArgs arg)
{
    capture4.Retrieve(img4, 3);
    pictureBox5.Image = img4.ToBitmap();
}

Stopwatch results of my application comparing with camera provider application: Stopwatch results of my application comparing with camera provider application

Amin Ullah
  • 77
  • 9

1 Answers1

0

The above-mentioned problem has been solved using one of the real-time RTSP stream capturing library named as LIVE555. I have used it in C++ and shared the memory of images with C#. The delay is reduced up to round about 200 milliseconds only. If anyone wants real-time video streaming then LIVE555 is the best. I will upload the project to my Github.

Source Real-time RTSP Stream Decoding

Amin Ullah
  • 77
  • 9
  • Your link points to an empty repository. Please insert the code in the answer directly (always). – Tim Diekmann Jul 03 '18 at 10:42
  • Dear, the link is now available and because it is not small code it is full package that's why I uploaded there. – Amin Ullah Jul 04 '18 at 01:58
  • Thank you for this link, which might provide some limited, immediate help. An answer [should include sufficient context around the link](https://meta.stackexchange.com/q/225370/206345) so your fellow users will have some idea what it is and why it’s there. Always quote the most relevant part of an important link, to make it more useful to future readers with other, similar questions. Please [edit] your answer to add some explanation, including the assumptions you've made. – Tim Diekmann Jul 04 '18 at 08:16