ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Converting 2d image to occupancy grid on ros2 foxy

asked 2022-03-10 20:57:35 -0600

Flash gravatar image

updated 2022-03-10 21:01:49 -0600

I am having trouble converting images to grids on ros2 foxy. Any help will be much appreciated. I checked the links for nav2 but was unable to get this done.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-03-11 06:13:00 -0600

ljaniec gravatar image

Could you add these Nav2 links to your answer, with description of your problems? Only then you can expect some useful answers.

What kind of image do you want to convert? Do you want to convert probability map to ROS OccupancyGrid message?

You can do it by hand with PGM files by threshold of every cell either to 0 or 1, then up/down scaling to fit chosen resolution. It could be done automatically with some graphics library, e.g. Shapely (Python).

You can base your implementation on some ROS packages like this one: (ROS1), (ROS1) etc.

You can find even more for sure.

edit flag offensive delete link more



The link I tried to use is I have the png/pgm format of the image which I want to convert to the grid with 1 and 0 so that I can use the algorithm using that grid. I will try to use python or opencv methods and see if I can work with them.

Flash gravatar image Flash  ( 2022-03-12 17:58:56 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2022-03-10 20:57:35 -0600

Seen: 98 times

Last updated: Mar 11 '22