beacon_aug/external/textflow/synthesis.py
def _set_image(self, img):
        """
        set the image to place text on
        :param img: array or str (file dir)
        """
        assert isinstance(img, (np.ndarray, str))
        if isinstance(img, np.ndarray):
            assert img.ndim == 3  # RGB
            self.image = img
        elif isinstance(img, str):
            self.image = cv2.imread(img, cv2.IMREAD_COLOR)
            if self.image is None:
                raise Exception('''Failed reading the image file "%s"''' % img)
            self.image = cv2.cvtColor(self.image, cv2.COLOR_BGR2RGB)
            self.image_path = img

        self.image = self.image.astype(np.uint8)
        self.text_mask = np.zeros(self.image.shape[:2])

        set the image to place text on
        :param img: array or str (file dir)
        
set the image to place text on
set the image to place text on
def _set_image(self, img):
        assert isinstance(img, (np.ndarray, str))
        if isinstance(img, np.ndarray):
            assert img.ndim == 3  
            self.image = img
        elif isinstance(img, str):
            self.image = cv2.imread(img, cv2.IMREAD_COLOR)
            if self.image is None:
                raise Exception('''Failed reading the image file "%s"''' % img)
            self.image = cv2.cvtColor(self.image, cv2.COLOR_BGR2RGB)
            self.image_path = img
        self.image = self.image.astype(np.uint8)
        self.text_mask = np.zeros(self.image.shape[:2])
def _set_image ( self , img ) : assert isinstance ( img , ( np . ndarray , str ) ) if isinstance ( img , np . ndarray ) : assert img . ndim == 3 self . image = img elif isinstance ( img , str ) : self . image = cv2 . imread ( img , cv2 . IMREAD_COLOR ) if self . image is None : raise Exception ( '''Failed reading the image file "%s"''' % img ) self . image = cv2 . cvtColor ( self . image , cv2 . COLOR_BGR2RGB ) self . image_path = img self . image = self . image . astype ( np . uint8 ) self . text_mask = np . zeros ( self . image . shape [ : 2 ] )
set the image to place text on
set the image to place text on
"""
        set the image to place text on
        :param img: array or str (file dir)
        """ # RGB
self
img
array or str (file dir)
array or str ( file dir )