danielballan / photomosaic

Assemble thumbnail-sized images from a large collection into a tiling which, viewed at a distance, gives the impression of one large photo.
http://danielballan.github.io/photomosaic/docs/
BSD 3-Clause "New" or "Revised" License
57 stars 13 forks source link

TypeError: slice indices must be integers or None or have an __index__ method #31

Open sugizo opened 10 months ago

sugizo commented 10 months ago

env google colab

code

!wget -c 'https://i.ytimg.com/vi/vEYsdh6uiS4/maxresdefault.jpg'
pip install -U photomosaic matplotlib 
import photomosaic as pm
from skimage.io import imread
ori_img = 'maxresdefault.jpg'
image = imread(ori_img)
# Generate a collection of solid-color square images.
pm.rainbow_of_squares('pool/')
# Analyze the collection (the "pool") of images.
pool = pm.make_pool('pool/*.png')
# Create a mosiac with 30x30 tiles.
mos = pm.basic_mosaic(image, pool, (30, 30) )

result

TypeError                                 Traceback (most recent call last)
[<ipython-input-17-dd6b70f8768a>](https://localhost:8080/#) in <cell line: 2>()
      1 # Create a mosiac with 30x30 tiles.
----> 2 mos = pm.basic_mosaic(image, pool, (30, 30) )

3 frames
[/usr/local/lib/python3.10/dist-packages/skimage/util/arraycrop.py](https://localhost:8080/#) in crop(ar, crop_width, copy, order)
     70         cropped = np.array(ar[slices], order=order, copy=True)
     71     else:
---> 72         cropped = ar[slices]
     73     return cropped

TypeError: slice indices must be integers or None or have an __index__ method

best regards