I've been doing some image processing and have been having trouble with the AdjacentBorder
command. I've got an image in which I have several elements that are on the borders, and I was able to use ComponentMeasurements[image,"AdjacentBorders"]
to obtain the list of what borders these elements touch. However, when I go to use SelectComponents
, I'm unable to select the elements that are just on one border.
Is this possible, or can I only select the components that are bordering a certain amount of borders?
This is the image I started with this image
and the code I've used since.
j := Import@"http://i.imgur.com/AC0bvkG.png"
k := Binarize[j, FindThreshold[j]]
l := SelectComponents[k, "FilledCircularity", -7]
m := ImageCrop[l]
ComponentMeasurements[m, "AdjacentBorders"]
{1 -> {Top}, 2 -> {Right}, 3 -> {Left}, 4 -> {Left}, 5 -> {Right}, 6 -> {Bottom, Right}, 7 -> {Left, Bottom}}
I used ComponentMeasurements
to ensure that I did have points on the borders, which I did.