I want to extract subimages from an image like below. There are 6 components in the image, I want to crop this image into 6 images in a way each individual image contain only 1 component. Can I automatically do it by Mathematica?
Thanks in advance.
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityI want to extract subimages from an image like below. There are 6 components in the image, I want to crop this image into 6 images in a way each individual image contain only 1 component. Can I automatically do it by Mathematica?
Thanks in advance.
Thanks martin !!
SplitImage[image_] := Module[
{m, components},
m = MorphologicalComponents[image];
components =
ComponentMeasurements[{m, image}, {"Area", "BoundingBox"},#1>100&];
ImageTrim[image, #] & /@ components[[All, 2, 2]]
]
ImagePartition[ ]
orMorphologicalComponents[ ]
? $\endgroup$ComponentMeasurements
andImageTrim
in the documentation. $\endgroup$