Cylindrical Projection OpenCV

Hi, I’m currently working on a project trying to stitch 2 video inputs together to form a wide view covering 180 degrees. An alternative to stitching, which I assume would take a lot of processing power for real time stitching, could be cylindrical projection of the images. Currently, I have two cameras set up next to each other, and concatinating them into 1 window using OpenCV.

I’m showing 2 camera inputs using the code below. It runs fine, but straight lines that transition from one image to the next become ‘bent’. I was wondering if some sort of projection would make the two images look nicer. Best example I could fine:


Any ideas how to achieve the above? Any help appriciated!

import cv2
import numpy as np



cap1 = cv2.VideoCapture("v4l2src device=/dev/video0 ! video/x-raw, format=BGRx, width=2064, height=1544 ! videoconvert ! video/x-raw, format=BGR ! appsink")
cap2 = cv2.VideoCapture("v4l2src device=/dev/video1 ! video/x-raw, format=BGRx, width=2064, height=1544 ! videoconvert ! video/x-raw, format=BGR ! appsink")


while True:
    _, frame1 = cap1.read()
    _, frame2 = cap2.read()

    frame1 = cv2.resize(frame1, (720,520))
    frame2 = cv2.resize(frame2, (720,520))

    
    sbs = cv2.hconcat([frame2, frame1])
    cv2.imshow('sbs', sbs)

    if cv2.waitKey(1) == ord('q'):
        break

sbs.release() 
cv2.destroyAllWindows()