首页 技术 正文
技术 2022年11月20日
0 收藏 824 点赞 2,523 浏览 985 个字

[1] The Python Tutorial

[2] Numpy Quick Start Tutorial

[3] Python-OpenCV

[4] http://www.learnpython.org/en/Welcome

如果一个python(a.py)文件被执行,变量__name__被赋值为”__main__”

def print1():    print("this is a function")def print2():    print("this is also a function")def main():    print1()    print2()if __name__ == '__main__':    main()$ python a.pythis is a functionthis is also a function

如果一个python(a.py)文件被import,其变量__name__被赋值为”a”,即文件名称。

# a.pyimport b# b.pyprint "Hello World from %s!" % __name__if __name__ == '__main__':    print "Hello World again from %s!" % __name__$ python a.pyHello World from b!$ python b.pyHello World from __main__!Hello World again from __main__!
from py1 import *

可以直接调用py1里的函数

Opencv3.X 的mat与python的numpy是兼容的,需要注意的是其维度的顺序需要调整一下,cv2就可以处理numpy格式的图像文件。

def extract_data():with h5py.File('make3d_dataset_f460.mat','r') as f:images = f['make3d_dataset_fchange/images'][:]image_num = len(images)print images.shapefor i in range(image_num):img = images[i,...].transpose((2, 1, 0))cv2.imshow('image', img)img = img*255img = img.astype('uint8')cv2.imwrite(file, img)cv2.waitKey(10000)

持续更新中。。。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,077
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,552
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,400
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,176
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,813
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,895