Fix mask editor bugs

This commit is contained in:
Jeremy Hummel 2019-09-25 23:28:32 -07:00
commit 4499d00979

View file

@ -25,9 +25,9 @@ class MaskEditor:
self.img = imagelib.normalize_channels (img,3) self.img = imagelib.normalize_channels (img,3)
h, w, c = img.shape h, w, c = img.shape
if h != w or w != 256: # if h != w or w != 256:
self.img = cv2.resize(img, (256,256)) # self.img = cv2.resize(img, (256,256))
raise Exception ("MaskEditor does not support image size != 256x256") # raise Exception ("MaskEditor does not support image size != 256x256")
ph, pw = h // 4, w // 4 #pad wh ph, pw = h // 4, w // 4 #pad wh
@ -257,7 +257,7 @@ class MaskEditor:
preview_images += [ np.concatenate (prev_images, axis=1) ] preview_images += [ np.concatenate (prev_images, axis=1) ]
img = np.full ( (prh,prw, sc), (0,0,1), dtype=np.float ) img = np.full ( (prh,prw, sc), (0,0,1), dtype=np.float )
img[border:-border,border:-border] = cv2.resize( self.img, 256 ) img[border:-border,border:-border] = cv2.resize(self.img, (self.prwh - 2*border, self.prwh - 2*border))
preview_images += [ img ] preview_images += [ img ]