Opencv rtsp stream synchronize problem help!
sorry about my lower english I'm south korean, but I think you can read it
When i get H.264 video stream with RTSP, I have prablem with getting decend image.
In code
I use cvWaitKey(1) 1~100 for synchronize cameras buffer and cvQueryFrame()
I think this problem is just TIME problem But I don't know how get signal of Camera's buffer is written.
int cnt = 0;
int count = 0;
IplImage *img[MAXCAM];
CvCapture *camera[MAXCAM];
CString numFrame[MAXCAM];
/// 임의 영역
//camera[0] = cvCreateFileCapture("rtsp://127.0.0.1:951/everyone");
//camera[1] = cvCreateFileCapture("rtsp://admin:[email protected]:554/channel1");
camera[0] = cvCreateFileCapture("rtsp://admin:[email protected]:554/channel1");
camera[1] = cvCreateFileCapture("rtsp://127.0.0.1:951/everyone");
for (cnt = 0 ; cnt<MAXCAM; cnt++ ) {
if (camera[cnt] == NULL) {
return -1;
}
numFrame[cnt].Format("CAM %d", cnt);
cvNamedWindow(numFrame[cnt]);;
}
while (cvWaitKey(1) != 27) { /// cvWaitKey 가 보내주는 bitrate 에 맞추어 출력하지 못할경우 이미지 일그러짐 현상
//for ( cnt = 0; cnt < MAXCAM ; cnt ++ ) {
img[1] = cvQueryFrame(camera[1]);
//if (img[cnt] == NULL)
// return -2;
cvShowImage(numFrame[1], img[1]);
//}
}
for (cnt = 0; cnt < MAXCAM; cnt++) {
cvReleaseCapture(&camera[cnt]);
cvReleaseImage(&img[cnt]);
}
return 0;