File size: 492 Bytes
a103028
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

import cv2

class ImageWriter:
    """
    A flexible and more optimzed image writer against opencv image writer.
    """
    def __init__(self, image_path):

        self._image_path = image_path

    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def write(self, frame):
        "Writes a frame onto photo file - the frame needs to be in BGR format"
        
        cv2.imwrite(self._image_path, frame)