python图形库(1)
python有很好图形库cv2(包含很多图形处理的算法),pylab(绘图工具模块)
这两个“模块”是肯定要配置的。
安装这两个模块可用了我不少时间。
pylab它不是一个包,而是 numpy, scipy 和 matplotlab 的合体,要安装这3个部分。
import pylab as pl
listOfInt = []
for c in range():
listOfInt.append(c*) print listOfInt pl.plot(listOfInt)
pl.show()
出现效果:
就成功了pylab模块的安装.
然后就是cv2了,找了好多资料,python库那里面下载东西,目录结构刚开始没搞清楚,不知道粘贴哪个。
http://blog.csdn.net/qq_14845119/article/details/52354394这篇文章有很详细的讲解。说的比较多。只要看一部分就ok了
opencv2.4.12 http://opencv.org/downloads.html下载地址。
点击下载的opencv-2.4.12.exe,一路next下去,例如本人安装到E盘根目录下。安装完成后,将E:\opencv2_4_12\build\python\2.7\x64下的cv2.pyd拷贝到你的Lib文件夹下就可以了。
然后测试一下
import cv2
import numpy as np img = cv2.imread("1.jpg")
emptyImage = np.zeros(img.shape, np.uint8) emptyImage2 = img.copy() emptyImage3=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) cv2.imshow("EmptyImage3", emptyImage3)
cv2.waitKey (0)
cv2.destroyAllWindows()
显示效果即可:
注意:scipy:http://sourceforge.net/projects/scipy/files/scipy/0.12.0/
里面是没有64位操作系统的exe文件的,解决方案有很多,但是有效的不多,改注册表麻烦。
写一个register.py的脚本,我试了一下是没有用的。可以去尝试一下。
#
# script to register Python 2.0 or later for use with win32all
# and other extensions that require Python registry settings
#
# written by Joakim Loew for Secret Labs AB / PythonWare
#
# source:
# http://www.pythonware.com/products/works/articles/regpy20.htm
#
# modified by Valentine Gogichashvili as described in http://www.mail-archive.com/distutils-sig@python.org/msg10512.html import sys from _winreg import * # tweak as necessary
version = sys.version[:3]
installpath = sys.prefix regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version)
installkey = "InstallPath"
pythonkey = "PythonPath"
pythonpath = "%s;%s\\Lib\\;%s\\DLLs\\" % (
installpath, installpath, installpath
) def RegisterPy():
try:
reg = OpenKey(HKEY_CURRENT_USER, regpath)
except EnvironmentError as e:
try:
reg = CreateKey(HKEY_CURRENT_USER, regpath)
SetValue(reg, installkey, REG_SZ, installpath)
SetValue(reg, pythonkey, REG_SZ, pythonpath)
CloseKey(reg)
except:
print "*** Unable to register!"
return
print "--- Python", version, "is now registered!"
return
if (QueryValue(reg, installkey) == installpath and
QueryValue(reg, pythonkey) == pythonpath):
CloseKey(reg)
print "=== Python", version, "is already registered!"
return
CloseKey(reg)
print "*** Unable to register!"
print "*** You probably have another Python installation!" if __name__ == "__main__":
RegisterPy()

大致意思说的是scipy需要numpy不是上面的那种,而是numpy+mkl

python图形库(1)的更多相关文章
- 13个Python图形库
By Django中国社区 at 2013-04-27 07:49 Python的13大图形库,matplotlib功能最强大,Cairoplot最漂亮,django-chartit与Django集成 ...
- Python图形库Turtle
画笔绘制状态函数 函数 描述 pendown() 放下画笔 penup() 提起画笔,与pendown()配合使用 pensize(width) 设置画笔线条的粗细为指定大小 画笔运动函数 函数 描述 ...
- Python 图形库
1. 总体介绍 http://www.cnblogs.com/Vito2008/p/5264291.html 2.pygal http://rfyiamcool.blog.51cto.com/1030 ...
- 用Python实现QQ找茬游戏外挂工具
源地址:http://cpiz.net/blog/2012/03/a_qq_zhaocha_assistant_by_python/ (原创作品,转载请注明出处)好久没写技术相关的博文,这次写篇有意思 ...
- Python 面试中可能会被问到的30个问题
第一家公司问的题目 1 简述解释型和编译型编程语言? 解释型语言编写的程序不需要编译,在执行的时候,专门有一个解释器能够将VB语言翻译成机器语言,每个语句都是执行的时候才翻译.这样解释型语言每执行一次 ...
- 20个必不可少的Python库
转载:http://www.python123.org/tutorials/58b41f2a28c8f30100bd41dc 读者们好.今天我将介绍20个属于我常用工具的Python库,我相信你看完之 ...
- python 有趣的库练习
这里会将看到别人玩过有趣的实践并记录下来,会是一个长期更新的过程... 以下大部分均非原创变化自网络,只是觉得有趣便记录下来了,如有侵权,请告知删除... 自动化脚本... 20个必不可少的Pytho ...
- Python模块笔记
__name__属性 一个模块被另一个程序第一次引入时,其主程序将运行.如果我们想在模块被引入时,模块中的某一程序块不执行,我们可以用__name__属性来使该程序块仅在该模块自身运行时执行. #!/ ...
- python 包详解
包 包是一种管理 Python 模块命名空间的形式,采用"点模块名称". 比如一个模块的名称是 A.B, 那么他表示一个包 A中的子模块 B . 就好像使用模块的时候,你不用担心不 ...
随机推荐
- 查看Oracle当前连接数
SQL> select count(*) from v$session #当前的连接数 SQL> Select count(*) from v$session where status=' ...
- PS使模糊图片变清晰
操作步骤 \(文件\)
- Spark机器学习库(MLlib)官方指南手册中文版
中文https://blog.csdn.net/liulingyuan6/article/details/53582300 https://yq.aliyun.com/articles/608083 ...
- if else 选择机构 _多重if选择机构_if选择结构嵌套(综合练习题——code)
import java.util.*; class If01{ public static void main(String[ ]args){ //练习1:假如张三参加Java考试,判断如果在95分以 ...
- [引]雅虎日历控件 Example: Two-Pane Calendar with Custom Rendering and Multiple Selection
本文转自:http://yuilibrary.com/yui/docs/calendar/calendar-multipane.html This example demonstrates how t ...
- RadControl使用相同的Theme
我們僅須對兩個地方加一些程式碼,就可使所有的RadControl擁用相的Theme,如此一下不但可使Ap內布景主題一致,設計者亦不需要對每個控件做字型,顏色,大小等等瑣碎的設計. App.Xaml.c ...
- phpstorm 10 注册码
phpstorm 10 注册码 注册时选择License server,填http://idea.lanyus.com,然后点击OK 网上看评论的结果,亲测,有用!!!
- c++ 面试整理
1. 继承方式 public 父类的访问级别不变 protected 父类的public成员在派生类编程protected,其余的不变 private 父类的所有成员变成pr ...
- linux 查看防火墙状态
1.查看防火墙状态 systemctl status firewalld firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running) 2 ...
- 浏览器缓存介绍之sessionStorage、localStorage、Cookie
Cookie Cookie 是小甜饼的意思.顾名思义,cookie 确实非常小,它的大小限制为4KB左右,是网景公司的前雇员 Lou Montulli 在1993年3月的发明.它的主要用途有保存登录信 ...