zoukankan      html  css  js  c++  java
  • python手记(38)

     runfile(r'K: estpro estopencv.py', wdir=r'K: estpro')
    http://blog.csdn.net/myhaspl
    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 放大图像


  • 相关阅读:
    SQL Server查看所有表大小,所占空间
    java 去掉html标签
    java多线程读取、操作List集合
    java vector的多线程安全是否有用
    java对redis的基本操作
    STL标签与EL表达式之间的微妙关系
    从一个简单的 JPA 示例开始
    JpaRepository 查询规范
    Hibernate Validator
    httprunner学习21-extentreports页面样式无法加载问题(已解决)
  • 原文地址:https://www.cnblogs.com/james1207/p/3278375.html
Copyright © 2011-2022 走看看