// // MPTBlinkController.m // BlinkDetector // // Created by Andrew Salamon on 9/25/06. // Copyright 2006 __MyCompanyName__. All rights reserved. // #import "MPTBlinkController.h" @implementation MPTBlinkController - (id)init { if( self = [super init] ) { blinks = new MPBlink; blinks->setPixelMax( 1.0 ); } return self; } - (void)dealloc { delete blinks; [super dealloc]; } - (BOOL)loadLabels { labels = [[NSArray alloc] initWithObjects:[self localizedName], nil]; return YES; } - (NSString *)pluginID { NSString *ident = [super pluginID]; if( [ident length] > 0 ) return ident; return @"edu.ucsd.mplab.plugins.BlinkDetector"; } - (NSString *)localizedName { return NSLocalizedStringFromTableInBundle(@"Blink Detector", nil, [NSBundle bundleForClass:[self class]], @""); } - (NSString *)internalName { return @"blinks"; } - (NSString *)step { return MPT_PluginStep_AfterFaces; } - (BOOL)processFaces:(EyeFaceList &)faces fromEyefinder:(MPTSlidingWindow *)eyefinder withImage:(RImage &)pixels { RIntegral* pfIntegral = static_cast*>(eyefinder->getIntegralPtr().get()); if( SMD_NO_ERR == blinks->findBlinksGivenEyes( pixels, faces, pfIntegral ) ) { return YES; } return NO; } - (double)processFace:(FaceObject &)face withImage:(RImage &)pixels { return blinks->findBlinksFromFace( pixels, face ); } - (void)processNoFace { } @end