I would like to directly set the view parameters rather than call rotate(), translate() ...
From C++ it looks like I can use this function:
Can you add this call to python?
Thanks for the request, but I am occupied by some other issues. I will handle this issue soon.
@adamlofts: I am working on this.
Actually direct saving/loading view point is done by using pinhole_camera_trajectory. For example:
vis = Visualizer()
vis.create_window()
ctr = vis.get_view_control()
pcd = read_point_cloud("../../TestData/fragment.pcd")
vis.add_geometry(pcd)
vis.run() # user changes the view and press "q" to terminate
param = ctr.convert_to_pinhole_camera_parameters()
trajectory = PinholeCameraTrajectory()
trajectory.intrinsic = param[0]
trajectory.extrinsic = Matrix4dVector([param[1]])
write_pinhole_camera_trajectory("test.json", trajectory)
vis.destroy_window()
will save test.json that has single camera pose in camera trajectory format.
vis = Visualizer()
vis.create_window()
ctr = vis.get_view_control()
pcd = read_point_cloud("../../TestData/fragment.pcd")
trajectory = read_pinhole_camera_trajectory("test.json")
vis.add_geometry(pcd)
ctr.convert_from_pinhole_camera_parameters(
trajectory.intrinsic, trajectory.extrinsic[0])
vis.run()
vis.destroy_window()
will read test.json and display the same view.
However, as @adamlofts indirectly pointed out, directly working with pinhole_camera_paramters is non-trivial as there is no I/O for pinhole_camera_paramters.
@qianyizh: do you hide I/O functions for PinholeCameraParameters intentionally, or it is not exposed?
It is a IJsonConvertible, so the IO should be exposed by default?
@qianyizh: can you tell me the name of the function? I think we need to expose PinholeCameraParameters first, right?
Here are exposed classes for your reference:
open3d - Python binding of Open3D
CLASSES
pybind11_builtins.pybind11_object(builtins.object)
ColorMapOptmizationOption
CorrespondenceChecker
CorrespondenceCheckerBasedOnDistance
CorrespondenceCheckerBasedOnEdgeLength
CorrespondenceCheckerBasedOnNormal
DoubleVector
FastGlobalRegistrationOption
Feature
Geometry
Geometry2D
Image
Geometry3D
LineSet
PointCloud
TriangleMesh
GlobalOptimizationConvergenceCriteria
GlobalOptimizationMethod
GlobalOptimizationGaussNewton
GlobalOptimizationLevenbergMarquardt
GlobalOptimizationOption
ICPConvergenceCriteria
ImageFilterType
IntVector
KDTreeFlann
KDTreeSearchParam
KDTreeSearchParamHybrid
KDTreeSearchParamKNN
KDTreeSearchParamRadius
Matrix4dVector
OdometryOption
PinholeCameraIntrinsic
PinholeCameraIntrinsicParameters
PinholeCameraTrajectory
PoseGraph
PoseGraphEdge
PoseGraphEdgeVector
PoseGraphNode
PoseGraphNodeVector
RANSACConvergenceCriteria
RGBDImage
RGBDOdometryJacobian
RGBDOdometryJacobianFromColorTerm
RGBDOdometryJacobianFromHybridTerm
RegistrationResult
RenderOption
SelectionPolygonVolume
TSDFVolume
ScalableTSDFVolume
UniformTSDFVolume
TSDFVolumeColorType
TransformationEstimation
TransformationEstimationPointToPlane
TransformationEstimationPointToPoint
Vector2iVector
Vector3dVector
Vector3iVector
VerbosityLevel
ViewControl
Visualizer
VisualizerWithEditing
VisualizerWithKeyCallback
I think we have changed it to PinholeCameraIntrinsic in a previous version? And it is exposed in python interface.
Hello everyone, I would like to capture depth image from 3d point and I want to save viewpoint from different views however I got some problem with respect to PinholeCameraTrajectory. Here is my code
from open3d import *
import numpy
import transforms3d
from scipy.spatial.transform import *
import matplotlib.pyplot as plt
pcd = open3d.io.read_point_cloud("scene0173.xyz")
vis = Visualizer()
vis.create_window()
ctr = vis.get_view_control()
vis.add_geometry(pcd)
vis.run() # user changes the view and press "q" to terminate
param = ctr.convert_to_pinhole_camera_parameters()
trajectory = open3d.camera.PinholeCameraTrajectory()
trajectory.intrinsic = param[0]
TypeError: 'open3d.open3d.camera.PinholeCameraParameters' object does not support indexing
Please help me with this problem
Most helpful comment
Hello everyone, I would like to capture depth image from 3d point and I want to save viewpoint from different views however I got some problem with respect to PinholeCameraTrajectory. Here is my code
from open3d import *
import numpy
import transforms3d
from scipy.spatial.transform import *
import matplotlib.pyplot as plt
pcd = open3d.io.read_point_cloud("scene0173.xyz")
vis = Visualizer()
vis.create_window()
ctr = vis.get_view_control()
vis.add_geometry(pcd)
vis.run() # user changes the view and press "q" to terminate
param = ctr.convert_to_pinhole_camera_parameters()
trajectory = open3d.camera.PinholeCameraTrajectory()
trajectory.intrinsic = param[0]
TypeError: 'open3d.open3d.camera.PinholeCameraParameters' object does not support indexing
Please help me with this problem