www.pudn.com > faces.rar > pgpreproc.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  
 
int pgPreprocess(FRimage* in, FRimage** out, FRbox* box, int w, int h) { 
	ILuint imgnr; 
	int err; 
 
	 
	frImgGetILImgFloat(&imgnr, in); 
	ilBindImage(imgnr); 
	ilConvertImage(IL_LUMINANCE, IL_UNSIGNED_BYTE); 
 
	iluCrop((ILuint)box->x1, (ILuint)box->y1, 1, (ILuint)(box->x4-box->x1), (ILuint)(box->y2-box->y1),1); 
	iluImageParameter(ILU_FILTER, ILU_BILINEAR); 
	iluScale(w,h,1); 
 
 
	ilConvertImage(IL_LUMINANCE, IL_FLOAT); 
	*out=(FRimage*)malloc(sizeof(FRimage)); 
	frImgLoadBound(*out); 
	ilDeleteImages(1, &imgnr); 
	return FR_ERR_NOTIMPL; 
}