MCPcopy Create free account
hub / github.com/vladmandic/sdnext / create_binary_mask

Function create_binary_mask

modules/processing_helpers.py:134–139  ·  view source on GitHub ↗
(image)

Source from the content-addressed store, hash-verified

132
133
134def create_binary_mask(image):
135 if image.mode == 'RGBA' and image.getextrema()[-1] != (255, 255):
136 image = image.split()[-1].convert("L").point(lambda x: 255 if x > 128 else 0)
137 else:
138 image = image.convert('L')
139 return image
140
141
142def images_tensor_to_samples(image, approximation=None, model=None): # pylint: disable=unused-argument

Callers 1

process_samplesFunction · 0.85

Calls 1

convertMethod · 0.45

Tested by

no test coverage detected