Creating a safety distance from an obstacle in occupancyMap

조회 수: 5 (최근 30일)
Yovel
Yovel 2023년 12월 12일
편집: Image Analyst 2023년 12월 14일
Hi, I have a txt file that I read with the help of occupancyMap and it forms the map of my robot's environment.
The map has obstacles that the robot must not encounter while planning its route (using the RRT algorithm)
The routes I get are very, very close to the obstacles on the map, and since my robot is big, it gets stuck on these obstacles.
That's why I want to thicken the obstacles a little. So that the algorithm will think that there is an obstacle at certain points, even though in reality there is not, and thus it will not plan for the route to pass close to the obstacles.
I tried to use inflate(inflatedmap,10^-1), but it really thickens the obstacles and it's not good..
What other way can be done to solve this problem?
Look at the red route.. its too close to the obstacle

답변 (1개)

Image Analyst
Image Analyst 2023년 12월 14일
편집: Image Analyst 2023년 12월 14일
If you have the Image Processing Toolbox, you can use imdilate - it does what you ask for.
If you don't want blobs to join/connect, then you can use bwmorph with the 'thicken' option.
Also see Steve's multi-part blog on shortest paths:
To find the midline (skeleton) of the white regions, you can use bwskel.
If you don't have the Image Processing Toolbox, you could thicken the white blobs in the original mask by blurring and then thresholding.
windowSize = 15; % Whatever.
kernel = ones(windowSize) / windowSize^2;
blurredImage = conv2(mask, kernel);
% Threshold to creat a new, bigger mask
mask = mask > 0.2; % Adjust value to adjust thickness.

카테고리

Help CenterFile Exchange에서 Mapping에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by