python手记(30)
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import cv2
import numpy as np fn="test3.png" if __name__ == '__main__':
print 'http://blog.csdn.net/myhaspl'
print 'myhaspl@qq.com'
print 'loading %s ...' % fn
print '正在处理中',
img = cv2.imread(fn)
w=img.shape[1]
h=img.shape[0]
ii=0
#将全部色彩变暗
for xi in xrange(0,w):
for xj in xrange (0,h):
img[xj,xi,0]= int(img[xj,xi,0]*0.2)
img[xj,xi,1]= int(img[xj,xi,1]*0.2)
img[xj,xi,2]= int(img[xj,xi,2]*0.2)
if xi%10==0 :print '.',
cv2.namedWindow('img')
cv2.imshow('img', img)
cv2.waitKey()
cv2.destroyAllWindows()
print''
print '正在处理中' ,
#将全部色彩变亮
for xi in xrange(0,w):
for xj in xrange (0,h):
img[xj,xi,0]= int(img[xj,xi,0]*10.2)
img[xj,xi,1]= int(img[xj,xi,1]*10.2)
img[xj,xi,2]= int(img[xj,xi,2]*10.2)
if xi%10==0 :print '.',
cv2.namedWindow('img')
cv2.imshow('img', img)
cv2.waitKey()
cv2.destroyAllWindows()
opencv对图像的像素进行操作
myhaspl@qq.com
loading test3.png ...
正在处理中 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
正在处理中 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
python手记(30)的更多相关文章
- python实用30个小技巧
python实用30个小技巧 展开1.原地交换两个数字Python 提供了一个直观的在一行代码中赋值与交换(变量值)的方法,请参见下面的示例: In [1]: x,y = 10 ,20 In [2]: ...
- python的30个编程技巧
1.原地交换两个数字 x, y =10, 20 print(x, y) y, x = x, y print(x, y) 10 20 20 10 2.链状比较操作符 n = 10 print(1 &l ...
- python(30)- 常用模块
模块就是py文件.python中能开辟作用域的只有函数.类和模块. for循环不能开辟作用域,for循环内的变量为全局变量.if...else...同for循环一样. 一 time模块 时间表示形式 ...
- 『无为则无心』Python函数 — 30、Python变量的作用域
目录 1.作用于的概念 2.局部变量 3.全局变量 4.变量的查找 5.作用域中可变数据类型变量 6.多函数程序执行流程 1.作用于的概念 变量作用域指的是变量生效的范围,在Python中一共有两种作 ...
- python 练习 30
Python从设计之初就已经是一门面向对象的语言,正因为如此,在Python中创建一个类和对象是很容易的.本章节我们将详细介绍Python的面向对象编程. 如果你以前没有接触过面向对象的编程语言,那你 ...
- 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手记(31)
#!/usr/bin/env python #-*- coding: utf-8 -*- import cv2 import numpy as np fn="test2.jpg" ...
随机推荐
- dbartisan下载地址
http://downloads.embarcadero.com/free/dbartisan
- sendkeys && appactivate
sendkeys 用于输入键盘按键 appactivate 用于聚焦程序 on error resume next set ws = createObject("wscript.she ...
- 安卓Intent(显式)
1.Intent是Android程序中各组件之间交互的重要方式,一般可用于启动活动.启动服务.以及发送广播等场景,这里先对活动进行说明Intent的一些作用. 2.Intent的用法大致可分为,显式I ...
- UESTCOJ-BiliBili, ACFun… And More!(水题)
BiliBili, ACFun… And More! Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Ja ...
- Java-Hirbernate中文乱码问题
当你从前台接收的值一直到Action 里面都没有乱码的时候,然而写入数据库的时候确实乱码的 这里有几个原因: 1.你的数据库字符编码指定出问题了 当你指定varchar类型的时候,字符集一定要指定成u ...
- ASP.NET MVC学习系列 WebAPI初探
转自http://www.cnblogs.com/babycool/p/3922738.html 一.无参数Get请求 一般的get请求我们可以使用jquery提供的$.get() 或者$.ajax( ...
- Java--获取request中所有参数的方法
我们通常用到request获取某个参数的方法: String value=request.getparameter("key"); 如果想要获取request中所有的参数呢? re ...
- CI 笔记,借鉴的4个辅助自定义函数
在System的core的common.php中,借鉴的4个自定义函数, 摘自后盾网的CI教程 /** * 格式化打印函数 * @param [type] $arr [数组] * @return [t ...
- oracle的购买价格研究
如果你是一个架构师,在数据库选型上除了技术选型,更重要的可能是性价比的选择,而oracle是现今排名第一的数据库,因此对oracle的价格有所了解是必须的. 几个要点: 1.oracle授权(也就是购 ...
- GridView 编辑、删除 、分页
类似代码都差不多,记录一下,便于以后查看使用. 前台页面: <asp:GridView ID="gdvList" runat="server" AutoG ...