65 viz::MarkerArrayPtr markerArrayPtr(
new viz::MarkerArray());
72 SimpleMatrix3 rotationMatrix = orientation.toRotationMatrix();
86 axisX.lifetime = lifetimeDur;
87 markerArrayPtr->markers.push_back(axisX);
99 Eigen::Matrix<Precision, 3, 4> frustumMatrix;
100 frustumMatrix << 1, 1, 1, 1,
101 tan(fovx / 2.0), -tan(fovx / 2.0), -tan(fovx / 2.0), tan(fovx / 2.0),
102 tan(fovy / 2.0), tan(fovy / 2.0), -tan(fovy / 2.0), -tan(fovy / 2.0);
104 Eigen::Matrix<Precision, 3, 4> frustumCornerMatrix = rotationMatrix * frustumMatrix;
106 Eigen::Matrix<Precision, 3, 8> completeFrustumCornerMatrix;
107 completeFrustumCornerMatrix.block<3, 4>(0, 0) = ncp * frustumCornerMatrix;
108 completeFrustumCornerMatrix.block<3, 4>(0, 4) = fcp * frustumCornerMatrix;
111 int indicesList[] = {0,1,2, 0,2,3, 0,4,7, 0,3,7 ,0,4,5, 0,1,5, 2,6,7, 2,3,7, 2,5,6, 1,2,5, 4,5,7, 5,6,7};
112 std::size_t sz =
sizeof(indicesList) /
sizeof(
int);
113 std::vector<int> triangleList(indicesList, indicesList + sz);
116 triangleListMarker.type = viz::Marker::TRIANGLE_LIST;
117 triangleListMarker.lifetime = lifetimeDur;
118 triangleListMarker.scale.x = triangleListMarker.scale.y = triangleListMarker.scale.z = 1.0;
122 BOOST_FOREACH(
int index, triangleList) {
123 SimpleVector3 frustumPoint = completeFrustumCornerMatrix.block<3, 1>(0, index);
125 triangleListMarker.points.push_back(pt);
127 markerArrayPtr->markers.push_back(triangleListMarker);
130 int lineIndicesList[] = {0,1, 0,3, 0,4, 1,2, 1,5, 2,3, 2,6, 3,7, 4,5, 4,7, 5,6, 6,7};
131 sz =
sizeof(lineIndicesList) /
sizeof(
int);
132 std::vector<int> lineList(lineIndicesList, lineIndicesList + sz);
135 lineListMarker.type = viz::Marker::LINE_LIST;
136 lineListMarker.lifetime = lifetimeDur;
137 lineListMarker.scale.x = 0.01;
141 BOOST_FOREACH(
int index, lineList) {
142 SimpleVector3 frustumPoint = completeFrustumCornerMatrix.block<3, 1>(0, index);
144 lineListMarker.points.push_back(pt);
146 markerArrayPtr->markers.push_back(lineListMarker);
148 if (pivotPointPosition != cameraPosition) {
150 offsetArrow.lifetime = lifetimeDur;
152 markerArrayPtr->markers.push_back(offsetArrow);
155 return markerArrayPtr;
SingleCameraModelFilter(const SimpleVector3 pivotPointOffset=SimpleVector3())
constructs a new camera model filter object.
pcl::FrustumCulling< ObjectPoint > FrustumCulling
SimpleVector3 getPivotPointPosition()
Eigen::Matrix< Precision, 3, 1 > SimpleVector3
static geometry_msgs::Point getPointMSG(const SimpleVector3 &vector)
virtual ObjectPointCloudPtr & getInputCloud()
static SimpleMatrix4 getCameraPoseMatrix(const SimpleVector3 &position, const SimpleQuaternion &orientation)
convenience function to get a camera pose matrix.
SimpleVector3 getPivotPointOffset()
double getHorizontalFOV()
std::vector< int > Indices
double getNearClippingPlane()
this namespace contains all generally usable classes.
viz::MarkerArrayPtr getVisualizationMarkerArray(uint32_t &sequence, double lifetime=30.0)
returns a array of markers containing the visualization of the camera frustum.
SimpleVector3 mPivotPointOffset
the offset to the pivot point.
virtual ~SingleCameraModelFilter()
destructs the single camera model filter object.
boost::shared_ptr< Indices > IndicesPtr
CameraModelFilter class was built to generalize the filtering for different camera models...
SimpleQuaternion getOrientation()
static visualization_msgs::Marker getBasicMarker(int id, std::string ns="my_namespace")
returns a marker with basic settings
virtual IndicesPtr & getIndices()
static double degToRad(double input)
FrustumCullingPtr mFrustumCullingPtr
shared pointer to the frustum culling object.
static visualization_msgs::Marker getArrowMarker(int id, SimpleVector3 startPoint, SimpleVector3 endPoint, SimpleVector3 scale=SimpleVector3(0.025, 0.05, 0.05), SimpleVector4 color=SimpleVector4(1.0, 0.0, 0.0, 1.0), std::string ns="my_namespace")
returns an arrow marker with the given settings
static void getRainbowColor(visualization_msgs::Marker &marker, double x, double alpha=1.0)
void setPivotPointOffset(const SimpleVector3 &pivotPointOffset)
sets the offset between the pivot point and the actual camera position.
void doFiltering(IndicesPtr &indicesPtr)
Does the filtering on the indices.
Eigen::Quaternion< Precision > SimpleQuaternion
Eigen::Matrix< Precision, 3, 3 > SimpleMatrix3
double getFarClippingPlane()