I open a pgm file, convert it to numPy array and change all pixels to 0 or 1 (or 255, I don't know how to proceed yet). How can I save it as .PBM using openCV?
Like:
P1
512 512
0 1 0 0 0 . .
0 0 0 1 0 . .
. . . . . . .
. . . . . . .
. . . . . . .
Thanks in advance!