logo

OSError:Assertion failed

2020-11-25 17:12
6
gnh2
# Copy image to framebuffer.
#
# This example shows how to load and copy an image to framebuffer for testing.

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("/1.bmp", copy_to_fb=True)

# 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)
0219f6cc-1d87-4b02-b7b1-62fa631c8fc5.JPG

运行例程03-Drawing-image_drawing.py,提示这个错误,不知道是为什么,是不是IDE的问题

2020-11-25 17:22
6
gnh2

问题发生在“img = image.Image("/1.bmp", copy_to_fb=True)”这一行

2020-11-25 18:32
I
网红小智智 星瞳科技

你有没有把`1.bmp`放到你的OpenMV里?

2020-11-25 18:42
6
gnh2

@kidswong999 您好!我用的SD卡,文件也放在了SD卡里边。

b43c634f-a628-4b74-ab83-610c554afd3c.JPG
2020-11-25 18:52
6
gnh2

@kidswong999 而且我用os.listdir函数打印出当前文件夹里的文件信息,也是有1.bmp文件的。

6
gnh2

@kidswong999 我打开jpg文件时,提醒我“OSError:Unsupported format”,连jpg文件都打不开

2020-11-26 14:25
I
网红小智智 星瞳科技

bmp文件使用OpenMV保存的吗?

2020-12-13 13:55
K
xoib

我也卡在这个问题的地方一直进行不下去,你现在解决了吗?能不能请问一下是如何解决的呢?

2020-12-13 18:20
I
网红小智智 星瞳科技

@xoib bmp用OpenMV保存