ageitgey / ageitgey/face_recognition

how to load opencv object to face_recognition. load_image_file() api does not work for this.

Open
#441 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
56.8k
Forks
13.7k
PR merge metrics
No merged PRs in 30d

Description

  • face_recognition version:
    face-recognition==1.0.0
    face-recognition-models==0.3.0

  • Python version: 3.6.3

  • Operating System: 10.13.1 MacOS High Sierra

Description

I would like to load an opencv image object into face_recognition library.
I am using Django Python, I have used opencv to crop and do some face quality checks.

Here is what something I did:

im_cv = cv2.imread(im_path)
result, checked_cv_image = process(im_cv)

unknown_image = face_recognition.load_image_file(checked_cv_image) <-- this doesnt work

it complaints:
AttributeError: 'numpy.ndarray' object has no attribute 'read'

What I Did
unknown_image = face_recognition.load_image_file(checked_cv_image) <-- this doesnt work, checked_cv_image is an opencv object

I would like to know is it possible to figure a way how to load an opencv object into face_recognition object.

Thanks, really appreciate there is a way for this.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure at face_recognition.load_image_file(checked_cv_image) using the reported Python, face-recognition, and macOS versions. Trace the load_image_file entry point and determine the expected handling of the numpy.ndarray returned by cv2.imread and process; done should be a clearly defined supported behavior or documented limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
opencv, python
Domain
api, computer-vision
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.