a=[]
for i in range(320):
for j in range(240):
#a.append("0x"+format(getPixHalfWord(px[i,j]),"4X"))
a.append(format(getPixHalfWord(px[j,i]),"X"))
import NaiveSerial
port=NaiveSerial.NaiveSerial(baudRate=115200)
for i in a:
i=int(i,base=16)
iL=int(i%256)
iH=int(i/256)
port.byte_write([iL,iH])[/mw_shl_code]
im = Image.open('D:\Desktop\未标题-1.bmp')
px = im.load()
def getPixHalfWord(px1):
R=int(px1[0]/8)
G=int(px1[1]/4)
B=int(px1[2]/8)
return B+G*32+R*2048
a=[]
for i in range(320):
for j in range(240):
#a.append("0x"+format(getPixHalfWord(px[i,j]),"4X"))
a.append(format(getPixHalfWord(px[j,i]),"X"))
import NaiveSerial
port=NaiveSerial.NaiveSerial(baudRate=115200)
for i in a:
i=int(i,base=16)
iL=int(i%256)
iH=int(i/256)
port.byte_write([iL,iH])[/mw_shl_code]
一周热门 更多>