Small Satellites

Home » Posts tagged 'Path Planning for Mobile Robots via Skeletons'

Tag Archives: Path Planning for Mobile Robots via Skeletons

Computing a Skeleton of a Map for Mobile Robots,Path Planning

clc;close all;clear all;

Input Map

RGB = imread('Map1.png');
figure('Position',[0 0 800 800]);

Robot Map1

Convert to binary image matrix and inverse matrix values

I = rgb2gray(RGB);
binaryImage = im2bw(RGB, 0.3);
binaryImage = 1-binaryImage;
figure('Position',[0 0 800 800]);
Warning: Image is too big to fit on screen; displaying at

Robot Map 1

Compute for every pixel the distance to the nearest obstacle(non zero elements which after inversion corespondent to the obstacles)

[D,IDX] = bwdist(binaryImage);
figure('Position',[0 0 800 800],'color','k')
colormap bone
axis off          % Remove axis ticks and numbers
axis image
set(gcf, 'InvertHardCopy', 'off');

Robot Map 3

Taking the Laplacian of the distance transform. Play with the treshold value 0.15 to remove or add more futures in skeleton

lap = del2(D);
sz  = size(lap);
for i = 1:sz(1)
    for j = 1:sz(2)
         if( abs(lap(i,j)) < 0.15)
       lap(i,j) = 0;
lap = flipdim(lap ,1);           %# vertical flip
figure('Position',[0 0 800 800],'color','k');
colormap winter;
axis off
axis image
set(gcf, 'InvertHardCopy', 'off');


%d bloggers like this: