16 lines
531 B
Python
16 lines
531 B
Python
""" UPDATE GRID """
|
|
import cv2
|
|
import os
|
|
|
|
# Path image : chemin vers la grille d'images de célébrités
|
|
# Output image : chemin vers la grille avec l'image cachée
|
|
# x,y : coordonées (x,y) de la sortie yolo (qui correspond au centre de l'image)
|
|
|
|
def hide_image(path_img, output_img, x, y):
|
|
img = cv2.imread(path_img)
|
|
x1 = int((x-0.1)*890)
|
|
y1 = int((y-0.1)*1090)
|
|
x2 = int((x+0.1)*890)
|
|
y2 = int((y+0.1)*1090)
|
|
cv2.rectangle(img, ( x1 , y1), ( x2, y2), (255, 255, 255), -1)
|
|
cv2.imwrite(output_img, img)
|