#!/usr/bin/env python
#-*- coding: utf-8 -*-
#code:myhaspl@qq.com
import cv2
import numpy as np fn1="he2.jpg"
fn2="he1.jpg"
if __name__ == '__main__':
print 'http://blog.csdn.net/myhaspl'
print 'myhaspl@qq.com'
print print 'working',
myimg1 = cv2.imread(fn1)
myimg2 = cv2.imread(fn2)
w=myimg1.shape[1]
h=myimg1.shape[0]
sz1=w
sz0=h #每个像素为2个像素的平均值
for y in xrange(0,sz0):
for x in xrange(0,sz1):
if myimg2[y,x,0]>(myimg2[y,x,0]+myimg2[y,x,1]):
myimg2[y,x,:]=myimg1[y,x,:]
else:
myimg2[y,x,:]=myimg1[y,x,:]*0.2+myimg2[y,x,:]*0.8 print '.', cv2.namedWindow('img2')
cv2.imshow('img2', myimg2)
cv2.waitKey()
cv2.destroyAllWindows()

python opencv去掉天空蓝色背景后,图像整合

python手记(42)的更多相关文章

  1. python手记(50)

    #!/usr/bin/env python # -*- coding: utf-8 -*- #http://blog.csdn.net/myhaspl #code:myhaspl@qq.com imp ...

  2. python手记(26)

    #!/usr/bin/env python import cv2 import sys fn="test2.jpg" if __name__ == '__main__': prin ...

  3. python手记(32)

    #!/usr/bin/env python #-*- coding: utf-8 -*- import cv2 import numpy as np fn="test2.jpg" ...

  4. python手记(30)

    #!/usr/bin/env python #-*- coding: utf-8 -*- import cv2 import numpy as np fn="test3.png" ...

  5. python手记(31)

    #!/usr/bin/env python #-*- coding: utf-8 -*- import cv2 import numpy as np fn="test2.jpg" ...

  6. python手记(38)

    runfile(r'K:\testpro\testopencv.py', wdir=r'K:\testpro') http://blog.csdn.net/myhaspl myhaspl@qq.com ...

  7. python手记(39)

    #!/usr/bin/env python #-*- coding: utf-8 -*- #code:myhaspl@qq.com import cv2 import numpy as np fn=& ...

  8. python手记(45)

    python 声音编辑,减少音量 #!/usr/bin/env python # -*- coding: utf-8 -*- #http://blog.csdn.net/myhaspl #code:m ...

  9. python手记(44)

    #!/usr/bin/env python # -*- coding: utf-8 -*- #http://blog.csdn.net/myhaspl #code:myhaspl@qq.com imp ...

随机推荐

  1. opencv 利用Haar 人脸识别

    #include <opencv2/opencv.hpp> #include <cstdio> #include <cstdlib> #include <io ...

  2. 通过Roslyn构建自己的C#脚本(更新版)

    之前写过文章介绍过如何通过Roslyn构建自己的C#脚本,但那篇文章是参考自Roslyn CTP版的,记得本来想等到Roslyn正式版出来重新更新一下文档的,不过记得后来Roslyn是跳票了的,Scr ...

  3. Java学习笔记_22_Set接口的实现类

    22.Set接口的实现类: Set接口存放的元素是无序的且不包括反复元素. 1>实现类HashSet: HashSet类依据元素的哈希码进行存放,取出时也能够依据哈希码高速找到.HashSet不 ...

  4. ISO 7816-4: Interindustry Commands for Interchange

    5. Basic Organizations 5.1 Data structures5.2 Security architecture of the card 5.3 APDU message str ...

  5. solaris 10系统配置工具

    bash-3.2# prtdiag 报告一般系统信息 System Configuration: VMware, Inc. VMware Virtual Platform BIOS Configura ...

  6. mysql学习之二:mysql基本使用方法

    安装完mysql后我们能够进行sql语句的操作: 我们能够使用下面命令连接到MySQL服务: mysql -h localhost -u root -p -h參数指定要连接的MySQLserver地址 ...

  7. golang 字符串与整数, 布尔转换 strconv

    strconv 是golang对于字符串和基本数据类型之间的转换字符串转整数testStr := "1000" testInt, err := strconv.Atoi(testS ...

  8. Writable atomic property '***' cannot pair a synthesized setter/getter with a user defined

    1. warning: Semantic Issue: Writable atomic property 'number' cannot pair a synthesized setter/gette ...

  9. Javascript:猜猜弹出的是啥?为啥?

    背景 经常需要向新入职的年轻同学解释Javascript的两个概念:单线程和作用域链,今天就再写篇博客说明一下. 单线程 队列:只有一个用来存储回调方法的队列. 消费线程:只有一个消费线程,不停的从队 ...

  10. python笔记29-队列Queue

    前言 Python的Queue模块提供一种适用于多线程编程的FIFO实现.它可用于在生产者(producer)和消费者(consumer)之间线程安全(thread-safe)地传递消息或其它数据,因 ...