Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » C++ / CLI » General » Downloads
 
Add your own
alternative version

Intelligent Screen Saver

, 15 Aug 2007 CPOL
A utility to control screen saver on your computer using computer vision (human face detection), rather than idle timer.
intelligentsaver.zip
intelligentsaver2.zip
IntelligentSaver.suo
DxCam
dshow
Core
DxCam.csproj.user
DxCam.suo
Gui
VideoSource
FaceDetection
App.ico
FaceDetection.GUI.csproj.user
FaceDetection.suo
FaceDetectionWrapper
app.ico
release.zip
Release
cv099.dll
cxcore099.dll
DxCam.dll
FaceDetection.exe
FaceDetection.Wrapper.dll
libguide40.dll
Tiger.Video.VFW.dll
requiredbinaries.zip
References
Tiger.Video.VFW.dll
Cascades
OpenCV
cv099.dll
cxcore099.dll
libguide40.dll
vs2005.zip
VS2005
DxCam
dshow
Core
DxCam.csproj.user
DxCam.suo
Gui
VideoSource
FaceDetection
App.ico
FaceDetection.GUI.csproj.user
FaceDetection.suo
FaceDetectionWrapper
app.ico
Bayesian_ML_DLL.vcproj.Z.Zeeshan.user
IntelligentSaver.suo
// facedetect.h : main header file for the FACEDETECT DLL
//
#pragma once
#include "cv.h"
#pragma managed 

#define scale 1.3
#define MAXOBJECTCOUNT 5
#define MaxValue 32000

#define cascade_name "haarcascade_frontalface_alt.xml"



/////////////////////////////////////////////////////////////////////////////
// CFacedetectApp
// See facedetect.cpp for the implementation of this class
//
#pragma managed 
__gc class ObjectLocator 
{
private:
	int width,height;             //dimensions of the scene bitmap	  
	CvHaarClassifierCascade* cascade;
	CvMemStorage* storage ;		
	int object_location __gc[,];
	//int object_location __gc[MAXOBJECTCOUNT][4];  //stores the locations of detected objects	
	
	/* finds sequence element by its index */
	char* Helper( const CvSeq *seq, int index )
	{
		CvSeqBlock block;
		int count, total = seq->total;

		if( (unsigned)index >= (unsigned)total )
		{
			index += index < 0 ? total : 0;
			index -= index >= total ? total : 0;
			if( (unsigned)index >= (unsigned)total )
				return 0;
		}

		block = *seq->first;
		if( index + index <= total )
		{
			while( index >= (count = block.count) )
			{
				block = *block.next;
				index -= count;
			}
		}
		else
		{
			do
			{
				block = *block.prev;
				total -= block.count;
			}
			while( index < total );
			index -= total;
		}

		return block.data + index * seq->elem_size;
	}

public:		
	void SetFaceROI(int index);
	void UnSetFaceROI();

	void UnInitImageStorage();
	void InitImageStorage(int img_width, int img_height, double img_scale);
	
	void ImagePreProcessForFaceDetection();
	void ImagePreProcessForEyeDetection();
	
	void ManagedImagetoUnManagedImage(IplImage* Src);
	//void PrepareSmallImage();		
	int NoOfObjects;            //number of faces detected	
	void GetObjectCoordinates(int oNum, int &tx, int &ty, int &bx, int &by);
	int DetectObjects();
	int InitObjectDetect(char* cascadename);	
	ObjectLocator();
	~ObjectLocator();
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Zeeshan Ejaz Bhatti
Web Developer
Pakistan Pakistan
BCSE - Software Engineering (2000 - 2004)
Foundation University Institute of Management and Computer Sciences.
Pakistan.
 
MS - Computer Sciences (2004 - 2005)
Lahore Univeristy of Management Sciences
Pakistan.

| Advertise | Privacy | Mobile
Web03 | 2.8.141015.1 | Last Updated 15 Aug 2007
Article Copyright 2007 by Zeeshan Ejaz Bhatti
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid