Lines Matching refs:mask

30 def _GetDifferenceWithMask(image1, image2, mask=None,
37 account a mask if it is provided. The final three arguments represent
43 mask: an optional mask image consisting of only black and white pixels
56 Exception: if image1, image2, and mask are not the same size.
58 image_mask = mask
59 if not mask:
62 raise Exception('images and mask must be the same size.')
82 """Computes a mask for a set of images.
84 Returns a difference mask that is computed from the images
85 which are passed in. The mask will have a white pixel
90 images: list of images to compute the mask from.
101 raise Exception('mask must be created from one or more images.')
102 mask = Image.new('RGBA', images[0].size, (0, 0, 0, 255))
105 mask = _GetDifferenceWithMask(
108 mask,
112 return mask
116 """Combines a list of mask images into one mask image.
119 masks: a list of mask-images.
122 a new mask that represents the sum of the masked
123 regions of the passed in list of mask-images.
134 masks_data = [mask.getdata() for mask in masks]
148 a new mask image where everything that was masked or different in the diff
159 def VisualizeImageDifferences(image1, image2, mask=None):
163 mask. If the pixel values are the same, or the pixel is masked,
171 mask: an optional RGB image consisting of only white and black pixels
180 Exception: if the two images and optional mask are different sizes.
182 return _GetDifferenceWithMask(image1, image2, mask)
186 """A function that adds layers of pixels around the white edges of a mask.
190 only the pixels' indices which were added to the mask by inflation
196 image: the RGBA PIL.Image mask to inflate.
239 def TotalDifferentPixels(image1, image2, mask=None):
245 mask: an optional RGB image of only black and white pixels
252 Exception: if the images to be compared and the mask are not the same size.
254 image_mask = mask
255 if not mask:
270 raise Exception('images and mask must be the same size')
273 def SameImage(image1, image2, mask=None):
284 mask: an optional image of only black and white pixels
291 Exception: if the images (and mask) are different sizes.
293 different_pixels = TotalDifferentPixels(image1, image2, mask)