0

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:

Cylindrical Projection

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()
Aleks-CST
  • 3
  • 4
  • This probably depends on the camera objectives and how the cameras are placed. Please provide at least two example frames and a little bit more information on your camera hardware! – Markus Jul 26 '22 at 15:13
  • Hope this picutre clarifies my issue: https://im.ge/i/F0gSaJ At the moment, I have two 90 degree angle cameras set up next to each other. And I mechanically set them up to cover approximately 180 degrees. But as you can see, the middle of the concatinated image produces some weird angles. I figured a cylindrical projection would fix this. – Aleks-CST Jul 27 '22 at 10:00
  • I think you are looking for something like [cube mapping](https://en.wikipedia.org/wiki/Cube_mapping). You can try to simply project the two images on two "orthogonal" planes in 3d space. – Markus Jul 30 '22 at 13:53

0 Answers0