Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Panoramic camera calibration without chessboard method

$
0
0

I have an image of a panoramic video camera (dual lens) in which there is a visible distortion. As the camera it's in a fixed position, and without any zoom or any other movement, and I have a lot of real world points from the soccer pitch witch is recording(and known distances, for example from google maps), as far as I understood... from the cameraCalibrate method... it could be possible to achieve the camera distortion parameters?

calibrateCamera() from Camera Calibration and 3D Reconstruction

video

map_2d

what I did in python:

    image = cv2.imread("./data/video.jpg")    h, w = image.shape[:2]    image_2d = [[20, 14, 0], [20, 768, 0], [1190, 18, 0], [1190, 773, 0], [604, 14, 0], [603, 390, 0], [603, 769, 0], [141, 390, 0], [1067, 395, 0]] #[LEFT_CORNER_TOP, LEFT_CORNER_BOTTOM, RIGHT_CORNER_TOP, RIGHT_CORNER_BOTTOM, CENTER_TOP, CENTER_CENTER,                CENTER_BOTTOM, LEFT_PENALTY, RIGHT_PENALTY]    video_pos = [[1450, 490], [305, 687], [3270, 599], [4396, 894], [2358, 524], [2346, 602], [2272, 1116], [1226, 558], [3482, 690]] #[VIDEO_LEFT_CORNER_TOP, VIDEO_LEFT_CORNER_BOTTOM, VIDEO_RIGHT_CORNER_TOP, VIDEO_RIGHT_CORNER_BOTTOM,                 VIDEO_CENTER_TOP, VIDEO_CENTER_CENTER, VIDEO_CENTER_BOTTOM, VIDEO_LEFT_PENALTY, VIDEO_RIGHT_PENALTY]    ret, mtx, dist, rvect, tvect = cv2.calibrateCamera(        np.array([image_2d], dtype=np.float32),        np.array([video_pos], dtype=np.float32),        (w, h), None, None)    camera_calibration_dict = {'ret': ret,'mtx': mtx,'dist': dist,'rvecs': rvect,'tvecs': tvect    }new_cameramtx, roi = cv2.getOptimalNewCameraMatrix(mtx, dist, (w, h), 1, (w, h))    dst = cv2.undistort(img, mtx, dist, None, new_cameramtx)    cv2.imwrite('undistort.jpg', dst)

It looks a bit better but still a visible distortion:undistortion


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>