0
$\begingroup$

Rosanswers logo

Hi everyone!

I am using the package depthimage_to_laserscan. In this package is possible to change the parameter scan height to 480 (the height of the kinect depth image).

What I wanted to do is the following: I want the to obtain three 2D planes, instead of just one. For this to happen I need to divide the kinect depth image in 3, and scan each 1/3 of the image separately. So, I want one 2D scan for the bottom 1/3 of the kinect depth image, one for the top 1/3 and one for the center 1/3.

The problem is that when setting the scan height, even if I give it the value of 480/3, it will scan 480/3 rows, starting from the center of the image, meaning I can't get the top 1/3 scan and neither the bottom 1/3 scan!

How can I do this?

I hope my explanation wasn't very confusing! I would be grateful if you could help me on this issue!


Originally posted by anamcarvalho on ROS Answers with karma: 123 on 2014-07-24

Post score: 0


Original comments

Comment by arenillas on 2014-08-01:
I have the same issue and I don't know what to do

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

If I read your question correctly you want to have three laser scans, one for the top, middle and bottom of the image? If so I'd suggest updating the package so that

void convert(const sensor_msgs::ImageConstPtr& depth_msg, const image_geometry::PinholeCameraModel& cam_model, const sensor_msgs::LaserScanPtr& scan_msg, const int& scan_height, int& imageOffset) 

takes a new parameter - imageOffset or something which would be used to shift the horzontal center.

Details on the Image can be found here http://docs.pointclouds.org/1.5.1/structsensor__msgs_1_1_image.html

Then start three different depthimage_to_laser scan nodes, mapping the output to say /scan_top, /scan_middle and /scan_bottom where the imageOffset parameter is shifted to the 1/3 area of which ever bit you want.

Of course you could further extend the process to publish these topics diectly - but if the above is what you're looking for it'll give you a starting point

Cheers

Mark


Originally posted by MarkyMark2012 with karma: 1834 on 2014-08-20

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by anamcarvalho on 2014-08-25:
Thanks Mark! It worked!

Comment by MarkyMark2012 on 2014-08-25:
Cool! :) pleased to help

Comment by charkoteow on 2014-09-09:
@anamcarvalho, can you guide me through editing DepthImageToLaserScan.h with that new offset parameter? I want to try something quite similar with my kinect.

Comment by anamcarvalho on 2014-10-02:
Hi @charkoteow, what I did was use the offset as a pointer to the area I wanted to scan! I wanted 3 scans for 3 different areas, so I needed 3 different depthimage_to_laserscan... I simply changed the name of the topic each one provided and changed the following line of the code:

Comment by anamcarvalho on 2014-10-02:
int offset = (int)(cam_model.cy()-scan_height/2 - scan_height); This allows me to point to the first horizontal 1/3 of the kinect image! To point to the bottom 1/3 just change the last subtraction to a sum, and you will point to the center of the bottom area! cam_model.cy provides the center of img!

Comment by charkoteow on 2014-10-07:
Thank you @anamcarvalho it's working now.

Comment by miguel on 2015-10-04:
Im confused with your answer @mark, you say shift the horizontal center, wouldnt it be the vertical center? The reason I want to use this is for some reason my Asus xtion uses the bottom pixels for the scan and not the center ones. I would like to force it to use the center pixels? any suggestions

Comment by MarkyMark2012 on 2015-10-07:
@miguel - was this fixed by the flip issue?

Comment by miguel on 2015-10-07:
No it wasnt, i had to manually add an offset to (cy) in the openni2_camera.cpp to fix that. Please could you view this question inaccuracy part,see next comment first

Comment by miguel on 2015-10-07:
as i was able to solve this issue (not completely) by decreasing the focal length as it was squeezing the depth image and reducing the angle seen. It is better but still not perfect, do you maybe have a better way to fix this?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.