The general approach, which should work regardless of whether you have outlines of points in regular grids (for example, in your example) or not, is as follows. I will start with a set of coordinate points for the inner polygon ( xInnerand yInner, 18 points) and the outer polygon ( xOuterand yOuter, 22 points) selected from the square of the unit of measure:
plot(xOuter([1:end 1]), yOuter([1:end 1]), 'b*-');
hold on;
plot(xInner([1:end 1]), yInner([1:end 1]), 'r*-');

, meshgrid, , griddata ( 1 2 ) contour, 1.5:
[X, Y] = meshgrid(linspace(0, 1, 101));
Z = griddata([xInner; xOuter], ...
[yInner; yOuter], ...
[2.*ones(size(xInner)); ones(size(xOuter))], X, Y);
[C, H] = contour(X, Y, Z, [1.5 1.5]);

C.