I have found a homography matrix successfully that finds the difference between frames of a video for stabilization. I am using the warpperspective function to warp each frame, but the top and left portions are cut off. I think this is because the pixels would go to a negative location in the image, but I am not sure how to fix this without affecting the stabilization.
In the code below I make the image twice the size and move it to the centre so that it has room to move without being cut off. This works fine for the bottom and right sides.
Is there a way to keep the entire image?
frame = cv2.warpPerspective(frame, m, (320*2, 240*2)) dst = dst = np.float32([[1,0,160],[0,1,120]]) frame = cv2.warpAffine(frame,dst,(320*2,240*2))
The input frame looks like this:
The output frame looks like this:
A lot of the table on the left is cut off and I am wondering how to get this part to show up. Thanks