#include <iostream>
#include <time.h>
#include "oble.h"
+#include "idle_x11.h"
using namespace std;
// argument for cvFlip(src, dest, FLIP_TYPE)
#define MIRROR 1
+#define DEBUG 0
+
CvHaarClassifierCascade* load_object_detector(const char* cascade_path)
{
return (CvHaarClassifierCascade*)cvLoad(cascade_path);
CvMemStorage* storage = cvCreateMemStorage(0);
CvSeq* faces;
int i, scale = 1;
+ static int saw_last_time = 0;
/* if the flag is specified, down-scale the input image to get a
performance boost w/o loosing quality (perhaps) */
if(0 < faces->total)
{
t_current = time(NULL);
- //system("./gss-poke.py");
+ if(DEBUG)
+ {
+ printf(":) face \n");
+ }
+ if(saw_last_time)
+ {
+ if(DEBUG)printf("\t\tpoking\n");
+ reset_idle_time();
+ system("gnome-screensaver-command --poke");
+ }
+ saw_last_time = 1;
+ }
+ else
+ {
+ saw_last_time = 0;
+ if(DEBUG)
+ {
+ printf(":( no face \n");
+ }
}
/* draw all the rectangles */
if(elapse > timeout && elapse != last_elapse)
{
last_elapse = elapse;
- printf("elapse = %d\n", elapse);
+ if(DEBUG)
+ {
+ printf("elapse = %d\n", elapse);
+ }
if(!activated)
{
printf("activated\n");
detect_and_draw_objects(mirrored, cascade, 1);
cvShowImage("mywindow", mirrored);
// Do not release the frame!
- screensave(t_current);
+ //screensave(t_current);
//If ESC key pressed, Key=0x10001B under OpenCV 0.9.7(linux version),
//remove higher bits using AND operator