rmislam / PythonSIFT

A clean and concise Python implementation of SIFT (Scale-Invariant Feature Transform)
MIT License
929 stars 257 forks source link

About alberto98fx's "Error-input array" #26

Open YangLwBUAA opened 2 years ago

YangLwBUAA commented 2 years ago

I met the same kind of error when the queryImage(212x142) is larger than trainImag(215x133).

Traceback (most recent call last):
  File "D:/Download/PythonSIFT-master/template_matching_demo.py", line 55, in <module>
    newimg[hdif:hdif + h1, :w1, i] = img1
ValueError: could not broadcast input array from shape (142,212) into shape (0,212)

And I exchange the two Image, then it works smoothly. So it seems to be trainImage's size cannot be smaller than queryImage's(Logically, it really should be like this)

Thx for ur share, it helps me a lot!

YangLwBUAA commented 2 years ago

I may make a false conclusion. The size of two Images isn't the cause of this error. Here are my two test Images, and the error is:

Traceback (most recent call last):
  File "D:/Download/PythonSIFT-master/template_matching_demo.py", line 55, in <module>
    newimg[hdif:hdif + h1, :w1, i] = img1
ValueError: could not broadcast input array from shape (1706,1117) into shape (0,1117)

bottle on desk bottle

These two Images were taken separately by iphone. I will follow ur tutorial to learn more about SIFT and the code. Try to see if I can find the reason. I would be very grateful if you can provide help at your convenience.

rmislam commented 2 years ago

Hi @YangLwBUAA, thanks for your interest in this repo! Thanks for posting the images you used. I will look into this and try to get back to you within a few days.