# Ros PCL segmentation for dominant plane

I have a point cloud of floor and wall. When i did segmentation with plane normals, it gave me plane of the wall instead of the floor as intended. However, when i changed the k search number of kd tree, it gives me the plane of the floor.

My question is 'is there anyway to specify which plane I want to segment?' also' I dont quite understand kd tree search. Please help

edit retag close merge delete

Sort by ยป oldest newest most voted

The solution proposed by Stefan suppose your cloud is expressed in a frame where Z points upwards. If the point cloud is expressed in the camera frame, there is no easy way to make the difference between the floor and a wall without more assumptions. If your camera is pointing to the floor you could choose the plan intersecting the optical axis (Z camera axis).

more

I wrote a node to capture 1 point cloud to pcd file from the kinect. I dont know if the point cloud is expressed in camera frame or not but I did check the z axis is depth. Can you suggest any method please?

( 2015-04-07 07:18:40 -0500 )edit

ok. i understand what you said now. however, i want to convert my point cloud in camera optical depth frame to base_link frame. base link is my static tf publisher

( 2015-04-25 00:24:21 -0500 )edit

You can for example use sample_consensus_model_perpendicular_plane. This allows specifying a normal for the plane that is fitted to the cloud. If you specify a (0, 0, 1) normal (i.e. one for a ideal floor plane), your segmentation should give you a fit for the floor. Do not forget to set the angle tolerance as noted in the link.

more

still doesnt work. i use sac_segmentation.h library, it has set axis and angle tolerance like the one you suggest . but it doesnt give me correct result

( 2015-04-07 06:55:16 -0500 )edit

It's of course important to set the normal correctly. If your cloud is given in camera frame, you'll have to either transform it or the normal to be consistent with each other.

( 2015-04-07 11:37:00 -0500 )edit

How can i check if the point cloud in camera frame? I subscribed to point topic from Kinect. When i save to pcd file, the cloud is upside down.

( 2015-04-07 19:12:07 -0500 )edit

The cloud should have a header field that contains the used frame_id.

( 2015-04-08 01:23:22 -0500 )edit

my frame id is camera_depth_optical_frame. My confusion is when you say i have to transform it. Can you explain a bit further. are xyz coordinate of my frame world coordinate?

( 2015-04-08 08:41:07 -0500 )edit