树莓派Python2进行图片特效

版权声明:转载请标明链接, https://blog.csdn.net/qq_43433255/article/details/84066980

这次利用Python2在树莓派上进行一次简单的特效编辑(考虑树莓派特性,用vim)。
代码与原理十分简单,对于小白来说,是个非常容易上手的一个简单小程序。
备注:我的树莓派是3b+,用的是Ubuntu操作系统。

新建一个文件夹:

    mkdir wuluo
    cd  wuluo   

用vim进行编辑

vim test.py

在进行编写先关代码:

 import cv2

 #读入图片
 src=cv2.imread('/home/pi/111.jpg',1)
 #两种特效
 dst=cv2.cvtColor(src,cv2.COLOR_BGR2GRAY)
 img=cv2.Canny(dst,50,50)
 #窗口展示
 cv2.imshow('src',src)
 cv2.imshow('dst',dst)
 cv2.imshow('img',img)
 #存入图片
 cv2.imwrite('222.ipg',dst)
 cv2.imwrite('333.jpg',img)
 cv2.waitKey(0)

最后进行:

  pthon2 test.py

原图:
在这里插入图片描述
效果图:
在这里插入图片描述

转载请标明链接:https://blog.csdn.net/qq_43433255/article/details/84066980

猜你喜欢

转载自blog.csdn.net/qq_43433255/article/details/84066980