mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Add unit tests for calc_tiles_with_overlap(...) and fix a bug in its implementation.
This commit is contained in:
@ -10,11 +10,22 @@ class TBLR(BaseModel):
|
||||
left: int
|
||||
right: int
|
||||
|
||||
def __eq__(self, other):
|
||||
return (
|
||||
self.top == other.top
|
||||
and self.bottom == other.bottom
|
||||
and self.left == other.left
|
||||
and self.right == other.right
|
||||
)
|
||||
|
||||
|
||||
class Tile(BaseModel):
|
||||
coords: TBLR = Field(description="The coordinates of this tile relative to its parent image.")
|
||||
overlap: TBLR = Field(description="The amount of overlap with adjacent tiles on each side of this tile.")
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.coords == other.coords and self.overlap == other.overlap
|
||||
|
||||
|
||||
def paste(dst_image: np.ndarray, src_image: np.ndarray, box: TBLR, mask: Optional[np.ndarray] = None):
|
||||
"""Paste a source image into a destination image.
|
||||
|
Reference in New Issue
Block a user