How can I use an SVM to seperate two classes in a 2D map?

I have 2d-numpy array of points defining a map with obstacles Image of the 2D Map of which I am trying to create an SVM with. The values of this 2d-array are either 0 for open space (grey) or 1,-1 for obstacles (black/white). The formatting of the map is shown below:

[[ 1.  1.  1. ...  1.  1.  1.]
 [ 1.  0.  0. ...  0.  0.  1.]
 [ 1.  0.  0. ...  0.  0.  1.]
 ...
 [ 1.  0.  0. ...  0.  0.  1.]
 [ 1.  0.  0. ...  0.  0.  1.]
 [ 1.  1. -1. ...  1.  1.  1.]]

My goal is to use a Support Vector Machine (SVM) to create a line/decision boundary between the obstacles. Since the obstacles are two separate classes, it should be possible to generate an SVM separating them. The ideal SVM boundary would look something like this.

What I am unsure of us how to transform my data to be in the format shown in the sklearn SVM example. I need to be able to specify the features, X and the target, y, so I can train the SVM by calling something like svm.SVC(kernel='linear', C=C).fit(X, y) as shown in the example.

In summary: how to convert my map (a 2-d array of either -1, 1, 0) into a set of features and targets?

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum