vtk相机_OpenGL / VTK:设置相机内部参数

本文档介绍了如何将标准针孔相机的参数转换为VTK相机设置,包括应用变换、设置相机位置、焦点、视图方向、深度范围以及主点和视角的转换。通过示例代码,确保场景对象被正确地投影到渲染图像中。
摘要由CSDN通过智能技术生成

希望这将有助于其他人尝试将标准针孔相机参数转换为vtkCamera:我创建了一个显示如何进行完全转换的要点 . 我验证了世界将项目指向渲染图像中的正确位置 . 要点的关键代码粘贴在下面 .

// apply the transform to scene objects

camera->SetModelTransformMatrix( camera_RT );

// the camera can stay at the origin because we are transforming the scene objects

camera->SetPosition(0, 0, 0);

// look in the +Z direction of the camera coordinate system

camera->SetFocalPoint(0, 0, 1);

// the camera Y axis points down

camera->SetViewUp(0,-1,0);

// ensure the relevant range of depths are rendered

camera->SetClippingRange(depth_min, depth_max);

// convert the principal point to window center (normalized coordinate system) and set it

double wcx = -2*(principal_pt.x() - double(nx)/2) / nx;

double wcy = 2*(principal_pt.y() - double(ny)/2) / ny;

camera->SetWindowCenter(wcx, wcy);

// convert the focal length to view angle and set it

double view_angle = vnl_math::deg_per_rad * (2.0 * std::atan2( ny/2.0, focal_len ));

std::cout << "view_angle = " << view_angle << std::endl;

camera->SetViewAngle( view_angle );

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值