Shoot on face detection - Feature Requests - CHDK Forum supplierdeeply

Shoot on face detection

  • 1 Replies
  • 3861 Views
*

Offline LjL

  • ****
  • 266
  • A720IS
Shoot on face detection
« on: 02 / July / 2008, 10:25:43 »
Advertisements
For cameras with face detection, it would be nice to have something similar to motion detection but which, instead, shoots when a face is in the frame.

I've looked through the PropCases trying to find something that would tell whether a face has been detected, without much success... but perhaps I haven't looked hard enough, or in any case, if it's not in the PropCases, it will be somewhere else that can be handled (if not by a script) by the CHDK code itself.

As a very last resort, the motion detection algorithm could be adapted to look for the white-frame pattern that appears on the LCD when face detection is active and locked on a face.

*

Offline LjL

  • ****
  • 266
  • A720IS
Re: Shoot on face detection
« Reply #1 on: 09 / July / 2008, 16:37:56 »
Feature implemented, although I haven't found out where the information on face detection is kept - I merely use the nasty trick of looking at screen redraws (since face detection will always trigger one).

I'm attaching a modified version of core/motion_detector.c and core/motion_detector.h, as well as a binary for the A720IS.

The new feature can be used from uBasic by calling md_motion_detect with mode "9".

Sample script (but just about any motion detection script should work, if that instruction is modified as per the above):


@title Face detection
:loop
t=0
md_detect_motion 3, 3, 9, 60000, 20, 128, 1, t, 1, 1, 1, 3, 3, 0, 5, 5000
if t>0 then shoot
goto "loop"
end


Increase the last parameter's value (it's the usual startup delay) if you get continuous shots; try decreasing it if you want faster re-arming.

Note that you cannot half-shoot before using face detection; that's an OS limitation, face detection is only performed before locking exposure and focus. This means it will never be lightening-fast.

It can be useful for self-photos and scaring people, though ;)


Feedback / bug reports much appreciated.
« Last Edit: 10 / July / 2008, 07:04:19 by LjL »

 

Related Topics