logo

如何将拍摄并保存好的图片通过串口发送到开发板

2019-07-01 13:27
2
_34yl

我之前是想通过获取图片的灰度和宽高,转化成16进制去发送,但是代码有错误,而且这样的话在接收端也需要重新组合,有没有更方便的方法

请在这里粘贴代码

import time, image

from pyb import UART

file_abs = None

uart = UART(3, 19200)

oled = []

s = [100]

n=0

classmates = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F']

while (True):

lu = ('singtown/first.png')

file_abs = image.Image(lu,copy_to_fb=True)

va1 = 64

width = int(file_abs.width()/va1)

high = int(file_abs.height()/va1)

#gray_lwpCV = file_abs.get_pixel(i,j)

for i in range(high):

for j in range(width):

gray_lwpCV = file_abs.get_pixel(i,j)

oled.append('gray_lwpCV')

sss = len(oled)

for i in range(sss):

while oled[i]>0:

s[n] = oled[i]%16

oled[i]=oled[i]/16

n+=1

for m in n:

hhex = classmates[s[m]]

uart.write(hhex)

print(hhex)

2019-07-02 15:35
I
网红小智智 星瞳科技

没有什么好办法。

因为不需要发送图片给其他的开发板,因为其他的开发板也不能处理图像。