美文网首页
导出RealityCapture相机参数

导出RealityCapture相机参数

作者: Reyuwei | 来源:发表于2020-03-29 14:41 被阅读0次
  1. 在 reality capture根目录下calibration.xml文件中添加
 <format mask="*.lst" desc="CmpMvs _KRT matrices" writer="cvs" undistortImages="0" undistortPrincipal="0">
    <hint type="continue" strId="8351" >Files with the camera matrices will be stored next to the corresponding input file. Do you want to continue?</hint>
        <body>$ExportCameras($(imagePath)$(imageName)$(imageExt)
$WriteFile("$(imagePath)$(imageName)_KRT.txt",$(f*scale) 0 $(px*scale+0.5*width) 0
0 $(f*scale) $(py*scale+0.5*height) 0
0 0 1 0
$(R00) $(R01) $(R02) $(tx)
$(R10) $(R11) $(R12) $(ty)
$(R20) $(R21) $(R22) $(tz)))</body>                                                              
    </format>
  1. 在RealityCapture中选择
  • alignment
    • export
      • registration
        • 下拉框选择CmpMvs _KRT matrices
  1. 相机参数会保存到
    imgname_KRT.txt文件中,每个文件表示一个相机的内参和外参

  2. 读取示例

class Camera:
    def __init__(self, krtfile, name=""):
        mat = np.loadtxt(krtfile)
        self.K = mat[0:3, 0:3]
        self.Rt = mat[3:, :]
        self.name = name
    
    @property
    def projection(self):
        return self.K.dot(self.extrinsics)

    @property
    def extrinsics(self):
        return self.Rt

    def project3dpoint(self, point):
        point = np.array(point)
        assert(point.shape[0] == 3)
        projection = np.matmul(self.projection, np.hstack([point, 1]).reshape(4, 1))
        projection = projection / projection[-1]
        return np.array([int(projection[0]),int(projection[1])])

def readCRKRT(cr_camera_projection):
    print("Loading camera projection matrix from " + str(cr_camera_projection))    
    files = os.listdir(str(cr_camera_projection))
    cameras = []
    for f in files:
        if "_KRT.txt" in f:
            cam_proj_file = cr_camera_projection / f
            cameras.append(Camera(cam_proj_file, f))
    return cameras

from pathlib import *
camerapath = Path("E:\cr_folder")
cameras = readCRKRT(camerapath)
print(cameras[0].K)
print(cameras[0].projection)

点云重投影效果

原图(没有去畸变)
点云重投影

相关文章

  • 导出RealityCapture相机参数

    在 reality capture根目录下calibration.xml文件中添加 在RealityCaptur...

  • ContextCapture导入导出相机参数

    原文地址:https://communities.bentley.com/products/3d_imaging_...

  • 计算机视觉-相机内参数和外参数

    1、相机内参数是与相机自身特性相关的参数,比如相机的焦距、像素大小等; 相机外参数是在世界坐标系中的参数,比如相机...

  • docker 镜像和容器导入导出

    镜像导出和载入 导出 option参数:-o 表示导出到哪个路径 例子: 载入 option参数:-i 导入的文件...

  • Export大数据量导出和打包

    项目需求 参数说明 坐标 注:抛开导出前的参数校验,只关注导出操作 。 主要代码 逻辑说明: 导出前将请求参数更新...

  • PhotoScan 使用

    打开软件---工作流程--添加照片 添加照片完成之后 完成之后 文件---导出---导出相机---file_na...

  • excel: 导出

    把表格导出EXCEL 接口加参数

  • Oracle数据泵专题

    使用参数文件进行expdp导出 使用参数文件字符无需转义,执行语句较为方便 创建导出目录 注意,这个OS层的路径需...

  • 相机基础参数

    相机结构: 相机的底片被放置在密封不见光的黑盒子里,盒子的前方有一个小孔,孔与底片之间有个隔板装装置。当拍照时...

  • impala-shell导入导出

    impala-shell导入导出 impala-shell导入导出 参数说明:• -q query (--quer...

网友评论

      本文标题:导出RealityCapture相机参数

      本文链接:https://www.haomeiwen.com/subject/lfxuuhtx.html