PCL Programming-> Point Cloud Turn depth diagram display __PCL programming

Source: Internet
Author: User


Point cloud Turn Depth diagram display function:

void Depthvisual () {//Object for storing the point cloud.
	PCL::P OINTCLOUD<PCL::P ointxyz&gt::P TR Cloud (New PCL::P OINTCLOUD<PCL::P ointxyz>);
	Object for storing the normals.
	PCL::P ointcloud<pcl::normal&gt::P tr normals (new PCL::P ointcloud<pcl::normal>);
	Read a PCD file from disk.
	if (PCL::IO::LOADPCDFILE&LT;PCL::P ointxyz> ("VINCENT.PCD", *cloud)!= 0) {return;
	} eigen::matrix4f T;
	T << 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 500, 0, 0, 0, 1;
	eigen::matrix4f T1;
	T1 << 0,-1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1;
	eigen::affine3f Traw (T*T1); Parameters needed by the planar range image object://Image size.
	Both Kinect and xtion work at 640x480.
	int Imagesizex = 1500;
	int Imagesizey = 1500; Center of projection.
	Here, we choose the middle of the image.
	float CenterX = imagesizex/2.0f;
	float centery = imagesizey/2.0f; Focal length.
	The value seen here is has been taken from the original depth.It is safe to use the same value vertically and horizontally.
	float focallengthx = 800.0f, focallengthy = focallengthx; Sensor pose.
	Thankfully, the cloud includes the data.
	
	eigen::affine3f sensorpose = traw;//eigen::affine3f (eigen::translation3f (0, 0, 0)); Noise level.
	If greater than 0, values of neighboring points would be averaged.
	This would set the search radius (e.g., 0.03 = 3cm).
	float noiselevel = 0.0f; Minimum range.
	If set, any point closer to the sensor than this'll be ignored.

	float minimumrange = 0.0f;
	Planar range Image object.
	Pcl::rangeimageplanar Rangeimageplanar; Rangeimageplanar.createfrompointcloudwithfixedsize (*cloud, Imagesizex, Imagesizey, CenterX, CenterY, FocalLengthX,

	Focallengthx, Sensorpose, Pcl::rangeimage::laser_frame, Noiselevel, Minimumrange);
	Visualize the image.
	Pcl::visualization::rangeimagevisualizer Viewer ("Planar range image");
	Viewer.showrangeimage (Rangeimageplanar); while (!viewer.wasstopped ()) {
		Viewer.spinonce ();
		Sleep 100ms to go easy on the CPU.
	Pcl_sleep (0.1); }
}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.