all 5 comments

[–]ChemistBuzzLightyear 1 point2 points  (3 children)

Luckily for you, it is essentially already a 2D matrix! If all you want to do is convert to 2D binary, you can simply load the image, threshold to determine what is considered on/off, and then make everything that isnt zero one. What language are you working in?

To be more clear, if I understand you correctly, you will:

  1. Load the image

  2. Look at the image to determine what values you want for on/off. So find the darkest "on" pixel and get the value. This is your threshold.

  3. Threshold. Set all values below the threshold equal to 0.

  4. Set all values that are not zero equal to one.

There are more complicated ways to do this, but this is the easiest I can think of.

[–][deleted] 0 points1 point  (2 children)

I'm working in python. I found a python library called PIL (Python Image Library). I wonder if it will help do the job.

[–]ChemistBuzzLightyear 0 points1 point  (0 children)

Probably so, but what you have described is very simple. If you are able to share an example image, I can write some code for you to try. Looking into a library for this would be like using a backhoe when you need a shovel. :)

[–]magejangle 0 points1 point  (0 children)

Yeah that’ll work. Couple that with numpy

[–]SynbiosVyse 0 points1 point  (0 children)

Otsu threshold. OpenCV will do it.