MATLAB: How to grab the contour lines into a new figure

contour lines

I am using contour function to get the contour lines from an image. Now I'd pretend to get only the contour lines created before to make a new image.
I am using [C,h]=contour(a,[0 0]); I have C – ContourMatrix and h – handler.
How can I create a new image (only contour lines) with this C and h ??
Thanks in Advance Mike

Best Answer

Easiest way: download contourcs, which will parse the C matrix for you.
a = peaks;
C = contourcs(a, [0 0]);
xy = {C.X; C.Y};
plot(xy{:});