logo

lcd显示img与IDE中不一致

2025-07-16 10:13
2
ps2n

IDE中img镜像了,但是lcd没有镜像。这些问题该怎么解决?

代码中已镜像。

f610b6ba-e1f0-4243-9d3e-1eff43e4bddc.png

import sensor

import time

import display

from pyb import UART

sensor.reset()

sensor.set_pixformat(sensor.RGB565)

sensor.set_framesize(sensor.QQVGA)

sensor.skip_frames(time=2000)

sensor.set_auto_whitebal(False)

sensor.set_auto_gain(False)

sensor.set_hmirror(True)

sensor.set_vflip(True)

clock = time.clock()

uart = UART(3, 9600)

black_threshold =(0, 35, -128, 57, -128, 42)

regions = (0, 50, 160, 25)

lcd = display.SPIDisplay()

while(True):

clock.tick()

img = sensor.snapshot().lens_corr(1.8)

img.draw_rectangle(regions, color=(255, 0, 0))

blobs = img.find_blobs([black_threshold],roi=regions,x_stride=10,y_stride=10)

for r in blobs:

img.draw_rectangle(r.rect(), color=(0, 255, 0))

print('#'+str(r.cx())+'$')

uart.write('#'+str(r.cx())+'$')

lcd.write(img) # 拍照并显示图像。

2025-07-16 17:55
Z
星小瞳xs

请具体描述一下你的问题

2025-07-16 18:35
2
ps2n

@ps2n 在 [lcd显示img与IDE中不一致](/post/33043) 中说:

> IDE中img镜像了,但是lcd没有镜像。

IDE中img镜像了,但是lcd屏幕上没有镜像,这是什么原因呢?我用的是这句代码:lcd.write(img)

2025-07-16 19:59
6
hxps

@ps2n 我的也是没有镜像啊

2025-07-17 17:41
2
ps2n

@uzbd IDE中img镜像了,但是lcd没有镜像。 这个要怎么解决哇?sensor.set_hmirror(True)

sensor.set_vflip(True) 用了镜像的这两句函数,lcd.write(img) ,输出的也是img图像。

2025-07-17 17:58
Z
星小瞳xs

@ps2n 可以在lcd上进行翻转:https://docs.singtown.com/micropython/zh/latest/openmvcam/library/omv.display.spidisplay.html