python手记(36)
#!/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 'loading %s ...' % fn
print 'working',
img = cv2.imread(fn)
w=img.shape[1]
h=img.shape[0]
sz1=w*2
sz0=h*3
#创建空白图像,然后将图片排列
myimg1=np.zeros((sz1,sz0,3), np.uint8)
#翻转并生成图像
#逐个像素复制
img_x=0
img_y=0
for now_y in xrange(0,sz0):
for now_x in xrange(0,sz1):
myimg1[now_x,now_y,:]=img[img_y,img_x,:]
img_x+=1
if img_x>=w:
img_x=0
img_y+=1
if img_y>=h:
img_y=0
print '.',
#加上水印
cv2.putText(myimg1,"http://blog.csdn.net/myhaspl", (20,20),cv2.FONT_HERSHEY_PLAIN, 2.0, (0, 0, 0), thickness = 2)
cv2.putText(myimg1,"code by myhaspl:myhaspl@qq.com", (20,100),cv2.FONT_HERSHEY_PLAIN, 2.0, (0, 0, 0), thickness = 2)
cv2.namedWindow('img1')
cv2.imshow('img1', myimg1)
cv2.waitKey()
cv2.destroyAllWindows()
python opencv 旋转图片
python手记(36)的更多相关文章
- Python入门36道经典练习题
[程序1] 题目:有1.2.3.4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少? num_list=[] cou=0 for i in range(1,5): for j in rang ...
- python手记(50)
#!/usr/bin/env python # -*- coding: utf-8 -*- #http://blog.csdn.net/myhaspl #code:myhaspl@qq.com imp ...
- python手记(26)
#!/usr/bin/env python import cv2 import sys fn="test2.jpg" if __name__ == '__main__': prin ...
- python手记(32)
#!/usr/bin/env python #-*- coding: utf-8 -*- import cv2 import numpy as np fn="test2.jpg" ...
- python手记(30)
#!/usr/bin/env python #-*- coding: utf-8 -*- import cv2 import numpy as np fn="test3.png" ...
- python手记(31)
#!/usr/bin/env python #-*- coding: utf-8 -*- import cv2 import numpy as np fn="test2.jpg" ...
- python手记(38)
runfile(r'K:\testpro\testopencv.py', wdir=r'K:\testpro') http://blog.csdn.net/myhaspl myhaspl@qq.com ...
- python手记(39)
#!/usr/bin/env python #-*- coding: utf-8 -*- #code:myhaspl@qq.com import cv2 import numpy as np fn=& ...
- python手记(45)
python 声音编辑,减少音量 #!/usr/bin/env python # -*- coding: utf-8 -*- #http://blog.csdn.net/myhaspl #code:m ...
随机推荐
- 利用jQuery打造个性网站
网页结构 编写全局样式(reset.css) /*全局样式*/ body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fi ...
- .NET日志工具介绍
最近项目需要一个日志工具来跟踪程序便于调试和测试,为此研究了一下.NET日志工具,本文介绍了一些主流的日志框架并进行了对比.发表出来与大家分享. 综述 所谓日志(这里指程序日志)就是用于记录程序执行过 ...
- 探究adroid活动
Intent用处 隐式使用intent,在被启动的activity的manifest文件配置该活动 在出发活动建立intent时就写好和 网页浏览器用new intent 时用Intent.ACTIO ...
- Android UI ActionBar功能-自定义 Action Bar 样式
ActionBar的样式官方提供了三种: Theme.Holo Theme.Holo.Light Theme.Holo.Light.DarkActionBar 但不仅仅是这三种,我们还可以自己定义Ac ...
- iOS开发 使用Xcode自带的Leaks
http://www.jianshu.com/p/0837331875f0 http://www.cnblogs.com/tanzhenblog/p/5001344.html?utm_source=t ...
- 利用freopen()函数和fc命令简化程序调试
大家在参加ACM比赛或者参加c/c++实验技能竞赛的时候,如果遇到大量的输入和大量的输出时,调试起来很不方便.一来如果结果不正确的话,需要重复输入大量数据:二来如果大量输出的话,得仔细检查输出结果与正 ...
- KeystoneJS+mongo搭建简易博客
KeystoneJS 是一款基于 Express 和 MongoDB 的开源免费 Node.js CMS 网站开发框架. 一. 安装node.js,mongodb 二. 命令行安装KeystoneJS ...
- jquery 自动调整图片大小
<script type="text/javascript"> $(document).ready(function(){ $('#cons img').each(fu ...
- Unity3D使用mesh创建一个正方形
using UnityEngine; using System.Collections; public class Quad : MonoBehaviour { // Use this for ini ...
- 第八章: IO库
一.IO类 1.iostream定义了读写流的基本类型,fstream定义了读写命名文件的类型,sstream定义了读写内存string对象的类型 2.不能拷贝IO对象,因此不能将形参或返回类型设置为 ...