python + opencv 学习系列 1 : Getting Started with Images
来源:互联网 发布:21天阿里云推荐系统 编辑:程序博客网 时间:2024/06/10 18:48
本文主要是根据 opencv 官网中 使用 Python的 教程写的,主要是为了个人学习记忆。
本节学习官网地址:
http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_gui/py_image_display/py_image_display.html#display-image
下面给出代码整合以及注释
def startWithImage(): ''' load and display an image ''' #load an color image in grayscale grayImage = cv2.imread("girl and green.jpg", 0) #中文标题不行 待解 #display an image cv2.namedWindow("girl and green", cv2.WINDOW_AUTOSIZE) cv2.imshow("girl and green", grayImage) cv2.waitKey(10000) cv2.destroyAllWindows() #write an image cv2.imwrite("gary girlAndGreen.jpg", grayImage )def SumItUp(): ''' copy from opencv python tutorial ''' grayImage = cv2.imread("girl and staircase.jpg", 0) cv2.imshow("girl and staircase",grayImage) k = cv2.waitKey(0 ) if k == 27: # wait for ESC key to exit cv2.destroyAllWindows() elif k == ord("s"): # wait for "s" key to save and exit cv2.imwrite("gray girlAndStaircase.jpg", grayImage ) cv2.destroyAllWindows()def usingMatplotlib(): ''' Matplotlib is a plotting library for Python which gives you wide variety of plotting methods. ''' from matplotlib import pyplot as plt grayImage = cv2.imread("girl and sexy.jpg", 0 ) plt.imshow(grayImage, cmap='gray', interpolation= 'bicubic') plt.xticks([]), plt.yticks([] ) # to hide tick values on X and Y axis plt.show()def mainPy(): ''' python入口函数 ''' #startWithImage( ) #SumItUp() usingMatplotlib()if __name__ == "__main__": mainPy( )
0 0
- python + opencv 学习系列 1 : Getting Started with Images
- python + opencv 学习系列 2 : Getting Started with Videos
- Getting started with OpenCV
- 学习Getting Started With TensorFlow
- TensorFlow学习篇【1】Getting Started With TensorFlow
- python channels笔记--Getting started with channels
- Getting Started with Pipeline 学习Pipeline
- [转]Getting Started with Hadoop, Part 1
- Getting Started with Hadoop, Part 1
- [转]Getting Started with Hadoop, Part 1
- [转]Getting Started with Hadoop, Part 1
- [转]Getting Started with Hadoop, Part 1
- Tutorials:Getting Started with jQuery---1
- Getting Started with D3 [Part 1]
- windbg - Getting Started with WinDBG - Part 1
- TensorFlow Note 1 : Getting Started With TensorFlow
- Getting Started with Smartphone
- Getting Started With JasperReports
- ZOJ3822-Domination 概率DP
- Hadoop学习笔记(六)启动Shell分析
- 动态计算UITableViewCell高度详解
- DirectX11 板条箱示例Demo
- Gas Station - LeetCode 134
- python + opencv 学习系列 1 : Getting Started with Images
- 感悟--网络找答案
- 剑指offer—二叉搜索树的后序遍历序列
- Hive笔记五:入门教程
- 黑马程序员----Objective-C学习笔记之OC基础练习笔记
- BZOJ 2525 [Poi2011]Dynamite 二分+树形贪心
- Hive笔记六:数据导入
- 张氏web漏洞检查工具发布-英文名:Mr.Zhang Web Leak Scanner GUI
- mac上mysql配置-解决连接127.0.0.1错误问题