An attempt to do a FAQ page

parent 3161603c
Pipeline #49878 passed with stage
in 25 minutes and 35 seconds
.. _bob.bio.face.faq:
===
FAQ
===
How to crop a face ?
====================
The recipe below helps you to set a face cropper based on eye positions.
.. literalinclude:: faq/facecrop.py
.. figure:: ./faq/img/ada_cropped.png
\ No newline at end of file
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.1
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# ## How to crop a face
# +
import bob.bio.face
import bob.io.image
# Loading Ada's images
image = bob.io.image.load("./img/838_ada.jpg")
# Setting Ada's eyes
annotations = dict()
annotations['reye'] = (265, 203)
annotations['leye'] = (278, 294)
# Final cropped size
cropped_image_size = (224, 224)
# Defining where we want the eyes to be located after the crop
cropped_positions = {"leye": (65, 150), "reye": (65, 77)}
face_cropper=bob.bio.face.preprocessor.FaceCrop(
cropped_image_size=cropped_image_size,
cropped_positions=cropped_positions,
color_channel="rgb")
# Crops always a batch of images
cropped_image = face_cropper.transform([image], annotations=[annotations])
# +
# %matplotlib widget
import matplotlib.pyplot as plt
figure = plt.figure()
plt.subplot(121)
bob.io.image.imshow(image)
plt.subplot(122)
bob.io.image.imshow(cropped_image[0].astype("uint8"))
figure.show()
# -
......@@ -51,6 +51,7 @@ Users Guide
leaderboard/leaderboard
references
annotators
faq
Reference Manual
================
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment