%% Image to Binary Occupancy Grid Example
% This example shows how to convert an image to a binary occupancy grid for using with mapping and path planning.
% Import image.

image = imread('imageMap.png');

% Convert to grayscale and then black and white image based on given threshold value.

grayimage = rgb2gray(image);
bwimage = grayimage < 0.5;

% Use black and white image as matrix input for binary occupancy grid.

grid = binaryOccupancyMap(bwimage);

show(grid)

% Copyright 2019 The MathWorks, Inc.