giles200619 / aerial-image-stitching

A simple implementation that stitches images from UAV view into a map.
7 stars 2 forks source link

Hi, how to run this code, #1

Open li1997522 opened 2 years ago

li1997522 commented 2 years ago

But always remind me of program errors.

`_Traceback (most recent call last): File "D:/CHENGXU/aerial-image-stitching-master/aerial-image-stitching-master/image_stitching.py", line 203, in result = stitch(result,cv2.imread(img_list[i],cv2.IMREAD_GRAYSCALE))
File "D:/CHENGXU/aerial-image-stitching-master/aerial-image-stitching-master/image_stitching.py", line 179, in stitch H = align_image_using_feature(x1, x2, 5, 5000)
File "D:/CHENGXU/aerial-image-stitching-master/aerial-image-stitching-master/image_stitching.py", line 68, in align_image_using_feature H = np.linalg.inv(np.matmul(A.transpose(), A)) File "<__array_function__ internals>", line 6, in inv File "D:\ProgramData\Anaconda3\envs\python36\lib\site-packages\numpy\linalg\linalg.py", line 546, in inv ainv = _umath_linalg.inv(a, signature=signature, extobj=extobj) File "D:\ProgramData\Anaconda3\envs\python36\lib\site-packages\numpy\linalg\linalg.py", line 88, in _raise_linalgerror_singular raise LinAlgError("Singular matrix") numpy.linalg.LinAlgError: Singular matrix

Process finished with exit code 1_`

how to run it?

giles200619 commented 2 years ago

Hi, It says singular matrix while trying to calculate the inverse. You could try replacing H = np.linalg.inv(np.matmul(A.transpose(), A)) with H = np.linalg.pinv(np.matmul(A.transpose(), A)). But I would recommend using another image set to test the code first, or try playing around with the SIFT parameters.