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

einsum ValueError #19

Closed Jip-Hop closed 5 years ago

Jip-Hop commented 6 years ago

I was hoping to give this a spin on Ubuntu 16.04 running in VirtualBox. I installed photomosaic via pip3 install photomosaic.

The code I've tried is from the tutorial in the documentation:

from skimage.io import imread
image = imread('source/Schermafbeelding 2017-03-10 om 16.30.25.png')

import photomosaic as pm

# Analyze the collection (the "pool") of images.
pool = pm.make_pool('medium/*.jpg')

# Create a mosiac with 30x30 tiles.
mos = pm.basic_mosaic(image, pool, (30, 30))

from skimage.io import imsave
imsave('mosaic.png', mos)

This is the error I get:

analyzing pool: 100%|█████████████████████████████████████████████████████████████████████████████████████████████| 7024/7024 [00:33<00:00, 208.13it/s]
/home/jip/.local/lib/python3.5/site-packages/skimage/transform/_warps.py:84: UserWarning: The default mode, 'constant', will be changed to 'reflect' in skimage 0.15.
  warn("The default mode, 'constant', will be changed to 'reflect' in "
Traceback (most recent call last):
  File "make.py", line 10, in <module>
    mos = pm.basic_mosaic(image, pool, (30, 30))
  File "/home/jip/.local/lib/python3.5/site-packages/photomosaic/photomosaic.py", line 107, in basic_mosaic
    converted_img = perceptual(image)
  File "/home/jip/.local/lib/python3.5/site-packages/photomosaic/photomosaic.py", line 139, in perceptual
    options['perceptual'])
  File "/home/jip/.local/lib/python3.5/site-packages/colorspacious/conversion.py", line 232, in cspace_convert
    return converter(arr)
  File "/home/jip/.local/lib/python3.5/site-packages/colorspacious/transform_graph.py", line 581, in __call__
    x = transform(x, **kwargs)
  File "/home/jip/.local/lib/python3.5/site-packages/colorspacious/basics.py", line 70, in sRGB1_linear_to_XYZ100
    XYZ100 = np.einsum("...ij,...j->...i", sRGB1_to_XYZ100_matrix, sRGB1_linear)
  File "/home/jip/.local/lib/python3.5/site-packages/numpy/core/einsumfunc.py", line 1087, in einsum
    einsum_call=True)
  File "/home/jip/.local/lib/python3.5/site-packages/numpy/core/einsumfunc.py", line 710, in einsum_path
    "not match previous terms.", char, tnum)
ValueError: ("Size of label '%s' for operand %d does not match previous terms.", 'j', 1)
danielballan commented 5 years ago

Hi @Jip-Hop. I'm about 18 months late---still interested in this?

Jip-Hop commented 5 years ago

Hey, no worries! I'm not using photomosaic at the moment, but might use it again in the future :) probably on MacOS because I got it working there last time.

Edit: whoops I mixed things up. I don't think I ever got this one working!

danielballan commented 5 years ago

I suspect there was something unusual about one or more of the images in the pool, which caused the color conversion to fail. It's probably something we can fix on our side if we have an example image that reproduces the problem. If you ever circle back to it, chime in. :-)

Jip-Hop commented 5 years ago

Thanks! Will let you know if I do :)

Op 21 jun. 2019 om 19:55 heeft Dan Allan notifications@github.com het volgende geschreven:

Closed #19.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.