LATEST VERSION 4.0 (05.07.2012)

Description

Recognition process can be much more efficient if it is based on the detection of features that encode some information about the class to be detected. Haar-like features encode the existence of oriented contrasts between regions in the image. A set of these features can be used to encode the contrasts exhibited by a human face and their spacial relationships. Haar-like features owe their name to the fact that they are computed similarly to the coefficients in Haar wavelet transforms. This module requires a UImage source variable to work.

objectdetected

Module functions

Initialization

UObjectDetection.new(&image); - initialize with image source
UObjectDetection.mode; - set detector mode
mode 0 - you have to get the image then call detector function manually (see example 1)
mode 1 - get image manually in a loop (see example 2)
mode 2 - use input port data-flow (see example 3)
UObjectDetection.multi; - true or false
true - detect all visible objects, return values as vectors
false - detect the biggest object, return values as scalars

Source parameters

UObjectDetection.scale; - set image scale for processing

Image parameters

UObjectDetection.image; - access to image
UObjectDetection.width; - image width (determined by scale)
UObjectDetection.height; - image height (determined by scale)

Detected object parameters

UObjectDetection.visible; - 1 if any objects detected
UObjectDetection.object; - image with the detected object
UObjectDetection.x; - object position
UObjectDetection.y; - object position
UObjectDetection.objectHeight; - detected object height
UObjectDetection.objectWidth; - detected object width

Detector parameters

UObjectDetection.cascade; - set path and name to cascade
UObjectDetection.scaleFactor; - specifies how much the image size is reduced at each image scale (default 1.1)
UObjectDetection.minNeighbors; - specifies how many neighbors should each candidate rectangle have to retain it (default 10)
UObjectDetection.size; - the minimal possible object size. Smaller objects are ignored (default 30)

Other

UObjectDetection.time; - processing time
UObjectDetection.fps; - algorithm performance
UObjectDetection.input; - object input (use in mode 3 only)
UObjectDetection.SetImage(image); - use this function to detect an object manually, you can run this function in the background

Urbiscript examples

Example 1

loadModule("UCamera");
var Global.Cam=UCamera.new(0);
loadModule("UObjectDetection");
var Global.Det=UObjectDetection.new(Global.Cam.&image);
Global.Det.cascade="haarcascade_frontalface_alt2.xml";
Global.Det.scale=2;
t:loop {
    Global.Cam.GetImage();
    Global.Det.SetImage(Global.Cam.image),
},

Example 2

loadModule("UCamera");
var Global.Cam=UCamera.new(0);
loadModule("UObjectDetection");
var Global.Det=UObjectDetection.new(Global.Cam.&image);
Global.Det.mode=1;
Global.Det.cascade="haarcascade_frontalface_alt2.xml";
Global.Det.scale=2;
t:loop {Global.Cam.GetImage(); },

Example 3

loadModule("UCamera");
var Global.Cam=UCamera.new(0);
Global.Cam.notify=1;
loadModule("UObjectDetection");
var Global.Det=UObjectDetection.new(Global.Cam.&image);
Global.Det.mode=2;
Global.Det.cascade="haarcascade_frontalface_alt2.xml";
Global.Det.scale=2;
var Conn = Global.Cam.&image >> Global.Det.&input;

Download here

LINK

 

 

 

EMYS and FLASH are Open Source and distributed according to the GPL v2.0 © Rev. 0.8.0, 27.04.2016

FLASH Documentation