ageitgey / ageitgey/face_recognition

Work with the file itself

Open
#583 0 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: 1.2.2
  • Python version: 3.6.6
  • Operating System: Widows 10
Description

Add, please, the following lines of code. Because not all files are opened from the server, the library must work with the file itself.
Best Regards, Armat.

What I Did

Add, please, line of code to def load_image_file(file, mode='RGB'):
import six
def load_image_file(file, mode='RGB'):
"""
Loads an image file (.jpg, .png, etc) into a numpy array

:param file: image file name or file object to load
:param mode: format to convert the image to. Only 'RGB' (8-bit RGB, 3 channels) and 'L' (black and white) are supported.
:return: image contents as numpy array
"""
**im = PIL.Image.open(file) if isinstance(file, six.string_types) else file**
if mode:
    im = im.convert(mode)
return np.array(im)

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 at the load_image_file(file, mode='RGB') entry point shown in the issue and inspect how it currently opens image paths. Check the existing image-loading behavior for both paths and file objects, then verify that RGB and grayscale conversion still work; done means file objects are accepted without breaking path-based loading.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.