Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on search_image #153

Open
moshaver71 opened this issue Feb 17, 2022 · 3 comments
Open

Error on search_image #153

moshaver71 opened this issue Feb 17, 2022 · 3 comments

Comments

@moshaver71
Copy link

Hi
I want to use search image method. but i get the below error.
Can you please help me?

Traceback (most recent call last):
  File "/var/www/html/Panel/test2.py", line 16, in <module>
    ses.search_image('https://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Mona_Lisa,_by_Leonardo_da_Vinci,_from_C2RMF_retouched.jpg/687px-Mona_Lisa,_by_Leonardo_da_Vinci,_from_C2RMF_retouched.jpg')
  File "/usr/local/lib/python3.10/site-packages/image_match/signature_database_base.py", line 268, in search_image
    transformed_record = make_record(img, self.gis, self.k, self.N)
  File "/usr/local/lib/python3.10/site-packages/image_match/signature_database_base.py", line 356, in make_record
    signature = gis.generate_signature(path)
  File "/usr/local/lib/python3.10/site-packages/image_match/goldberg.py", line 161, in generate_signature
    im_array = self.preprocess_image(path_or_image, handle_mpo=self.handle_mpo, bytestream=bytestream)
  File "/usr/local/lib/python3.10/site-packages/image_match/goldberg.py", line 257, in preprocess_image
    return rgb2gray(image_or_path)
  File "/usr/local/lib/python3.10/site-packages/skimage/_shared/utils.py", line 394, in fixed_func
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/skimage/color/colorconv.py", line 875, in rgb2gray
    rgb = _prepare_colorarray(rgb)
  File "/usr/local/lib/python3.10/site-packages/skimage/color/colorconv.py", line 140, in _prepare_colorarray
    raise ValueError(msg)
ValueError: the input array must have size 3 along `channel_axis`, got (1024, 687)
@moshaver71
Copy link
Author

I solved my problem.
You should make the below change on signature_database_base.py.
replace transformed_record = make_record(img, self.gis, self.k, self.N) with transformed_record = make_record(path, self.gis, self.k, self.N) on line 267

@selected-pixel-jameson
Copy link

Hi I'm having this issue as well.

You are referencing line 267 but in the master branch the code that you are referencing is located on line 273.

https://github.com/ProvenanceLabs/image-match/blob/master/image_match/signature_database_base.py#L267

Do you have the master branch?

@selected-pixel-jameson
Copy link

Are you actually getting accurate results back after changing that line?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants