python手记(38)
2013-08-23 18:58
162 查看
runfile(r'K:\testpro\testopencv.py', wdir=r'K:\testpro') http://blog.csdn.net/myhaspl
myhaspl@qq.com
loading test.png ...
working . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
python opencv 放大图像
myhaspl@qq.com
loading test.png ...
working . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#!/usr/bin/env python #-*- coding: utf-8 -*- #code:myhaspl@qq.com import cv2 import numpy as np fn="test.png" if __name__ == '__main__': print 'http://blog.csdn.net/myhaspl' print 'myhaspl@qq.com' print print 'loading %s ...' % fn print 'working', img = cv2.imread(fn) w=img.shape[1] h=img.shape[0] sz1=w*2 sz0=h*2 #创建空白图像 myimg1=np.zeros((sz0,sz1,3), np.uint8) #放大图像,每2个像素取1个像素的值 temp_x=0 temp_y=0 for now_y in xrange(0,sz0): temp_x=0 for now_x in xrange(0,sz1): myimg1[now_y,now_x,:]=img[int(temp_y),int(temp_x),:] temp_x+=0.5 print '.', temp_y+=0.5 cv2.namedWindow('img1') cv2.imshow('img1', myimg1) cv2.waitKey() cv2.destroyAllWindows()
python opencv 放大图像
相关文章推荐
- python手记(38)
- 38 Python csv
- Python 手记-3
- Python学习手记——Using the Python Interpreter
- leetcode练习(35,38) python实现
- LeetCode-38-Count and Say Python的int_to_string
- python手记(51)
- python手记(8)
- python学习手记
- scala学习手记38 - 方法命名约定和for表达式
- python手记
- python手记(游戏) 笨方法学python习题36【持续更新中】
- python手记(39)
- Python标准库使用手记:os模块
- python手记(10)
- python socket 编程手记
- Android开发手记4-MediaPlayer的数据准备 . error (-38, 0)
- java 1.6.0_38-b05 vm 20.13-b02 GC优化手记
- python手记-twisted(3)