What is a good computer vision library for Python

2019-04-13 00:47发布

I need to develop a script utilizing computer vision that will:

  1. Scan all frames of an Flash/HTML5 video for people's faces
  2. Identify the video frames that shows the faces looking directly at the camera
  3. Crop the face in a perfect square
  4. Copy the cropped face to a .PNG file

Any recommendations for a Python computer vision library that could help me develop this script?

2条回答
对你真心纯属浪费
2楼-- · 2019-04-13 01:42

OpenCV is probably the best option for your specific use case: http://opencv.willowgarage.com/wiki/

It has some support built in for standard face recognition algorithms, and it's pretty easy to get up and running with in Python. However, although it's a pretty deep library, I'm pretty sure you'll have to find something else to first grab the images from Flash and feed it to your utility. I'm not sure about cropping either, but for that kind of thing I'm sure the Python Imaging Library will work if OpenCV doesn't do it.

Hope this helps.

查看更多
地球回转人心会变
3楼-- · 2019-04-13 01:47

As jonesy said opencv is your best bet for facedetection "out of the box".

To use flash video as imput you'd need something that will allow you to read .flv (flash video) files that you can connect to opencv. I haven't tried this myself, but I think if you install opencv with ffmpeg support (if you're on linux) you should be able to read most any video with opencv including .flv (or any html5 video format).

For cropping this explains what you want. For saving the cropped image as png check the documentation of imwrite.

查看更多
登录 后发表回答