Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # # # # WORKS GOOD # # # #
- # make a mask
- # create a mask
- mask = self.make_mask(homography) # a greyscale image
- mask = cv2.resize(mask,
- (self.net_input_size[0] / downsample_factor,
- self.net_input_size[1] / downsample_factor))
- self.show(mask)
- _, mask = cv2.threshold(mask, 0, 255, cv2.THRESH_BINARY)
- # make the corresponding notmask
- self.show(mask)
- notmask = cv2.bitwise_not(mask)
- self.show(notmask)
- # scale pixel values to range [0,1]
- mask /= 255
- notmask /= 255
- # put in batch
- masks = np.zeros((self.net_input_size[1]/downsample_factor, self.net_input_size[0]/downsample_factor, 2))
- masks[:,:,0] = mask
- masks[:,:,1] = notmask
- # # # # DOESN'T WORK GOOD # # # #
- # make an outline mask
- outline_mask = self.make_outline_mask(homography) # a greyscale image
- outline_mask = cv2.resize(outline_mask,
- (self.net_input_size[0] / downsample_factor,
- self.net_input_size[1] / downsample_factor))
- self.show(outline_mask)
- _, outline_mask = cv2.threshold(outline_mask, 0, 255, cv2.THRESH_BINARY)
- self.show(outline_mask)
- # make the corresponding notmask
- not_outline_mask = cv2.bitwise_not(outline_mask)
- self.show(not_outline_mask)
- # scale pixel values to range [0,1]
- outline_mask /= 255
- not_outline_mask /= 255
- # put in batch
- outline_masks = np.zeros((self.net_input_size[1]/downsample_factor, self.net_input_size[0]/downsample_factor, 2))
- outline_masks[:,:,0] = outline_mask
- outline_masks[:,:,1] = not_outline_mask
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement