| import cv2 | |
| class ImageReader: | |
| """ | |
| A flexible and more optimzed image reader against opencv image reader. | |
| """ | |
| def __init__(self, image_path): | |
| self._image_path = image_path | |
| # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| def read(self): | |
| "Reads a frame from photo file - the frame is in BGR format" | |
| frame = cv2.imread(self._image_path) | |
| # frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) | |