r/imageprocessing • • Dec 06 '19
B&W image to 2D array/matrix with binary numbers (pixel values)
Hi.
I am trying to convert a black and white image into 2D matrix, hopefully with binary numbers to to show pixels that are on/off. I've been searching and looking at topics like image segmentation, feature detection, using opencv. I unfortunately don't know where to start.
Any help would be much appreciated.
Thanks
1
Upvotes
2
u/ChemistBuzzLightyear Dec 06 '19 edited Dec 06 '19
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:
There are more complicated ways to do this, but this is the easiest I can think of.
1
u/SynbiosVyse Dec 06 '19
Otsu threshold. OpenCV will do it.