MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / _tile2pixel_indices

Function _tile2pixel_indices

diffusers/examples/community/mixture_tiling.py:51–64  ·  view source on GitHub ↗

Given a tile row and column numbers returns the range of pixels affected by that tiles in the overall image Returns a tuple with: - Starting coordinates of rows in pixel space - Ending coordinates of rows in pixel space - Starting coordinates of columns in pixel space

(tile_row, tile_col, tile_width, tile_height, tile_row_overlap, tile_col_overlap)

Source from the content-addressed store, hash-verified

49
50
51def _tile2pixel_indices(tile_row, tile_col, tile_width, tile_height, tile_row_overlap, tile_col_overlap):
52 """Given a tile row and column numbers returns the range of pixels affected by that tiles in the overall image
53
54 Returns a tuple with:
55 - Starting coordinates of rows in pixel space
56 - Ending coordinates of rows in pixel space
57 - Starting coordinates of columns in pixel space
58 - Ending coordinates of columns in pixel space
59 """
60 px_row_init = 0 if tile_row == 0 else tile_row * (tile_height - tile_row_overlap)
61 px_row_end = px_row_init + tile_height
62 px_col_init = 0 if tile_col == 0 else tile_col * (tile_width - tile_col_overlap)
63 px_col_end = px_col_init + tile_width
64 return px_row_init, px_row_end, px_col_init, px_col_end
65
66
67def _pixel2latent_indices(px_row_init, px_row_end, px_col_init, px_col_end):

Callers 1

_tile2latent_indicesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected