第1种:
在此之前你需要一张图片,命名为img.png(当然你也可以改代码里面的图片路径),图片和python代码在同一个目录下(或者代码中的照片路径用绝对路径)。
完整代码1:
import turtle as t
import cv2
t.getscreen().colormode(255)
img1 = cv2.imread('img.png')[0: -2: 2]
width = len(img1[0])
height = len(img1)
t.setup(width=width / 2 + 100, height=height + 100)
t.pu()
t.goto(-width / 4 + 10, height / 2 - 10)
t.pd()
t.tracer(2000)
for k1, i in enumerate(img1):
for j in i[::2]:
t.pencolor((j[0], j[1], j[2]))
t.fd(1)
t.pu()
t.goto(-width / 4 + 10, height / 2 - 10 - k1 - 1)
t.pd()
t.done()
**一、Python所有方向的学习路线**
Python所有方向的技术点做的整理,形成各个领域的知识点汇总,它的用处就在于,你可以按照下面的知识点去找对应的学习资源,保证自己学得较为全面。
![img](https://img-blog.csdnimg.cn/1d40facda2b84990b8e1743f5487d455.png)
![img](https://img-blog.csdnimg.cn/0fc11d4a31bd431dbf124f67f1749046.pn