# Extract plot from an image with diffused lines

I found an amazing question on how to obtain a data set from an existing plot, which detailed the process very nicely.

Recreated the same steps on my end but it's not working, I am assuming because the line of the image I am trying to do is blurry at the edges and can't really take a point out of it.

pos1 = Position[ImageData[image1], {0., 0., 0.}]


That command is supposed to return a list with the points of the image but it doesn't because it can't find them, it returns an empty list. I also tried using ImageData[Binarize[image1]] instead, but it didn't work, which I found very weird.

Is there a way to obtain the points of the plot? One of the images that will be used is this one.

This is because of the image having more or less channels than the image in the Community post. The command Position[ImageData[image1], {0., 0., 0.}] is finding all instances where three channels are 0., but if there is only one channel, or four channels, this will not work.

In the case of your specific image, it has four channels. Since you are looking for pixel values of {0, 0, 0}, and all pixel values in the image have four dimensions ({0, 0, 0, 1}, for opaque black pixels), it is not returning anything useful.

A way around this is to ColorConvert[image1, "RGB"] or RemoveAlphaChannel@image1, to consistently have three channels, but Binarize is (in this case) a better option, which you touch on:

Position[ImageData@Binarize@i, 0]


Binarize results in an image that only has a single channel, and so we only need to pass 0, rather than a list of channel values like was originally done in the Community post.

• Thank you! That did it! I didn't understand the meaning of the 0s in Position, now I do. It was as easy as to change the {0,0,0} for just 0. Thanks! – M.O. Mar 13 '19 at 13:18
• @M.O. Happy to help! Please accept the answer if it solved your problem! – Carl Lange Mar 13 '19 at 13:21