Closed MercurySe7en closed 1 year ago
How strange. Can you please share your tiles so I can take a closer look?
It's quite a large file, so peeled off 4 rows near the top (see zip file). Issue still manifests the same.
Note that the problem row applies to the files starting with "0100_ .jpg" which is actually the 101st column since the first column is "0000" not "0001".
Thanks for looking at it. Smaller version of expected final result is picture below.
I found the problem. When drawing a mosaic based purely on row/column (i.e., where there is no overlap between tiles and the user doesn't run the align method), the script expects all the tiles to have the same dimensions and places them by multiplying the column index by the tile width and row index by tile height. Since your last column is smaller than the rest, this results in a bad placement.
I'll fix this in the package, but in the meantime you can manually assign tile coordinates as follows:
from stitch2d import StructuredMosaic
mosaic = StructuredMosaic(
"tiles",
dim=4,
origin="upper left",
direction="vertical",
pattern="raster"
)
y = 0
for row in mosaic.grid:
x = 0
for tile in row:
tile.x = x + tile.width
tile.y = y + tile.height
x += tile.width
y += tile.height
mosaic.save("mosaic.jpg")
Note that this approach still expects all tiles in each column to have the same width and all tiles in each row to have the same height (so width/height can vary as long as each column/row is internally consistent).
Please let me know if that solves it for you.
Works PERFECTLY now with the extra few lines of code!
I found your program specifically for this project, but I'm excited to use it for other projects in the future.
Thanks.
Fixed in 09586c6d7805a8dfc7c126ec9fd6d9e7fa562519
When creating a structured mosaic, the output omits the 101st column of tiles, replacing it with the final column (in my case the 123rd column). Columns 102 through 122 are placed correctly. My file numbering appears to be correct for both alpha and numeric sorting. The fact that is occurs on the 101st & final column leads me to believe it is an arbitrary limit applied in a while loop which is only being ignored for one cycle ("while count <= 100") then picks up again.![Capture](https://user-images.githubusercontent.com/115804082/195873651-a74c0859-4f03-4a37-b8b7-7d6643e43d71.PNG)