Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
cordova-plugin-facedetection-lite
Advanced tools
A face detection offline with a few lines of code. Was designed to run on old smartphones.
This plug-in makes facial detection offline with a few lines of code, without the need to use TensorFlow. Was designed to run on old smartphones. This plugin implementation of the method described in 2013 by Markuš et al.
PS: For older smartphones, it is ideal that each frame analyzed has a maximum height and width of 60 pixels and the processing loop runs every 100 milliseconds or more. In the sample project this was implemented.
cordova plugins add cordova-plugin-facedetection-lite
sizeFrameMemory
, faceFinderPath, resultCallback)sizeFrameMemory
- Number of frames that will be used to reinforce the detection of all faces. Defaults to 5faceFinderPath
- Facial training file location, being allowed offline. Defaults to cascades/facefinderresultCallback
- Callback functionfacedetection.initFaceDetection(5, "./facefinder", function (result) {
/* Here you can create the loop to detect frames */
});
Warning: Until the current version, the parameters are being ignored on some platforms, being ixed default value in the code.
rgba
- Image in byte arraywidth
- Image widthheight
- Image heightminSizeFace
- Minimum size of selected facesmaxSizeFace
- Minimum size of selected facesiouthreshold
- Maximum size of selected facesresultCallback
- Callback functionfacedetection.detections(rgba, cameraWidth, cameraHeight, cameraWidth * 0.2, cameraWidth * 1.2, 0.1, function (dets) {
for (i = 0; i < dets.length; ++i) {
var box = dets[i];
var canvasPreviewCtx = canvasPreview.getContext('2d');
canvasPreviewCtx.beginPath();
canvasPreviewCtx.arc(box[1], box[0], box[2] / 2, 0, 2 * Math.PI, false);
canvasPreviewCtx.lineWidth = 1;
canvasPreviewCtx.strokeStyle = 'red';
canvasPreviewCtx.stroke();
}
});
Warning: Until the current version, only the first 3 parameters are implemented and the rest of the parameters are being ignored on some of the platforms, being fixed default value in the code.
TODO
iOS |
Browser |
function sampleImageDetector() {
var width = 319;
var height = 480;
var canvasPreview = document.createElement('canvas');
canvasPreview.width = width;
canvasPreview.height = height;
var canvasPreviewCtx = canvasPreview.getContext('2d');
var url = 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/65/Will_Smith_by_Gage_Skidmore.jpg/319px-Will_Smith_by_Gage_Skidmore.jpg';
var baseImage = new Image();
baseImage.src = url + '?' + new Date().getTime();
baseImage.setAttribute('crossOrigin', '');
baseImage.onload = function () {
canvasPreviewCtx.drawImage(baseImage, 0, 0);
var rgba = canvasPreviewCtx.getImageData(0, 0, width, height).data;
facedetection.initFaceDetection(0, "./facefinder", function (result) {
facedetection.detections(rgba, width, height, width * 0.2, width * 1.2, 0.1,
function (dets) {
var greaterFace = Math.max.apply(
Math,
dets.map(function (o) {
return o[2];
})
);
for (i = 0; i < dets.length; ++i) {
var box = dets[i];
if (box[2] != greaterFace || box[3] === undefined) {
continue;
}
if (box !== undefined) {
canvasPreviewCtx.beginPath();
canvasPreviewCtx.arc(box[1], box[0], box[2] / 2, 0, 2 * Math.PI, false);
canvasPreviewCtx.lineWidth = 3;
canvasPreviewCtx.strokeStyle = 'red';
canvasPreviewCtx.stroke();
}
}
document.body.appendChild(canvasPreview);
});
});
};
}
If you intend to do some improvement in the project, follow some instructions, such as compiling library in the C language.
If you modify the C source files, be sure to re-build the compiled libraries.
You can re-build the libpicornt.so
binaries using the ndk-build script.
To do so:
export PATH=$PATH;$ANDROID_SDK_HOME/ndk-bundle
export ANDROID_NDK_HOME=$ANDROID_SDK_HOME/ndk-bundle
./compile-android
(compile-android.cmd
on Windows)If you modify the C source code in common/picornt/
you'll need to rebuild the static library and headers in src/ios/libs
.
./compile-ios
Created by Luís De Marchi @luisdemarchi - Linkedin
FAQs
A face detection offline with a few lines of code. Was designed to run on old smartphones.
We found that cordova-plugin-facedetection-lite demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.