kurento-module-detectorplugin
Version:
Face Detector
169 lines (135 loc) • 4.09 kB
JavaScript
/* Autogenerated with Kurento Idl */
/*
* (C) Copyright 2013-2015 Kurento (http://kurento.org/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var inherits = require('inherits');
var kurentoClient = require('kurento-client');
var disguise = kurentoClient.disguise;
var checkType = kurentoClient.checkType;
var ChecktypeError = checkType.ChecktypeError;
var Transaction = kurentoClient.TransactionsManager.Transaction;
var OpenCVFilter = kurentoClient.register.abstracts.OpenCVFilter;
function noop(error, result) {
if (error) console.trace(error);
return result
};
/**
* Create an element
*
* @classdesc
* DetectorPlugin interface. Documentation about the module
*
* @extends module:filters/abstracts.OpenCVFilter
*
* @constructor module:detectorplugin.DetectorPlugin
*/
function DetectorPlugin(){
DetectorPlugin.super_.call(this);
};
inherits(DetectorPlugin, OpenCVFilter);
//
// Public methods
//
/**
* Detect face count
*
* @alias module:detectorplugin.DetectorPlugin.detectFace
*
* @param {external:Integer} enable
* Boolean value on detection
*
* @param {module:detectorplugin.DetectorPlugin~detectFaceCallback} [callback]
*
* @return {external:Promise}
*/
DetectorPlugin.prototype.detectFace = function(enable, callback){
var transaction = (arguments[0] instanceof Transaction)
? Array.prototype.shift.apply(arguments)
: undefined;
//
// checkType('int', 'enable', enable, {required: true});
//
var params = {
enable: enable
};
callback = (callback || noop).bind(this)
return disguise(this._invoke(transaction, 'detectFace', params, callback), this)
};
/**
* @callback module:detectorplugin.DetectorPlugin~detectFaceCallback
* @param {external:Error} error
*/
/**
* Detect head position id 3D
*
* @alias module:detectorplugin.DetectorPlugin.detectHeadPosition
*
* @param {external:Integer} enable
* Boolean value on detection
*
* @param {module:detectorplugin.DetectorPlugin~detectHeadPositionCallback} [callback]
*
* @return {external:Promise}
*/
DetectorPlugin.prototype.detectHeadPosition = function(enable, callback){
var transaction = (arguments[0] instanceof Transaction)
? Array.prototype.shift.apply(arguments)
: undefined;
//
// checkType('int', 'enable', enable, {required: true});
//
var params = {
enable: enable
};
callback = (callback || noop).bind(this)
return disguise(this._invoke(transaction, 'detectHeadPosition', params, callback), this)
};
/**
* @callback module:detectorplugin.DetectorPlugin~detectHeadPositionCallback
* @param {external:Error} error
*/
/**
* @alias module:detectorplugin.DetectorPlugin.constructorParams
*
* @property {module:core.MediaPipeline} mediaPipeline
* the parent {@link module:core.MediaPipeline MediaPipeline}
*/
DetectorPlugin.constructorParams = {
mediaPipeline: {
type: 'kurento.MediaPipeline',
required: true
}
};
/**
* @alias module:detectorplugin.DetectorPlugin.events
*
* @extends module:filters/abstracts.OpenCVFilter.events
*/
DetectorPlugin.events = OpenCVFilter.events;
/**
* Checker for {@link module:detectorplugin.DetectorPlugin}
*
* @memberof module:detectorplugin
*
* @param {external:String} key
* @param {module:detectorplugin.DetectorPlugin} value
*/
function checkDetectorPlugin(key, value)
{
if(!(value instanceof DetectorPlugin))
throw ChecktypeError(key, DetectorPlugin, value);
};
module.exports = DetectorPlugin;
DetectorPlugin.check = checkDetectorPlugin;