From 79292335fc6c7fb9b83ef0125332b6556b3de9d2 Mon Sep 17 00:00:00 2001 From: ozzloy Date: Sat, 30 Jan 2010 17:11:20 -0800 Subject: [PATCH] pulling out dbus stuff from face detection --- .gitignore | 2 ++ Makefile | 2 ++ hello-world.cpp | 36 ++++++++++++++++++++---------------- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 3268211..b33fd92 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ .*.sw? +hello-world + diff --git a/Makefile b/Makefile index fd1361f..dc5f06f 100644 --- a/Makefile +++ b/Makefile @@ -12,4 +12,6 @@ test: all clean: rm -rf hello-world tags dbushello +new: clean all + .PHONY: clean diff --git a/hello-world.cpp b/hello-world.cpp index c88efec..12c666e 100644 --- a/hello-world.cpp +++ b/hello-world.cpp @@ -38,16 +38,16 @@ #include #include #include -#include -#include +//#include +//#include using namespace std; -DBusGConnection *connection; -GError *error; -DBusGProxy *proxy; -char **name_list; -char **name_list_ptr; +//DBusGConnection *connection; +//GError *error; +//DBusGProxy *proxy; +//char **name_list; +//char **name_list_ptr; // argument for cvFlip(src, dest, FLIP_TYPE) @@ -81,19 +81,21 @@ void detect_and_draw_objects(IplImage* image, faces = cvHaarDetectObjects(small_image, cascade, storage, 1.2, 2, CV_HAAR_DO_CANNY_PRUNING); + /* if(0 < faces->total) { dbus_g_proxy_call_no_reply(proxy, "SimulateUserActivity", G_TYPE_INVALID); } + */ /* draw all the rectangles */ for(i = 0; i < faces->total; i++) { /* extract the rectangles only */ CvRect face = *(CvRect*)cvGetSeqElem(faces, i); - CvPoint upperLeft = cvPoint(face.x*scale,face.y*scale); - CvPoint bottomRight = cvPoint((face.x+face.width)*scale, - (face.y+face.height)*scale); + CvPoint upperLeft = cvPoint(face.x * scale, face.y * scale); + CvPoint bottomRight = cvPoint((face.x + face.width) * scale, + (face.y + face.height) * scale); cvRectangle(image, upperLeft, bottomRight, CV_RGB(255,0,0), 3); } @@ -105,25 +107,27 @@ void detect_and_draw_objects(IplImage* image, // A Simple Camera Capture Framework. int main(int argc, char** argv) { - g_type_init (); +// g_type_init (); - error = NULL; - connection = dbus_g_bus_get (DBUS_BUS_SESSION, - &error); - if (connection == NULL) + //error = NULL; + //connection = dbus_g_bus_get (DBUS_BUS_SESSION, + // &error); + /*if (connection == NULL) { g_printerr ("Failed to open connection to bus: %s\n", error->message); g_error_free (error); exit (1); - } + }*/ /* Create a proxy object for the "bus driver" (name "org.freedesktop.DBus") */ + /* proxy = dbus_g_proxy_new_for_name (connection, "org.gnome.ScreenSaver", "/org/gnome/ScreenSaver", "org.gnome.ScreenSaver"); + */ CvHaarClassifierCascade* cascade = load_object_detector(argv[1]); -- 2.30.2