www.pudn.com > faces.rar > finder.c


/*** 
 **     libface - Library of face recognition and supporting algorithms 
        Copyright (c) 2003 Stefan Farthofer 
 
	This file is part of libface, which 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 2 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, write to the Free Software 
        Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
 
	For further information seek us at http://sourceforge.net/projects/openbio/ 
**	or write an email to dimitri.pissarenko@gmx.net or farthofer@chello.at. 
***/ 
 
#include  
#include  
#include "frbase.h" 
#include "fr.h" 
#include "cvfinder.h" 
 
 
//just calls the corresponding finder method 
int frFindFaces(int finder, FRimage* image, FRbox** boxes, unsigned int* nrBoxes) { 
	if (finder != FR_FINDER_OPENCV) return FR_ERR_NOTIMPL; 
 
    return cvFindFaces(image, boxes, nrBoxes); 
} 
 
//uses frFindFaces and our custom preprocessor (which should be selectable too) 
int frFindFaceAndProcess(int finder, FRimage* in, FRimage** out, unsigned int w, unsigned int h) { 
	int ret; 
	FRbox *boxes; 
	unsigned int nrBoxes; 
 
	ret = frFindFaces(finder, in, &boxes, &nrBoxes); 
	if (ret != FR_OK) return ret; 
	if (nrBoxes == 0) return FR_NOTHING_FOUND; 
 
    ret = frPreprocess(FR_PREPROC_PHILIPPG, in, out, boxes, w, h); 
	free(boxes); 
	return ret; 
}