How can I grab the contour lines into a new figure ?

4 次查看(过去 30 天)
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

采纳的回答

Kelly Kearney
Kelly Kearney 2013-6-7
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{:});
  9 个评论
Kelly Kearney
Kelly Kearney 2013-6-11
Oops, forgot that one... imshow also flips the axis. Add 'ydir' to the list of properties to copy.

请先登录,再进行评论。

更多回答(1 个)

Angus
Angus 2013-6-7
Try checking out ContourMatrix.
"ContourMatrix is also a read-only contourgroup property that you can obtain from the returned handle." -- matlab docs
  1 个评论
Uni
Uni 2013-6-8
you mean I should rearrange my C variable from contour function to get the new image ?
thanks

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Contour Plots 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by