mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-18 01:11:20 -05:00
Option to directly invert the grayscale heatmap - fix
This commit is contained in:
committed by
Lincoln Stein
parent
3e7a459990
commit
5e87062cf8
@@ -44,7 +44,7 @@ class SegmentedGrayscale(object):
|
||||
self.image = image
|
||||
|
||||
def to_grayscale(self,invert:bool=False)->Image:
|
||||
return self._rescale(Image.fromarray(np.uint8((255 if invert else 0) - self.heatmap * 255)))
|
||||
return self._rescale(Image.fromarray(np.uint8(255 - self.heatmap * 255 if invert else self.heatmap * 255)))
|
||||
|
||||
def to_mask(self,threshold:float=0.5)->Image:
|
||||
discrete_heatmap = self.heatmap.lt(threshold).int()
|
||||
|
||||
Reference in New Issue
Block a user