Page 1 of 1

OSError when read BMP

Posted: Wed May 15, 2019 1:51 am
by ky66111
I generate some bmp image from cifar lmdb database using opencv. But when reading bmp, exception throws out: "OSError: Unexpected value read!"

Code: Select all

import sensor, image, time

# Still need to init sensor
# Set sensor settings

# Set sensor pixel format

# Load image
img = image.Image("/viscifar/rgb.bmp")

# Add drawing code here.
# img.draw_line(...)

# Flush FB

# Add a small delay to allow the IDE to read the flushed image.

Re: OSError when read BMP

Posted: Wed May 15, 2019 1:56 am
by kwagyeman
Hi, our BMP file reading code is extremely old and needs to be redone. I haven't had time for it yet however. Please generate the BMP file using GIMP and set the BMP file mode in GIMP to RGB565. You can select RGB565 under the advanced information tab.