ageitgey / ageitgey/face_recognition
Work with the file itself
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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