Image-Stitching-OpenCV icon indicating copy to clipboard operation
Image-Stitching-OpenCV copied to clipboard

Value error

Open ceylanbagci opened this issue 5 years ago • 1 comments

Hi; My images can not make mask on this line can you help me please. `--------------------------------------------------------------------------- ValueError Traceback (most recent call last) in 7 if name == 'main': 8 try: ----> 9 main() 10 except IndexError: 11 print ("Please input two source images: ")

in main() 2 img1 = cv2.imread('data/Rainier1.png') 3 img2 = cv2.imread('data/Rainier2.png') ----> 4 final=Image_Stitching().blending(img1,img2) 5 cv2.imwrite('panorama.jpg', final) 6

in blending(self, img1, img2) 53 54 panorama1 = np.zeros((height_panorama, width_panorama, 3)) ---> 55 mask1 = self.create_mask(img1,img2,version='left_image') 56 panorama1[0:img1.shape[0], 0:img1.shape[1], :] = img1 57 panorama1 *= mask1

in create_mask(self, img1, img2, version) 37 mask = np.zeros((height_panorama, width_panorama)) 38 if version== 'left_image': ---> 39 mask[:, barrier - offset:barrier + offset ] = np.tile(np.linspace(1, 0, 2 * offset ).T, (height_panorama, 1)) 40 mask[:, :barrier - offset] = 1 41 else:

ValueError: could not broadcast input array from shape (388,800) into shape (388,0)` Images link: https://drive.google.com/drive/folders/1nyWK45IjSofDFvkWRkJqtYx3Gn1n6QSp?usp=sharing

Thank you then.

ceylanbagci avatar Nov 13 '19 09:11 ceylanbagci

I find set smoothing_window_size=0 or less than 800 is OK, because barrier - offset is <0,the array slice can't get the correct array

Pinnh avatar Apr 20 '21 07:04 Pinnh