grayscale to monochrome

What this this command do? image.binary(thresholds(50, 255),invert=false)

Hi, binary turns an image black and white
What are you trying to do?

I am loading a saved file using image.Image—
I want to convert the image to monochrome.
I want to have the monochrome image show in the IDE frame buffer.

A grayscale image or a binary image?

Conversion from RGB565 to grayscale is not available right now. I’m working on increasing the firmware’s ability however. In particular, adding lots of stuff like for this for the next version. I’ll put this on my to-do queue.

Anyway, binary just produces a black and white image.

Alternatively, if you don’t mind speed issues. You have pixel level access of images. You can manually convert colors yourself. Just grab a pixel, use the RGB to yuv method to a yuv value, set the u and v parts to 0 and then convert back to RGB.

my image that I load in is already grayscale. I want to convert the grayscale to black and white.

Oh, then binary() is the method to use.

If you’d like for the camera to automatically pick the best threshold do:

value = img.get_histogram().get_threshold().value()
img.binary([(0, value)])

This uses otsu’s method to pick the most pleasing threshold.

how do i show it in the frame buffer so I can see it?


After everything.