Hi,
I am trying to save image in sensor.BINARY format but image.binary saves in sensor.GRAYSCALE format.
I have used example,
color_binaqry_filter_1.py
Color Binary Filter Example
This script shows off the binary image filter. You may pass binary any
number of thresholds to segment the image by.
import sensor, image, time
sensor.reset()
sensor.set_framesize(sensor.QVGA)
sensor.set_pixformat(sensor.GRAYSCALE) # USING GLOBAL SHUTTER CAMERA → changed from sensor.RGB565
sensor.skip_frames(time = 2000)
clock = time.clock()
while(True):
# Test red threshold
for i in range(100):
clock.tick()
img = sensor.snapshot()
img.binary([red_threshold])
print(img)
...
>
> OUTPUT: {"w":320, "h":240, "type"="grayscale", "size":76800}
Because of this problem, I cannot save image.binary() into extra frame buffer pre-defined as "sensor.BINARY".
I was expecting it would automatically convert image to binary format after image.binary().
Without looping through image and assigning pixel-by-pixel into frame buffer, is there a simple method doing this?
I tried to look for examples but there is no conversion examples for binary image.
I look forward to your reply,
\
\
Kind Regards
Phil