I am trying to make a panorama and as there is a general method of finding transformation b/w two images and then doing warpPerspective to transorm in co-ordinates of previous image. H1 is 3x3 homoraphy matrix image1Frame = H1*image2Frame
(image2Frame = [x2, y2, 1],image1Frame = [x1, y1, 1] considering this we need to devide H1*image2Frame[:2]/H1*image2Frame[2])
From this methodology I was trying to transform several image in my 1st image co-ordinates and to determine homography matrices I used linear transform. image1Frame = H1*H2*image3Frame given:- image2Frame = H2*image3Frame
after doing this task for all my images I transformed co-ordinates (x, y) (i.e the pixel co-ordinates) and got the range of (x,y) co-ordinates and then set the finalImageShape = (max of y-min of y, max of x - min of x). Using here -ve sign for min of x and y because I got them -ve.
and set a translation matrix for translating -ve image co-ordinates so that I may get whole panorama but even then I get most of my image blank and also some part of my base image (image1) also gets cut out even though I set it's H matrix np.eye(3) .
My code for making panorama:-
`
imgBase = np.zeros((dsize[0], dsize[1], 3), dtype='uint8')
for i in finalData[1:]:
# i = [index of image, H]
# H = multiplication of corrsponding H as describes above
img = cv2.warpPerspective(Data['DataCV'][i[0]], i[1]@shiftMat,(dsize[1],dsize[0]))
print(img.shape)
imgBase = cv2.addWeighted(img, 5, imgBase, 0.5, 1)
cv2.imshow('img',imgBase)
cv2.waitKey()
cv2.destroyAllWindows()
`
Here are some code lines from opencv docs which i am using with some changes.
H, mask = cv2.findHomography(imgAccRejPts, imgBasePts, cv2.RANSAC)
please help me and also suggest any other technique as I am just using Bitwise operations of opencv to achive it.
Thank You,