I apologize if the question is somewhat vague - it is a bit difficult to put succinctly in one line what I am trying to do. I wrote a program to take the binarized data of an image and then generate outlines from one side to the other. For example, take the following image:
Now I run the piece of code, given by getOutline
, which will draw a blue line such that I can divide this into three different parts.
boxTest = (ImageData@ Binarize[ Import["https://i.stack.imgur.com/JT3eI.png"]]) /. {0 -> 1, 1 -> 0};
ArrayPlot[getOutline[boxTest, {160, 290, 460}, "lc"],ColorRules -> {0 -> White, 0.5 -> Blue, 1 -> Black}, ImageSize -> Full]
Even though it isn't important, here,getouline
has inputs of the array(boxTest
), the starting values ({160, 290, 460}
) and the direction of travel("lc"
- which stands for left to right clockwise).
What I want to know is; how do I crop this image, which is actually an array of {0,0.5,1}'s, such that I can obtain three new arrays - which will then of course be formed into three separate images.
The spirit of it would be:
outlineArray = [getOutline[boxTest, {160, 290, 460}, "lc"];
dividedArray= splittingFunction[outlineArray];
Now, dividedArray
would have three elements, first element corresponding to: the dot, star and cloud array data, second element: the line and small star and the third element would be: the arrow and lightning. Of course once the arrays are cropped they would be put placed onto a padded array of zero's. That way when doing ArrayPlot/@dividedArray
I will have a nice images of the array data for all elements in dividedArray
which I could then export.
If the line separating the images were straight lines, then there is no problem. It's the fact that the blue outlines have this contouring property which stumps me - I do have a few potential solutions in mind, but they are rather dirty.
Thanks in advance