Detect face then autocrop pictures

前端 未结 11 594
慢半拍i
慢半拍i 2021-01-29 17:44

I am trying to find an app that can detect faces in my pictures, make the detected face centered and crop 720 x 720 pixels of the picture. It is rather very time consuming &

11条回答
  •  孤城傲影
    2021-01-29 18:01

    facedetect

    https://github.com/wavexx/facedetect is a nice Python OpenCV CLI wrapper, and I have just added that example to their README using ImageMagick:

    for file in path/to/pictures/*.jpg; do
      name=$(basename "$file")
      i=0
      facedetect "$file" | while read x y w h; do
        convert "$file" -crop ${w}x${h}+${x}+${y} "path/to/faces/${name%.*}_${i}.${name##*.}"
        i=$(($i+1))
      done
    done
    

    Tested on Ubuntu 16.04 with thousands of (unlabeled) Facebook profile pictures, see: https://github.com/cirosantilli/art/tree/d4352a46064d156591817c4eae5199f5ac8f23be/facebook

提交回复
热议问题