Open pjsjongsung opened 3 years ago
Hi.
Do you mean you had same problem in #7 with python 3.8? If so, could you tell me your opencv version ?
Hi! Yes. It still has that height width converted problem. The version is 4.5.1.
@pjsjongsung
I just tried following code with Python3.9/opencv4.5.1 in m1 arm macbook, and checked it works without any error.
Could you tell me more detailed information? (Images you used, the error message and so on...)
# run on /python_package directory
import cv2
import numpy as np
import imregpoc
ref = cv2.imread('imgs/ref.png',0)
cmp = cv2.imread('imgs/cmp.png',0)
res = imregpoc.imregpoc(ref,cmp)
# Show stitched Image
res.stitching()
Maybe it's a problem solely with python 3.8.0? I used an image with size 580 x 912
Traceback (most recent call last):
File "c:\Users\Jong Sung Park\Desktop\collab_king\damaged\new_data\stitch.py", line 203, in <module>
mat_list.append(find_mat(img2, img1))
File "c:\Users\Jong Sung Park\Desktop\collab_king\damaged\new_data\stitch.py", line 63, in find_mat
result = imregpoc.imregpoc(img1, img2)
File "C:\Users\Jong Sung Park\AppData\Roaming\Python\Python38\site-packages\imregpoc.py", line 34, in __init__
self.match()
File "C:\Users\Jong Sung Park\AppData\Roaming\Python\Python38\site-packages\imregpoc.py", line 42, in match
G_a = np.fft.fft2(self.ref*self.hanw)
ValueError: operands could not be broadcast together with shapes (580,912) (912,580)
I don't think running the code you mentioned above is relevant since this issue was from the difference in height and width with the shape of the image
img1 and img2 in my error has the same image size with 580 x 912
The code works in Python 3.7.5, just not in 3.8.0
Hi! The height width converted problem still exists in python 3.10 (win 11). I tried to change the code to "self.hanw = cv2.createHanningWindow((width, height),cv2.CV_64F) --> line 40". The problem is solved after this operation, and the program can successfully run without error. However, the registration matching result doesn't seem to be correct, and result.isSucceed()=0. The code I use is :
import cv2
import numpy as np
import imregpoc
ref = cv2.imread('ref.png',0)
cmp = cv2.imread('cmp.png',0)
result = imregpoc.imregpoc(ref,cmp)
The 'ref.png' and 'cmp.png' are reference images given in your package. BTW the window size problem exists in the MATLAB code too. If you have any idea how to solve this problem, please give me some instructions. Looking forward to your kind reply.
https://github.com/YoshiRi/ImRegPOC/issues/7
This issue is present in python 3.8 but not in older versions. I'm guessing python 3.8 is using an older version of your files.
I understand recommended python version is 3.5, but it would be nice if it worked up to the recent python versions.