You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When passing any scale parameter into draw_mosaic that isn't 1, a ValueError occurs:
Traceback (most recent call last):
File ".\main.py", line 73, in <module>
mos = pm.draw_mosaic(canvas, tiles, matches, resized_copy_cache=cache, scale=i)
File "E:\projects\t.page\venv\lib\site-packages\photomosaic\photomosaic.py", line 494, in draw_mosaic
image[tile] = sized_match_image
ValueError: could not broadcast input array from shape (8,16,3) into shape (8,0,3)
Here's the code snippet that produced this error, I borrowed most of it from the contents of basic_mosaic:
GRID_DIMS= (180, 120)
DEPTH=1SCALE=2image=imread('source2.jpg') # load target imagepool=pm.make_pool('tiles/*') # load tiles# Size the image to be evenly divisible by the tiles.image=img_as_float(image)
image=pm.rescale_commensurate(image, GRID_DIMS, DEPTH)
# Use perceptually uniform colorspace for all analysis.converted_img=pm.perceptual(image)
# Partition the image into tiles and characterize each one's color.tiles=pm.partition(converted_img, grid_dims=GRID_DIMS, depth=DEPTH)
tile_colors= [np.mean(converted_img[tile].reshape(-1, 3), 0)
fortileintqdm(tiles, desc='analyzing tiles')]
# Match a pool image to each tile.match=pm.simple_matcher(pool)
matches= [match(tc) fortcintqdm(tile_colors, desc='matching')]
# Draw the mosaic.canvas=np.ones_like(image) # white canvas same shape as input imagecache= {}
mos=pm.draw_mosaic(canvas, tiles, matches, resized_copy_cache=cache, scale=SCALE)
imsave("mosaic.png", mos)
I'm using photomosaic==0.3.1 and numpy==1.19.5.
The text was updated successfully, but these errors were encountered:
When passing any
scale
parameter intodraw_mosaic
that isn't1
, a ValueError occurs:Here's the code snippet that produced this error, I borrowed most of it from the contents of
basic_mosaic
:I'm using
photomosaic==0.3.1
andnumpy==1.19.5
.The text was updated successfully, but these errors were encountered: