Repository navigation
How to use camera calibration parameters instead of camera parameter estimation process #271
Unanswered
wuhongsheng
asked this question in
Q&A
Replies: 2 comments
|
I have the same question |
0 replies
|
There is no option for this, but import numpy as np
import cv2 as cv
from stitching import Stitcher
class CalibratedStitcher(Stitcher):
def __init__(self, K, rotations, **kwargs):
super().__init__(**kwargs)
self.K, self.rotations = K, rotations
def subset(self, imgs, features, matches):
return imgs, features, matches # keep all images, in input order
def estimate_camera_parameters(self, features, matches):
# cameras are used at the "medium" resolution -> scale the intrinsics
w, h = self.images.sizes[0]
s = min(1.0, np.sqrt(self.medium_megapix * 1e6 / (w * h)))
cams = []
for R in self.rotations:
c = cv.detail.CameraParams()
c.focal = self.K[0, 0] * s
c.aspect = self.K[1, 1] / self.K[0, 0]
c.ppx, c.ppy = self.K[0, 2] * s, self.K[1, 2] * s
c.R = np.asarray(R, dtype=np.float32)
cams.append(c)
return cams
stitcher = CalibratedStitcher(K, rotations, adjuster="no", wave_correct_kind="no")
pano = stitcher.stitch(["img0.jpg", "img1.jpg", "img2.jpg"])Things that matter:
I tested this on three synthetic views (yaw -25/0/25 deg, f=700, 1280x720). The calibrated result matches the feature-estimated panorama, while the transposed rotations give visible ghosting. To check your rig: the panorama from |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
How to use camera calibration parameters instead of camera parameter estimation process
All reactions