1
0
mirror of https://github.com/0O0o0oOoO00/Alas.git synced 2026-05-14 14:59:25 +08:00
Files
Alas/module/base/mask.py

18 lines
364 B
Python
Raw Normal View History

import cv2
import numpy as np
from PIL import Image
from module.base.template import Template
class Mask(Template):
@property
def image(self):
if self._image is None:
self._image = np.array(Image.open(self.file).convert('L'))
return self._image
def apply(self, image):
return cv2.bitwise_and(image, self.image)