17 lines
360 B
Python
17 lines
360 B
Python
|
import cv2 as cv
|
||
|
import numpy as np
|
||
|
|
||
|
from main import img_size as size
|
||
|
|
||
|
|
||
|
def image_transform(image):
|
||
|
image = cv.resize(image, (size[0], size[1]))
|
||
|
return image[:, :, ::-1]
|
||
|
|
||
|
|
||
|
def get_image_as_array(image_name):
|
||
|
image = cv.imread(image_name)
|
||
|
image: np.ndarray # приведение типов
|
||
|
image = image_transform(image)
|
||
|
return image
|