A câmera IP para de transmitir após algum tempo
Estou trabalhando em um aplicativo em que quero usarIP camera
para exibir streaming de vídeo e outras operações importantes na imagem capturada peloIP Camera
.
Bibliotecas usadas na captura de câmera Para captura de câmera:Emgu.CV Biblioteca
Abaixo está o código que estou usando em C #.
Declaração Variável
private Capture capture; //takes images from camera as image frames
private Emgu.CV.UI.ImageBox img; // Dynamic Picture Controls
private int nCam; // no of cameras
Código para Processar Imagem
private void ProcessFrame(object sender, EventArgs arg)
{
try
{
// Live Streaming Display
Image<Bgr, Byte> ImageFrame = capture.QueryFrame();
// If Ip camera try to reinitialize the IP camera
if(ImageFrame == null)
{
capture.Dispose();
capture = new Capture(URL);
ImageFrame = capture.QueryFrame();
}
ImageFrame = ImageFrame.Resize(img.Width, img.Height, Emgu.CV.CvEnum.INTER.CV_INTER_LINEAR);
img.Image = ImageFrame;
// Here I am doing some other operations like
// 1. Save Image captured from the IP Camera
// 2. Detect faces in Image
// 3. Draw Face markers on Image
// 4. Some database based on result of Face Detection
// 4. Delete image File
// continue Looping for other Ip Cameras
}
catch (NullReferenceException e)
{
}
}
Agora, o problema é depois de algum tempo oQueryFrame()
providenciarnull
valor e câmera Pare a transmissão.
Alguém pode me dizer por que isso está acontecendo? Como posso resolver esse problema? Se precisar de mais informações, entre em contato.
Desde já, obrigado.