zoukankan      html  css  js  c++  java
  • 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
        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 ...
    正在处理中 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
    正在处理中 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .





  • 相关阅读:
    状态压缩DP------学习小记
    hdu 4681 string
    poj 3254 Corn Fields
    poj 3680 Intervals
    poj 1149 pigs ---- 最大流
    最大流算法----(SAP 和 EK)
    poj 2151 Check the difficulty of problems
    FTP的PORT(主动模式)和PASV(被动模式)
    json.stringify(),json.stringify()与json.parse()的区别
    css 选择器
  • 原文地址:https://www.cnblogs.com/james1207/p/3271425.html
Copyright © 2011-2022 走看看