--- title: Photo keywords: fastai sidebar: home_sidebar nb_path: "nbs/data.photo.ipynb" ---
{% raw %}
{% endraw %} {% raw %}
{% endraw %} {% raw %}
{% endraw %} {% raw %}
{% endraw %} {% raw %}

show_images[source]

show_images(images, cols=3, titles=None)

{% endraw %} {% raw %}

get_size[source]

get_size(img, maxsize)

{% endraw %} {% raw %}

resize[source]

resize(img, maxsize)

{% endraw %} {% raw %}

get_height_width_channels[source]

get_height_width_channels(img)

{% endraw %} {% raw %}
{% endraw %} {% raw %}

class Photo[source]

Photo(caption:str=None, exifData:str=None, name:str=None, changelog:list=None, label:list=None, thumbnail:list=None, **kwargs) :: MediaObject

Item is the baseclass for all of the data classes.

{% endraw %} {% raw %}
{% endraw %} {% raw %}
# class IPhoto(Photo):
#     properties = Item.properties + [
#         "service",
#         "identifier",
#         "secret",
#         "code",
#         "handle",
#         "refreshToken",
#         "errorMessage",
#         "accessToken",
#         "displayName"
#     ]
#     edges = Item.edges + ['belongsTo', 'contact']

#     def __init__(self, data=None, embedding=None,path=None, encoding=None, *args, **kwargs):
#         self.private = ["data", "embedding", "path"]
#         super().__init__(*args, **kwargs)
#         self.data=data
#         self.embedding=embedding
#         self.path=path
#         self.encoding=encoding

#     def draw_boxes(self, boxes):
#         print(f"Plotting {len(boxes)} face boundingboxes")
#         fig,ax = plt.subplots(1)
#         fig.set_figheight(15)
#         fig.set_figwidth(15)
#         ax.axis('off')

#         # Display the image
#         ax.imshow(self.data[:,:,::-1])

#         ps = []
#         # Create a Rectangle patch
#         for b in boxes:
#             rect = self.box_to_rect(b)
#             ax.add_patch(rect)
#             ps.append(rect)
#         fig.set_size_inches((6,6))
#         plt.show()

#     def get_crop(self, box, landmark=None):
#         b = [max(0, int(x)) for x in box]
#         if landmark is not None:
#             return face_align.norm_crop(self.data, landmark=landmark)
#         else:
#             return self.data[b[1]:b[3], b[0]:b[2], :]

#     def get_crops(self, boxes, landmarks=None):
#         crops = []
#         if landmarks is None:
#             print("you are getting unnormalized crops, which are lower quality for recognition")
#         for i, b in enumerate(boxes):
#             crop = self.get_crop(b, landmarks[i] if landmarks is not None else None)
#             crops.append(crop)
#         return crops

#     def plot_crops(self, boxes, landmarks=None):
#         crops = self.get_crops(boxes, landmarks)
#         show_images(crops, cols=3)

#     @staticmethod
#     def box_to_rect(box):
#         x = box[0]
#         y = box[1]
#         w = box[2]-box[0]
#         h = box[3]-box[1]
#         return patches.Rectangle((x,y),w,h, linewidth=2,edgecolor='r',facecolor='none')
{% endraw %}