fix aspect_ratio computation from fovs, add casting for camerapositionwidget, trajectorywidget
This commit is contained in:
parent
769512db2d
commit
aa2594c06c
@ -231,6 +231,8 @@ namespace cv
|
||||
template<> CV_EXPORTS TextWidget Widget::cast<TextWidget>();
|
||||
template<> CV_EXPORTS ImageOverlayWidget Widget::cast<ImageOverlayWidget>();
|
||||
template<> CV_EXPORTS Image3DWidget Widget::cast<Image3DWidget>();
|
||||
template<> CV_EXPORTS CameraPositionWidget Widget::cast<CameraPositionWidget>();
|
||||
template<> CV_EXPORTS TrajectoryWidget Widget::cast<TrajectoryWidget>();
|
||||
template<> CV_EXPORTS CloudWidget Widget::cast<CloudWidget>();
|
||||
template<> CV_EXPORTS CloudNormalsWidget Widget::cast<CloudNormalsWidget>();
|
||||
template<> CV_EXPORTS MeshWidget Widget::cast<MeshWidget>();
|
||||
|
@ -1003,9 +1003,10 @@ cv::viz::CameraPositionWidget::CameraPositionWidget(const Vec2f &fov, double sca
|
||||
camera->SetFocalPoint(0.0,0.0,1.0);
|
||||
camera->SetClippingRange(0.01, scale);
|
||||
|
||||
double aspect_ratio = tan(fov[0] * 0.5) / tan(fov[1] * 0.5);
|
||||
|
||||
double planesArray[24];
|
||||
// Default aspect ratio = 1.0? fovx/fovy?
|
||||
camera->GetFrustumPlanes(1.0, planesArray);
|
||||
camera->GetFrustumPlanes(aspect_ratio, planesArray);
|
||||
|
||||
vtkSmartPointer<vtkPlanes> planes = vtkSmartPointer<vtkPlanes>::New();
|
||||
planes->SetFrustumPlanes(planesArray);
|
||||
@ -1122,6 +1123,12 @@ cv::viz::CameraPositionWidget::CameraPositionWidget(const Matx33f &K, const Mat
|
||||
WidgetAccessor::setProp(*this, actor);
|
||||
}
|
||||
|
||||
template<> cv::viz::CameraPositionWidget cv::viz::Widget::cast<cv::viz::CameraPositionWidget>()
|
||||
{
|
||||
Widget3D widget = this->cast<Widget3D>();
|
||||
return static_cast<CameraPositionWidget&>(widget);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// trajectory widget implementation
|
||||
|
||||
@ -1279,3 +1286,9 @@ cv::viz::TrajectoryWidget::TrajectoryWidget(const std::vector<Affine3f> &path, c
|
||||
WidgetAccessor::setProp(*this, actor);
|
||||
setColor(color);
|
||||
}
|
||||
|
||||
template<> cv::viz::TrajectoryWidget cv::viz::Widget::cast<cv::viz::TrajectoryWidget>()
|
||||
{
|
||||
Widget3D widget = this->cast<Widget3D>();
|
||||
return static_cast<TrajectoryWidget&>(widget);
|
||||
}
|
Loading…
Reference in New Issue
Block a user