Skip to content

Instantly share code, notes, and snippets.

@dardo82
Last active February 22, 2017 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dardo82/dcb643db39f0757a512db1f555df59c5 to your computer and use it in GitHub Desktop.
Save dardo82/dcb643db39f0757a512db1f555df59c5 to your computer and use it in GitHub Desktop.
OpenCV pics filter
/*jslint node: true, nomen: true*/
"use strict";
var path = require('path');
var _ = require('underscore');
var Faced = require('faced');
var faced = new Faced();
function worker(faces, image, file) {
_.each(faces, function (face) {
console.log(
"Found a face with dimensions %dx%d in file %s",
face.getWidth(),
face.getHeight(),
file
);
});
}
_.each(process.argv.slice(2), function (file) {
faced.detect(path.resolve(file), worker);
});
#!/bin/sh
# Filter pics with faces
for image in $(find $1 -exec file {} \; | awk -F'[x:, ]' -v min=$2 '/image/ {if ($(NF-4)>=min&&$(NF-3)>=min) print $1}'); do node ${0%/*}/nodejs/faced.js $image; done | awk -F'[x ]' -v min=$1 '{if ($6>=min&&$7>=min) print}' | sort -tx -k2 -n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment