“0912”

上级 ad5ca001
K-VRC.jpg

354.8 KB

# K-VRC-micropython
打算做一些表情互动,但是完全没有经验如何做机器人的表情,也算是一种尝试把
使用屏幕ssd1306
\ No newline at end of file
使用屏幕ssd1306
分辨率128x64
初步的模型 0912
因为比例与原机型不符
左右各留 20px 的边
左右眼睛 36x36
左右眼中间有空隙看起来比较自然(空隙位16px)
嘴巴是 80x28
\ No newline at end of file
文件已添加
asj=framebuf.FrameBuffer(bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00?\xf8\x0f\xfe\x00\x0c\x00\x00\xfc\x00\xff\xff\xff\xfe\x00\x00?\xe8\r\xfe\x00\x0c\x00\x00\xfc\x00\xff\xff\xff\xfe\x00\x00?\xe8\x0f\xfe\x00\x0c\x00\x00\xfc\x00\xff\xff\xff\xfe\x00\x00\xff\xfe?\xff\x80\x7f\x80\x03\xff\x00\xff\xff\xff\xff\xc0\x00\xff\xfe?\xff\x80\x7f\x80\x03\xff\x00\xff\xff\xff\xff\xc0\x07\xff\xff\xff\xff\xd1\xff\xf0\x1f\xff\x00\xff\xff\xff\xff\xc0\x05\xff\xff\xff\xff\xa1\xff\xf0\x1f\xff\x00\xff\xff\xff\xff\xc0\x06\xff\xff\xff\xff\xd1\xff\xf0\x1f\xff\x00\xff\xff\xff\xff\xc0\x07\xff\xff\xff\xff\xf0\x7f\xfc\x7f\xfc\x00\xf8\x07\xf8\x0f\xc0\x07\xff\xff\xff\xff\xf0\x7f\xfd\x7f\xfd\x00\xfd\x07\xfc\x0f\xc0\x07\xff\xff\xff\xff\xf0\x0f\xff\xff\xe0\x00\xf8\x07\xf8\x0f\xc0\x07\xff\xff\xff\xff\xf0\x0f\xff\xff\xe8\x00\xf8\x07\xf8\x0f\xc0\x07\xff\xff\xff\xff\xd0\x0f\xff\xff\xe0\x00\xf8\x07\xf8\x0f\xc0\x00\xff\xff\xff\xff\x80\x03\xff\xff\x00\x00\xfa\x07\xfa\x0f\xc0\x00\xff\xff\xff\xff\x80\x03\xff\xff@\x00\xfd\x07\xfa\x0f\xc0\x00\xff\xff\xff\xff\x80\x03\xff\xff \x00\xfa\x07\xfc\x0f\xc0\x00\x7f\xff\xff\xfe\x00\x00\x7f\xfd\x00\x00\xff\xff\xff\xff\xc0\x00\xbf\xff\xff\xfe\x80\x00\x7f\xfc\x00\x00\xff\xff\xff\xff\xc0\x00?\xff\xff\xfe\x00\x03\xff\xff\x00\x00\xff\xff\xff\xff\xc0\x00/\xff\xff\xfe\x00\x03\xff\xff\x00\x00\xff\xff\xff\xff\xc0\x00?\xff\xff\xfa\x00\x03\xff\xff\x00\x00\xff\xff\xff\xff\xc0\x00\x07\xff\xff\xf0\x00\x0f\xff\xff\xe0\x00\xff\xff\xff\xff\xc0\x00\x07\xff\xff\xf0\x00\x0f\xff\xff\xe0\x00\xff\xff\xff\xff\xc0\x00\x00\xff\xff\xc0\x00\x7f\xfd\x7f\xfc\x00\xff\xff\xff\xff\xc0\x00\x00\xff\xff\xc0\x00\x7f\xfe\xff\xfc\x00\xff\xff\xff\xff\xc0\x00\x00\xff\xff\xc0\x00\x7f\xfd\x7f\xfc\x00\xff\xff\xff\xff\xc0\x00\x00?\xfe\x00\x01\xff\xf0\x1f\xff\x00\xff\xff\xff\xff\xc0\x00\x00?\xfe\x00\x01\xff\xf4\x1f\xff\x00\xff\xff\xff\xff\xc0\x00\x00\x07\xf0\x00\x01\xff\x80\x03\xfc\x00\xff\xff\xff\xff\xc0\x00\x00\x07\xf0\x00\x01\xff\x90\x03\xfc\x00\xff\xff\xff\xff\xc0\x00\x00\x07\xf0\x00\x01\xff\x80\x03\xfd\x00\xff\xff\xff\xff\xc0\x00\x00\x01\xc0\x00\x00|\x00\x00\xe0\x00\x1f\xff\xff\xff\xc0\x00\x00\x01\xc0\x00\x00}\x00\x00\xe4\x00\x1f\xff\xff\xff\xc0\x00\x00\x01\xc0\x00\x00|\x00\x00\xe0\x00\x1f\xff\xff\xff\xc0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'),128,64,framebuf.MONO_HLSB) mouth-smile-1=framebuf.FrameBuffer(bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xe0\x07\x80\x00\x00\x00\x00\x00\x00\x00\x00\x03\xf8\x1f\xc0\x00\x00\x00\x00\x00\x00\x00\x00\x07\xfc?\xe0\x00\x00\x00\x00\x00\x00\x00\x00\x07\xff\xff\xe0\x00\x00\x00\x00\x00\x00\x00\x00\x07\xff\xff\xe0\x00\x00\x00\x00\x00\x00\x00\x00\x07\xff\xff\xe0\x00\x00\x00\x00\x00\x00\x00\x00\x03\xff\xff\xc0\x00\x00\x00\x00\x00\x00\x00\x00\x01\xff\xff\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00?\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'),96,32,framebuf.MONO_HLSB)
\ No newline at end of file
from PIL import Image
import os
file_dir=os.getcwd()
filelist=[]
buflist=[]
#转换图像文件为pbm
for root, dirs, files in os.walk(file_dir):
for filename in files:
try:
print(filename)
im=Image.open(filename)
im=im.convert('1')
im.save(filename[0:filename.find('.')]+'.pbm')
except:
pass
#读出位图数据
for root, dirs, files in os.walk(file_dir):
pbmfile= [f for f in files if f.endswith(".pbm")]
for filename in pbmfile:
with open(filename,'rb') as f:
f.readline()
width,height=[int(v) for v in f.readline().split()]
data=bytearray(f.read())
#print(data)
#print(width,height)
f.close()
logobuf=filename[:-4]+'=framebuf.FrameBuffer('+str(data)+','+str(width)+','+str(height)+',framebuf.MONO_HLSB)'
buflist.append(logobuf)
#写入txt文件
with open("buf.txt","w") as f:
for buf in buflist:
f.write(buf)
f.write('\r')
f.close()
import framebuf
'''
左右各留 20px 的边
左右眼睛 36x36
左右眼中间有空隙看起来比较自然(空隙位16px)
嘴巴是 80x28
'''
eye_l_x=20
eye_l_y=0
eye_r_x=72
eye_r_y=0
eye_w=36
eye_h=36
mouth_x=24
mouth_y=36
mouth_w=80
mouth_h=28
def pbm_to_fb(filename):
#aa=pbm_to_fb("asj")
#oled.blit(aa,0,0)
with open(filename+".pbm",'rb') as f:
f.readline()
width,height=[int(v) for v in f.readline().split()]
data=bytearray(f.read())
#print(data)
#print(width,height)
fb=framebuf.FrameBuffer(data,width,height,framebuf.MONO_HLSB)
f.close()
return fb
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册