OSError when read BMP

Discussion related to "under the hood" OpenMV topics.
ky66111
Posts: 6
Joined: Fri May 10, 2019 4:13 am

OSError when read BMP

Postby ky66111 » Wed May 15, 2019 1:51 am

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
sensor.reset()
# Set sensor settings
sensor.set_contrast(1)
sensor.set_gainceiling(16)

# Set sensor pixel format
sensor.set_framesize(sensor.QQVGA)
sensor.set_pixformat(sensor.GRAYSCALE)

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

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

# Flush FB
sensor.flush()

# Add a small delay to allow the IDE to read the flushed image.
time.sleep(100)
User avatar
kwagyeman
Posts: 3188
Joined: Sun May 24, 2015 2:10 pm

Re: OSError when read BMP

Postby kwagyeman » Wed May 15, 2019 1:56 am

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.
Nyamekye,

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 12 guests