frame = cvQueryFrame(capture); // Get one frame
if(!frame) {
- fprintf(stdout, "NULL frame\n");
+ fprintf(stderr, "NULL frame\n");
continue;
}
#endif /*----------- DEBUG SESSION ONLY -----------*/
frame = cvQueryFrame(capture);
if(!frame) {
- fprintf(stdout, "NULL frame\n");
+ fprintf(stderr, "NULL frame\n");
// save error code to orte and publish it
orte.camera_result.error |= camera_ERR_NO_FRAME;
ORTEPublicationSend(orte.publication_camera_result);
+ usleep(100*1000);
continue;
} else if(orte.camera_result.error & camera_ERR_NO_FRAME) {
orte.camera_result.error &= ~camera_ERR_NO_FRAME;
sideConfig = recognize(floatMat, sideMasks, SIDEMASKSCNT, &sideDist);
centerConfig = recognize(floatMat, centerMasks, CENTERMASKSCNT, ¢erDist);
//publish results
- fprintf(stdout, "thr: %d, side: %d (%f), center: %d (%f)\n", threshold, sideConfig, sideDist, centerConfig, centerDist);
+ fprintf(stderr, "thr: %d, side: %d (%f), center: %d (%f)\n", threshold, sideConfig, sideDist, centerConfig, centerDist);
orte.camera_result.side = sideConfig;
orte.camera_result.center = centerConfig;
orte.camera_result.sideDist = sideDist;
}
#endif /*----------- DEBUG SESSION ONLY -----------*/
- fprintf(stdout, "waiting...\n");
+ fprintf(stderr, "waiting...\n");
sleep(1);
}
return MODE_RECOGNIZE;
// connect to a camera
while(!((capture=cvCaptureFromCAM(0)) || (capture=cvCaptureFromCAM(1)))) {
- fprintf(stdout, "NULL capture (is camera connected?)\n");
+ fprintf(stderr, "NULL capture (is camera connected?)\n");
orte.camera_result.error |= camera_ERR_NO_VIDEO;
- sleep(1);
+ ORTEPublicationSend(orte.publication_camera_result);
+ usleep(500*1000);
}
orte.camera_result.error &= ~camera_ERR_NO_VIDEO;
- fprintf(stdout, "rozkuk started, camera connected successfully\n");
+ ORTEPublicationSend(orte.publication_camera_result);
+ fprintf(stderr, "rozkuk started, camera connected successfully\n");
#ifdef ROZKUK_DEBUG /************ DEBUG SESSION ONLY ************/
// create gui windows and init font
IplImage *img = cvLoadImage(filename, CV_LOAD_IMAGE_GRAYSCALE);
if(!img) {
- fprintf(stdout, "Mask %s cannot be loaded.\n", filename);
+ fprintf(stderr, "Mask %s cannot be loaded.\n", filename);
fprintf(stderr, "Run me from _build/user/camera/rozkuk\n");
return 0;
}
if(!(len=clr2float(img, mask, CL_NEUTRAL, 1.0, NULL)))
fprintf(stderr, "A problem while converting mask to float occured.\n");
else
- fprintf(stdout, "Mask %s successfully loaded.\n", filename);
+ fprintf(stderr, "Mask %s successfully loaded.\n", filename);
cvReleaseImage(&img);
return len;