´úÂëÈçÏ£º
#!/usr/bin/env python
# -*-coding:UTF-8-*-#
from common import *
import Image, ImageFilter, math, sys, os, random
def modifyImageObj(img, matrix) :
width, height = img.size
for h in range(0, height) :
for w in range(0, width) :
pixel = matrix[h][w]
img.putpixel((w, h), pixel)
return img
def initMatrix(h, w, v = (0, 0, 0)) :
result = []
for _h in range(0, h) :
row = []
for _w in range(0, w) :
row.append(v)
result.append(row)
return result
size = (600, 600)
img = Image.new('RGB', size)
h, w = size
matrix = initMatrix(h, w, (0, 0, 0))
m = []
m.append([-0.04, 0, -0.19, -0.47, -0.12, 0.3, 0.25])
m.append([0.65, 0, 0, 0.56, 0.06, 1.56, 0.25])
m.append([0.41, 0.46, -0.39, 0.61, 0.46, 0.4, 0.25])
m.append([0.52, -0.35, 0.25, 0.74, -0.48, 0.38, 0.25])
n = 0
x, y, a, b, c, d, e, f, newx, newy = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
while n < 300000 :
r = random.uniform(0, 1)
if r <= m[0][6] :
a=m[0][0]
b=m[0][1]
c=m[0][2]
d=m[0][3]
e=m[0][4]
f=m[0][5]
elif r <= m[0][6] + m[1][6] :
a=m[1][0]
&nb
ÏÂÃæÕâ¸öС¹¤¾ß°üº¬ÁË ÅжÏunicodeÊÇ·ñÊǺº×Ö£¬Êý×Ö£¬Ó¢ÎÄ£¬»òÕ߯äËû×Ö·û¡£ È«½Ç·ûºÅת°ë½Ç·ûºÅ¡£ unicode×Ö·û´®¹éÒ»»¯µÈ¹¤×÷¡£ »¹ÓÐÒ»¸öÄÜ´¦Àí¶àÒô×ֵĺº×ÖתƴÒôµÄ³ÌÐò£¬»¹ÔÚÕûÀíÖС£
#!/usr/bin/env python
# -*- coding:GBK -*-
"""ºº×Ö´¦ÀíµÄ¹¤¾ß:
ÅжÏunicodeÊÇ·ñÊǺº×Ö£¬Êý×Ö£¬Ó¢ ......
×î½üÒªÓõ½´®¿ÚͨѶ£¬¼òµ¥Ò×ÓõÄPythonÓÖ°ïÉÏæÁË£¬¶à¿÷ÁËÅÓ´óµÄµÚÈý·½×ÊÔ´~~~ £º£©
pySerial
Overview
This module encapsulates the access for the serial port. It provides
backends for Python running on Windows, Linux, BSD (possibly any POSIX
compliant system), Jython and IronPython (.NET and M ......