Quantcast

UpsideDown Point Cloud

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

UpsideDown Point Cloud

Camilo
Hi,

I'm working with the kinect and PCL. I have to questions, thanks for the help in advanced:


1st:

I'm visualizing a point cloud from the kinect (a organized point cloud) with the pcl_visualizer inside a ROS code.

I don't understand why my cloud is upside down and backwards.

I found something  <a href="http://www.pcl-users.org/align-point-cloud-to-a-plane-td3524146.html#a3524207 http://">here  but it doesn't work for me.

Here is a simplify version of the code that I'm using:


typedef pcl::PointCloud<pcl::PointXYZ> PointCloud;

boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer (new pcl::visualization::PCLVisualizer ("3D Viewer"));



void callback(const PointCloud::ConstPtr& msg)
{
viewer->addPointCloud<pcl::PointXYZ> (msg, "sample cloud");
viewer->spinOnce (100);
viewer->removePointCloud ("sample cloud");
}



int main(int argc, char** argv)
{
 
  ros::init(argc, argv, "getPointCloud");
  ros::NodeHandle nh;

  viewer->setBackgroundColor (0, 0, 0);
  viewer->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "sample cloud");
  viewer->addCoordinateSystem (1.0);
  viewer->initCameraParameters ();
 
ros::Subscriber sub = nh.subscribe<PointCloud>("camera/depth/points", 1, callback);
 
ros::Rate loop_rate(10);
 

while (ros::ok())
  {
               
  ros::spinOnce();

  loop_rate.sleep();
  }
}



2nd:

If I'm getting a organized point cloud from the kinect (width = 640, height = 480)

And If I want to find u,v pixel image coordinates(kinectRGB camera) from the 640x480 point cloud. can I found the (u,v) coordinates by doing this??:

u=3DPointIndex%640
v=3DPointIndex%480

Cheers,

Camilo
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: UpsideDown Point Cloud

Radu B Rusu
Administrator
You can use resetCameraViewpoint to flip your cloud. Also make sure the viewpoint information is correctly stored in the
data.

The answer to your second question is obvious ;) Yes, there is a 1-1 relationship between RGB pixels and XYZ points in
the cloud.

Cheers,
Radu.

On 04/20/2012 12:47 PM, Camilo wrote:

> Hi,
>
> I'm working with the kinect and PCL. I have to questions, thanks for the
> help in advanced:
>
>
> 1st:
>
> I'm visualizing a point cloud from the kinect (a organized point cloud) with
> the pcl_visualizer inside a ROS code.
>
> I don't understand why my cloud is upside down and backwards.
>
> I found something
> http://www.pcl-users.org/align-point-cloud-to-a-plane-td3524146.html#a3524207
> http:// here   but it doesn't work for me.
>
> Here is a simplify version of the code that I'm using:
>
>
> typedef pcl::PointCloud<pcl::PointXYZ>  PointCloud;
>
> boost::shared_ptr<pcl::visualization::PCLVisualizer>  viewer (new
> pcl::visualization::PCLVisualizer ("3D Viewer"));
>
>
>
> void callback(const PointCloud::ConstPtr&  msg)
> {
> viewer->addPointCloud<pcl::PointXYZ>  (msg, "sample cloud");
> viewer->spinOnce (100);
> viewer->removePointCloud ("sample cloud");
> }
>
>
>
> int main(int argc, char** argv)
> {
>
>    ros::init(argc, argv, "getPointCloud");
>    ros::NodeHandle nh;
>
>    viewer->setBackgroundColor (0, 0, 0);
>    viewer->setPointCloudRenderingProperties
> (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "sample cloud");
>    viewer->addCoordinateSystem (1.0);
>    viewer->initCameraParameters ();
>
> ros::Subscriber sub = nh.subscribe<PointCloud>("camera/depth/points", 1,
> callback);
>
> ros::Rate loop_rate(10);
>
>
> while (ros::ok())
>    {
>
>    ros::spinOnce();
>
>    loop_rate.sleep();
>    }
> }
>
>
>
>
> 2nd:
>
> If I'm getting a organized point cloud from the kinect (width = 640, height
> = 480)
>
> And If I want to find u,v pixel image coordinates(kinectRGB camera) from the
> 640x480 point cloud. can I found the (u,v) coordinates by doing this??:
>
> u=3DPointIndex%640
> v=3DPointIndex%480
>
> Cheers,
>
> Camilo
>
> --
> View this message in context: http://www.pcl-users.org/UpsideDown-Point-Cloud-tp3926957p3926957.html
> Sent from the Point Cloud Library (PCL) Users mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: UpsideDown Point Cloud

josuerocha
Can you give an example please?

The rotation does not work here.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: UpsideDown Point Cloud

Stormtalker
The correct positioning of the the view-angle is a little tricky. In my case the code to correct the angle was the following. Changing the parameter get a bad visualization sometimes. I also don't really know how to set the "zoom-factor" correctly.
Try this code and probably it helps. ;)

        pcl::PointCloud <pcl::PointXYZRGB>::Ptr reg_cloud = pcl::PointCloud <pcl::PointXYZRGB>::Ptr(new pcl::PointCloud <pcl::PointXYZRGB>);
        //changes the view angle of the mapped point cloud to front view
        my_cloud->sensor_orientation_.w() = 0.0;
        my_cloud->sensor_orientation_.x() = 1.0;
        my_cloud->sensor_orientation_.y() = 0.0;
        my_cloud->sensor_orientation_.z() = 0.0;
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: UpsideDown Point Cloud

josuerocha
Did this work?

Can anybody give another example please?

Thanks in advance.
Loading...