Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to extract contours from following image or I am wondering how to partition following image:

line image looks like:

enter image description here

This question is linked: How to superimpose contour lines on transformed image

share|improve this question
Would this help? Colorize@MorphologicalComponents[ ColorNegate@Import[""], CornerNeighbors -> False] – Szabolcs Feb 20 '14 at 0:03
up vote 5 down vote accepted
i = Import[""];
(mc = MorphologicalComponents[ColorNegate[i], CornerNeighbors -> False]) // Colorize
Grid@Partition[ Image /@ (Replace[mc, Except[#] -> 0, {2}] & /@ Range@Max@mc), 4]

Mathematica graphics

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.