Last active
February 22, 2017 09:23
-
-
Save dardo82/dcb643db39f0757a512db1f555df59c5 to your computer and use it in GitHub Desktop.
OpenCV pics filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*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); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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