.*.sw?
-hello-world
-gnome-screensaver/
+oble
-all:oble
+all: oble
-oble:oble.cpp
- gcc `pkg-config --cflags opencv dbus-glib-1` -o oble oble.cpp `pkg-config --libs dbus-glib-1 opencv`
-
-gnome-screensaver-poke: gnome-screensaver-poke.c
- gcc `pkg-config --cflags dbus-glib-1` -o gnome-screensaver-poke gnome-screensaver-poke.c `pkg-config --libs dbus-glib-1`
+oble: oble.cpp oble.h
+ gcc `pkg-config --cflags opencv` -o oble oble.cpp `pkg-config --libs opencv`
test: all
./oble /usr/share/opencv/haarcascades/haarcascade_frontalface_alt.xml
clean:
- rm -rf oble gnome-screensaver-poke
+ rm -rf oble
new: clean all
--- /dev/null
+(screensaver activation and deactivation) has 2 managers right now. oble and
+gnome-screensaver have independent criteria for activation and deactivation.
+oble relies only on time since face detected, gss relies on time since keyboard
+or mouse state change. this causes annoying problems.
+ * example: gss activates screensaver on timeout even though face is clearly
+ detected the whole time.
+ * workaround: make gss timeout be as long as possible
+there are other problems.
+the real fix is to combine the two. user activity should be any of {keyboard,
+mouse, face detection}.
prevent the system from sleeping when a user is looking at the screen.
-this is accomplished using the built-in camera on my laptop screen's top bezel
-and opencv to detect a face. i'm going to use the API used by the default movie
-player in ubuntu for preventing system sleeps.
+this is accomplished using a camera and opencv to detect a face.
-OTHER IDEAS:
-* detecting a face could simulate user activity. this would prevent sleeping
-and bring up the password prompt when the system is already asleep.
- * how cool would that be? if the system is asleep and you sit down at it, the
- password prompt comes up before you touch anything!
- * or if the screen saver doesn't lock the screen, then the laptop just wakes
- up.
- * DONE!
-* fire up the face detector only just before going to inactive mode.
- * that way the camera isn't running all the time
- * maybe start 10 seconds before going inactive, then run until activity
-* authenticating a user based on face recognition (as opposed to face
-detection)
- * much more difficult to do reliably
-* be more aggressive with turning off the screen. dim the screen as soon as
-it's not being looked at. turn it off soon thereafter.
- * could be enough to save battery. would need to power the camera sometimes,
- but would save on backlight. need to test.
-* don't prevent sleep when face is detected, but user isn't actually looking at
-screen.
- * requires pose estimation.
- * also requires estimating the direction of the eye.
+this readme is woefully short. feel free to write more
--- /dev/null
+FOR SCREENSAVER:
+* use [Un]Inhibit together as a SimulateUserActivity workalike
+* xdg-screensaver suspend / resume to SimulateUserActivity
+ * http://tronche.com/gui/x/xlib-tutorial/2nd-program-anatomy.html
+ * http://portland.freedesktop.org/xdg-utils-1.0beta3/xdg-screensaver.html
+* SimulateUserActivity
+ * does it work on other people's machines?
+ * find if other people have their gnome-screensaver run even if they set
+ screensaver timeout to 1 minute and run:
+ for ((i = 0; i < 999; i++)); do
+ sleep 50;
+ gnome-screensaver-command --poke;
+ done;
+ * find irc channel to ask if my understanding is correct
+ * file bug
+ * track down bug
+ * compile gnome-screensaver
+* cli opt parse
+ * quiet mode
+ * no display window
+ * no text printed to terminal
+* fire up the face detector only just before going to inactive mode.
+ * that way the camera isn't running all the time
+ * maybe start 10 seconds before going inactive, then run until activity
+* be more aggressive with turning off the screen. dim the screen as soon as
+it's not being looked at. turn it off soon thereafter.
+ * could be enough to save battery. would need to power the camera sometimes,
+ but would save on backlight. need to test.
+* don't prevent sleep when face is detected, but user isn't actually looking at
+screen.
+ * requires pose estimation.
+ * also requires estimating the direction of the eye.
+
+OTHER IDEAS:
+* authenticating a user based on face recognition (as opposed to face
+detection)
+ * much more difficult to do reliably
+ * use object tracking and emotion estimation to require a set of facial
+ expressions as authentication.
+ * awesome for people who find typing hard, eg: no hands
+++ /dev/null
-#!/usr/bin/env bash
-gnome-screensaver-command -a
+++ /dev/null
-#!/usr/bin/env perl
-
-my $cmd = "dbus-monitor --session \"type='signal',interface='org.gnome.ScreenSaver',member='SessionIdleChanged'\"";
-
-open (IN, "$cmd |");
-
-while (<IN>) {
- if (m/^\s+boolean true/) {
- `./hello-world`;
- } elsif (m/^\s+boolean false/) {
- print "*** Session is no longer idle ***\n";
- }
-}
#include <stdio.h>
#include <iostream>
#include <time.h>
-
-static time_t t_last = time(NULL);
-static time_t t_current = time(NULL);
-static time_t t_tmp = time(NULL);
+#include "oble.h"
using namespace std;
--- /dev/null
+//use the camera to aid the decision to sleep.
+//Copyright 2009 Daniel Watson
+/*
+ use a camera to prevent screensaver
+ Copyright (C) 2009 daniel watson, ozzloy@gmail.com
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+/*
+ This file is part of oble.
+
+ oble is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ oble is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with oble. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+static time_t t_current = time(NULL);
+
+// argument for cvFlip(src, dest, FLIP_TYPE)
+#define MIRROR 1
+
+CvHaarClassifierCascade* load_object_detector(const char* cascade_path);
+
+void detect_and_draw_objects(IplImage* image,
+ CvHaarClassifierCascade* cascade,
+ int do_pyramids);
+
+void screensave(time_t t_current);
+
+bool parse_opts(int argc, char **argv);