首页 文章 精选 留言 我的

精选列表

搜索[个人博客],共10000篇文章
优秀的个人博客,低调大师

[雪峰磁针石博客]计算机视觉opcencv工具深度学习快速实战1人脸识别

使用OpenCV提供的预先训练的深度学习面部检测器模型,可快速,准确的进行人脸识别。 2017年8月OpenCV 3.3正式发布,带来了高改进的“深度神经网络”(dnn deep neural networks)模块。该模块支持许多深度学习框架,包括Caffe,TensorFlow和Torch / PyTorch。 基于Caffe的面部检测器在这里。 需要两组文件: 定义模型体系结构的.prototxt文件 .caffemodel文件,包含实际图层的权重 权重文件不包含在OpenCV示例目录。 OpenCV深度学习面部检测器如何工作? # 模型下载:https://itbooks.pipipan.com/fs/18113597-320346529 # 代码存放:https://github.com/china-testing/python-api-tesing/tree/master/opencv_crash_deep_learning # 技术支持qq群144081101(代码和模型存放) # USAGE # python detect_faces.py --image rooster.jpg --prototxt deploy.prototxt.txt --model res10_300x300_ssd_iter_140000.caffemodel # import the necessary packages import numpy as np import argparse import cv2 # construct the argument parse and parse the arguments ap = argparse.ArgumentParser() ap.add_argument("-i", "--image", required=True, help="path to input image") ap.add_argument("-p", "--prototxt", required=True, help="path to Caffe 'deploy' prototxt file") ap.add_argument("-m", "--model", required=True, help="path to Caffe pre-trained model") ap.add_argument("-c", "--confidence", type=float, default=0.5, help="minimum probability to filter weak detections") args = vars(ap.parse_args()) # load our serialized model from disk print("[INFO] loading model...") net = cv2.dnn.readNetFromCaffe(args["prototxt"], args["model"]) # load the input image and construct an input blob for the image # by resizing to a fixed 300x300 pixels and then normalizing it image = cv2.imread(args["image"]) (h, w) = image.shape[:2] blob = cv2.dnn.blobFromImage(cv2.resize(image, (300, 300)), 1.0, (300, 300), (104.0, 177.0, 123.0)) # pass the blob through the network and obtain the detections and # predictions print("[INFO] computing object detections...") net.setInput(blob) detections = net.forward() # loop over the detections for i in range(0, detections.shape[2]): # extract the confidence (i.e., probability) associated with the # prediction confidence = detections[0, 0, i, 2] # filter out weak detections by ensuring the `confidence` is # greater than the minimum confidence if confidence > args["confidence"]: # compute the (x, y)-coordinates of the bounding box for the # object box = detections[0, 0, i, 3:7] * np.array([w, h, w, h]) (startX, startY, endX, endY) = box.astype("int") # draw the bounding box of the face along with the associated # probability text = "{:.2f}%".format(confidence * 100) y = startY - 10 if startY - 10 > 10 else startY + 10 cv2.rectangle(image, (startX, startY), (endX, endY), (0, 0, 255), 2) cv2.putText(image, text, (startX, y), cv2.FONT_HERSHEY_SIMPLEX, 0.45, (0, 0, 255), 2) # show the output image cv2.imshow("Output", image) cv2.waitKey(0) 执行: $ python detect_faces.py --image rooster.jpg --prototxt deploy.prototxt.txt --model res10_300x300_ssd_iter_140000.caffemodel 上面的面部有74.30%的置信度。 尽管OpenCV的Haar级联因缺少“直接”角度的面孔,但通过使用OpenCV的深度学习面部探测器,依然能够测到脸部。 再来看三个面孔的示例: python detect_faces.py --image iron_chic.jpg --prototxt deploy.prototxt.txt --model res10_300x300_ssd_iter_140000.caffemodel 视频,视频流和网络摄像头应用人脸检测 # USAGE # python detect_faces_video.py --prototxt deploy.prototxt.txt --model res10_300x300_ssd_iter_140000.caffemodel # import the necessary packages from imutils.video import VideoStream import numpy as np import argparse import imutils import time import cv2 # construct the argument parse and parse the arguments ap = argparse.ArgumentParser() ap.add_argument("-p", "--prototxt", required=True, help="path to Caffe 'deploy' prototxt file") ap.add_argument("-m", "--model", required=True, help="path to Caffe pre-trained model") ap.add_argument("-c", "--confidence", type=float, default=0.5, help="minimum probability to filter weak detections") args = vars(ap.parse_args()) # load our serialized model from disk print("[INFO] loading model...") net = cv2.dnn.readNetFromCaffe(args["prototxt"], args["model"]) # initialize the video stream and allow the cammera sensor to warmup print("[INFO] starting video stream...") vs = VideoStream(src=0).start() time.sleep(2.0) # loop over the frames from the video stream while True: # grab the frame from the threaded video stream and resize it # to have a maximum width of 400 pixels frame = vs.read() frame = imutils.resize(frame, width=400) # grab the frame dimensions and convert it to a blob (h, w) = frame.shape[:2] blob = cv2.dnn.blobFromImage(cv2.resize(frame, (300, 300)), 1.0, (300, 300), (104.0, 177.0, 123.0)) # pass the blob through the network and obtain the detections and # predictions net.setInput(blob) detections = net.forward() # loop over the detections for i in range(0, detections.shape[2]): # extract the confidence (i.e., probability) associated with the # prediction confidence = detections[0, 0, i, 2] # filter out weak detections by ensuring the `confidence` is # greater than the minimum confidence if confidence < args["confidence"]: continue # compute the (x, y)-coordinates of the bounding box for the # object box = detections[0, 0, i, 3:7] * np.array([w, h, w, h]) (startX, startY, endX, endY) = box.astype("int") # draw the bounding box of the face along with the associated # probability text = "{:.2f}%".format(confidence * 100) y = startY - 10 if startY - 10 > 10 else startY + 10 cv2.rectangle(frame, (startX, startY), (endX, endY), (0, 0, 255), 2) cv2.putText(frame, text, (startX, y), cv2.FONT_HERSHEY_SIMPLEX, 0.45, (0, 0, 255), 2) # show the output frame cv2.imshow("Frame", frame) key = cv2.waitKey(1) & 0xFF # if the `q` key was pressed, break from the loop if key == ord("q"): break # do a bit of cleanup cv2.destroyAllWindows() vs.stop() 执行: python detect_faces_video.py --prototxt deploy.prototxt.txt --model res10_300x300_ssd_iter_140000.caffemodel 参考资料 本文最新版本地址 本文涉及的python测试开发库 谢谢点赞! 本文相关海量书籍下载 2018最佳人工智能机器学习工具书及下载(持续更新) 模型下载:https://itbooks.pipipan.com/fs/18113597-320346529 其他python人脸识别库介绍 python库介绍-face_recognition 人脸识别 可以命令识别人脸框。 $ face_detection --model cnn iron_chic.jpg iron_chic.jpg,79,422,243,258 iron_chic.jpg,146,272,310,108 iron_chic.jpg,194,144,330,7

优秀的个人博客,低调大师

[雪峰磁针石博客]python 3.7极速入门教程8语言比较与面试考试试题

筛选了2年内优秀的python书籍,个别经典的书籍扩展到5年内。 尽量只收集通用的书籍,专用的书籍只收集特别优秀者。 python专业书籍汇总 2018最佳人工智能图像处理工具OpenCV书籍下载 流畅的python - 2017.pdf 《流畅的Python》一书致力于帮助Python开发人员挖掘这门语言及相关程序库的优秀特性,避免重复劳动,同时写出简洁、流畅、易读、易维护,并且具有地道Python风格的代码。本书尤其深入探讨了Python语言的高级用法,涵盖数据结构、Python风格的对象、并行与并发,以及元编程等不同的方面。 海报: https://github.com/fluentpython/example-code 2000+ 星 强烈推荐 简明 Python 教程 4nd - 2018.pdf https://github.com/LenKiMo/byte-of-python 近300星 笨办法学Python 3 待上传 本书是一本Python入门书,适合对计算机了解不多,没有学过编程,但对编程感兴趣的读者学习使用。这本书以习题的方式引导读者一步一步学习编程,从简单的打印一直讲到完整项目的实现,让初学者从基础的编程技术入手,最终体验到软件开发的基本过程。本书是基于Python 3.6版本编写的。 本书结构非常简单,除“准备工作”之外,还包括52个习题,其中26个覆盖了输入/输出、变量和函数3个主题,另外26个覆盖了一些比较进阶的话题,如条件判断、循环、类和对象、代码测试及项目的实现等。每一章的格式基本相同,以代码习题开始,按照说明编写代码,运行并检查结果,然后再做附加练习。 Python基础教程(第3版) - 2017.pdf 本书包括Python程序设计的方方面面:首先从Python的安装开始,随后介绍了Python的基础知识和基本概念,包括列表、元组、字符串、字典以及各种语句;然后循序渐进地介绍了一些相对高级的主题,包括抽象、异常、魔法方法、属性、迭代器;此后探讨了如何将Python与数据库、网络、C语言等工具结合使用,从而发挥出Python的强大功能,同时介绍了Python程序测试、打包、发布等知识;最后,作者结合前面讲述的内容,按照实际项目开发的步骤向读者介绍了10个具有实际意义的Python项目的开发过程。 海报: Python基础教程(第3版) - 2018 Beginning Python: From Novice to Professional - 2017 https://github.com/Apress/beginning-python-3ed 100左右星 《Python Cookbook》第三版中文.pdf 《Python Cookbook(第3版)中文版》介绍了Python应用在各个领域中的一些使用技巧和方法,其主题涵盖了数据结构和算法,字符串和文本,数字、日期和时间,迭代器和生成器,文件和I/O,数据编码与处理,函数,类与对象,元编程,模块和包,网络和Web编程,并发,实用脚本和系统管理,测试、调试以及异常,C语言扩展等。本书覆盖了Python应用中的很多常见问题,并提出了通用的解决方案。书中包含了大量实用的编程技巧和示例代码,并在Python 3.3环境下进行了测试,可以很方便地应用到实际项目中去。此外,《Python Cookbook(第3版)中文版》还详细讲解了解决方案是如何工作的,以及为什么能够工作。 《Python Cookbook(第3版)中文版》非常适合具有一定编程基础的Python程序员阅读参考。 Python Cookbook(第3版)(中文版) - 2015 Python Cookbook, 3rd Edition - 2013 https://github.com/dabeaz/python-cookbook 2000左右星 参考资料 讨论qq群144081101 591302926 567351477 钉钉免费群21745728 本文最新版本地址 本文涉及的python测试开发库 谢谢点赞! 本文相关海量书籍下载 像计算机科学家一样思考Python(下载待上传) 本书以培养读者以计算机科学家一样的思维方式来理解Python语言编程。贯穿全书的主体是如何思考、设计、开发的方法,而具体的编程语言,只是提供了一个具体场景方便介绍的媒介。 全书共21章,详细介绍Python语言编程的方方面面。本书从基本的编程概念开始讲起,包括语言的语法和语义,而且每个编程概念都有清晰的定义,引 领读者循序渐进地学习变量、表达式、语句、函数和数据结构。书中还探讨了如何处理文件和数据库,如何理解对象、方法和面向对象编程,如何使用调试技巧来修正语法错误、运行时错误和语义错误。每一章都配有术语表和练习题,方便读者巩固所学的知识和技巧。此外,每一章都抽出一节来讲解如何调试程序。作者针对每章所专注的语言特性,或者相关的开发问题,总结了调试的方方面面。 本书的第 2版与第 1版相比,做了很多更新,将编程语言从Python 2升级成Python 3,并修改了很多示例和练习,增加了新的章节,更全面地介绍Python语言。 这是一本实用的学习指南,适合没有Python编程经验的程序员阅读,也适合高中或大学的学生、Python爱好者及需要了解编程基础的人阅读。对于首 次接触程序设计的人来说,是一本不可多 得的佳作。 Selenium自动化测试 基于 Python 语言 - 2018.pdf https://github.com/upgundecha/learnsewithpython 星级 低于100 Selenium是一个主要用于Web应用程序自动化测试的工具集合,在行业内已经得到广泛的应用。本书介绍了如何用Python语言调用Selenium WebDriver接口进行自动化测试。主要内容为:基于Python 的 Selenium WebDriver 入门知识、Selenium Python脚本、使用unittest 编写单元测试、生成HTML格式的测试报告、元素定位、Selenium Python API 介绍、元素等待机制、跨浏览器测试、移动端测试、编写一个iOS测试脚本、编写一个Android测试脚本、Page Object与数据驱动测试、Selenium WebDriver的特性、第三方工具与框架集成等核心技术。 《Selenium自动化测试 基于Python语言》适合任何软件测试人员阅读,也适合作为大专院校师生的学习用书和培训学校的教材。 -- 本书虽然为2018年翻译,但是实际基于selenium2和python2,已经过时,很多实例已经不能运行。阅读时可参考 selenium自动化测试工具python笔试面试项目实战5键盘操作,尽管有点过时,依旧是selenium书籍中的佳品。 对应的英文版:Learning Selenium Testing Tools with Python - 2014.pdf Python网络数据采集 Python网络数据采集 - 2016.pdf 本书采用简洁强大的Python语言,介绍了网络数据采集,并为采集新式网络中的各种数据类型提供了全面的指导。第 1部分重点介绍网络数据采集的基本原理:如何用Python从网络服务器请求信息,如何对服务器的响应进行基本处理,以及如何以自动化手段与网站进行交互。第 二部分介绍如何用网络爬虫测试网站,自动化处理,以及如何通过更多的方式接入网络。 Web Scraping with Python 2nd - 2018.pdf https://github.com/REMitchell/python-scraping 2000左右星 其他书籍 Head First Python 2nd 暂时没找到文字的电子书

优秀的个人博客,低调大师

[雪峰磁针石博客]selenium自动化测试工具python笔试面试项目实战5键盘操作

说明 本文参考答案基于Chrome,分辨率1920*1080,在其他环境表现可能会不同。本文代码地址 参考书籍下载: Learning Selenium Testing Tools with Python-2014.pdf Selenium自动化测试 基于 Python 语言 - 2018.pdf 上机实操: 在新的TAB打开连接 打开:https://china-testing.github.io/ 选择"数据分析"栏目的文章 按住"Ctrl+TAB"选择"python"栏目的文章 切换到新的标签"python" 关闭新的标签"python" 关闭浏览器 参考答案 #!/usr/bin/python3 # -*- coding: utf-8 -*- # 讨论钉钉免费群21745728 qq群144081101 567351477 # CreateDate: 2018-10-17 import time from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.keys import Keys driver = webdriver.Chrome() driver.get("https://china-testing.github.io/") driver.implicitly_wait(30) driver.maximize_window() element = driver.find_element_by_link_text('数据分析') element.click() time.sleep(3) element = driver.find_element_by_link_text('python') ActionChains(driver).key_down(Keys.CONTROL).click(element).key_up( Keys.CONTROL).perform() time.sleep(3) driver.switch_to.window(driver.window_handles[1]) time.sleep(3) driver.close() # 关闭当前TAB time.sleep(3) driver.quit() 面试问答 driver.quit() 和 driver.close()有什么区别? 2.selenium中按下和松开键如何表示? 3.简述ActionChains类的作用? 上机实操: 验证悬浮提示内容 打开:http://jqueryui.com/tooltip/ 鼠标移动到上图的"Your age:" 确认悬浮提示内容为'We ask for your age only for statistical purposes.' 关闭浏览器 参考答案 #!/usr/bin/python3 # -*- coding: utf-8 -*- # 讨论钉钉免费群21745728 qq群144081101 567351477 # CreateDate: 2018-10-17 import unittest import time from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions from selenium.webdriver.common.action_chains import ActionChains class ToolTipTest (unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome() self.driver.get("http://jqueryui.com/tooltip/") self.driver.implicitly_wait(30) self.driver.maximize_window() def test_tool_tip(self): driver = self.driver frame_elm = driver.find_element_by_class_name('demo-frame') driver.switch_to.frame(frame_elm) time.sleep(3) age_field = driver.find_element_by_id('age') ActionChains(self.driver).move_to_element(age_field).perform() time.sleep(3) tool_tip_elm = WebDriverWait(self.driver, 10).until( expected_conditions.visibility_of_element_located(( By.CLASS_NAME, 'ui-tooltip-content'))) # verify tooltip message self.assertEqual('We ask for your age only for statistical purposes.', tool_tip_elm.text) time.sleep(3) def tearDown(self): self.driver.close() if __name__ == '__main__': unittest.main(verbosity=2) 面试问答 1.move_to_element()有什么用途? 上机实操: 双击改变颜色 打开:http://api.jquery.com/dblclick/ 双击上图蓝色的框,把颜色该变成黄色 参考答案 #!/usr/bin/python3 # -*- coding: utf-8 -*- # 讨论钉钉免费群21745728 qq群144081101 567351477 # CreateDate: 2018-10-18 from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains import unittest class DoubleClickTest (unittest.TestCase): URL = 'http://api.jquery.com/dblclick/' def setUp(self): self.driver = webdriver.Chrome() self.driver.get(self.URL) self.driver.maximize_window() def test_double_click(self): driver = self.driver frame = driver.find_element_by_tag_name('iframe') driver.switch_to.frame(frame) box = driver.find_element_by_tag_name('div') # verify color is Blue self.assertEqual('rgba(0, 0, 255, 1)', box.value_of_css_property('background-color')) ActionChains(driver).move_to_element( driver.find_element_by_tag_name('body')).perform() ActionChains(driver).double_click(box).perform() # verify Color is Yellow self.assertEqual('rgba(255, 255, 0, 1)', box.value_of_css_property('background-color')) def tearDown(self): self.driver.close() if __name__ == '__main__': unittest.main(verbosity=2) 面试问答 1.double_click()有什么用途? 2.rgba的含义? 上机实操: 在新的TAB打开连接 打开:http://jqueryui.com/resources/demos/droppable/default.html 拖动左边的框到右边 参考答案 #!/usr/bin/python3 # -*- coding: utf-8 -*- # 讨论钉钉免费群21745728 qq群144081101 567351477 # CreateDate: 2018-10-18 from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains import unittest class DragAndDropTest (unittest.TestCase): URL = 'http://jqueryui.com/resources/demos/droppable/default.html' def setUp(self) : self.driver = webdriver.Chrome() self.driver.get(self.URL) self.driver.maximize_window() def test_drag_and_drop(self): driver = self.driver source = driver.find_element_by_id('draggable') target = driver.find_element_by_id('droppable') ActionChains(self.driver).drag_and_drop(source, target).perform() self.assertEqual('Dropped!', target.text) def tearDown(self): self.driver.close() if __name__ == '__main__': unittest.main(verbosity=2) 面试问答 1.drag_and_drop()有什么用途? 参考资料 讨论 钉钉群21745728 qq群144081101 567351477 本文最新版本地址 本文涉及的python测试开发库 谢谢点赞! 本文相关海量书籍下载

优秀的个人博客,低调大师

[雪峰磁针石博客]python opencv3实例(对象识别和增强现实)1-图像几何转换

原书代码地址 在本章中,我们将学习如何应用酷的几何效果到图像。 知识点 如何安装OpenCV-Python 如何读取,显示和保存图像 如何转换到多个颜色空间 如何应用几何变换,例如平移,旋转,和缩放 如何使用仿射和投影变换来应用几何效果 本书英文版本:OpenCV 3.x with Python By Example 2nd 2018.pdf 更多opencv相关书籍:最佳人工智能图像处理工具OpenCV书籍下载 安装OpenCV-Python 安装 本教程基于python3,ubuntu 16,在windows环境可能可以运行。 Linux #!python pip3 install opencv-python Windows #!python pip install opencv-python 文档: [官网](http://docs.opencv.org/) [opencv-python官方文档](http://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_tutorials.html) 读取显示和保存图片 01_reading_image.py 读取显示图片 import cv2 img = cv2.imread('./images/input.jpg') cv2.imshow('Input image', img) cv2.waitKey() 02_saving_image.py 保存为灰度图 import cv2 gray_img = cv2.imread('images/input.jpg', cv2.IMREAD_GRAYSCALE) cv2.imshow('Grayscale', gray_img) cv2.imwrite('images/output.jpg', gray_img) cv2.waitKey() 转换格式 03_convert_image_format.py In [1]: import cv2 In [2]: print([x for x in dir(cv2) if x.startswith('COLOR_')]) ['COLOR_BAYER_BG2BGR', 'COLOR_BAYER_BG2BGRA', 'COLOR_BAYER_BG2BGR_EA', 'COLOR_BAYER_BG2BGR_VNG', 'COLOR_BAYER_BG2GRAY', 'COLOR_BAYER_BG2RGB', 'COLOR_BAYER_BG2RGBA', 'COLOR_BAYER_BG2RGB_EA', 'COLOR_BAYER_BG2RGB_VNG', 'COLOR_BAYER_GB2BGR', 'COLOR_BAYER_GB2BGRA', 'COLOR_BAYER_GB2BGR_EA', 'COLOR_BAYER_GB2BGR_VNG', 'COLOR_BAYER_GB2GRAY', 'COLOR_BAYER_GB2RGB', 'COLOR_BAYER_GB2RGBA', 'COLOR_BAYER_GB2RGB_EA', 'COLOR_BAYER_GB2RGB_VNG', 'COLOR_BAYER_GR2BGR', 'COLOR_BAYER_GR2BGRA', 'COLOR_BAYER_GR2BGR_EA', 'COLOR_BAYER_GR2BGR_VNG', 'COLOR_BAYER_GR2GRAY', 'COLOR_BAYER_GR2RGB', 'COLOR_BAYER_GR2RGBA', 'COLOR_BAYER_GR2RGB_EA', 'COLOR_BAYER_GR2RGB_VNG', 'COLOR_BAYER_RG2BGR', 'COLOR_BAYER_RG2BGRA', 'COLOR_BAYER_RG2BGR_EA', 'COLOR_BAYER_RG2BGR_VNG', 'COLOR_BAYER_RG2GRAY', 'COLOR_BAYER_RG2RGB', 'COLOR_BAYER_RG2RGBA', 'COLOR_BAYER_RG2RGB_EA', 'COLOR_BAYER_RG2RGB_VNG', 'COLOR_BGR2BGR555', 'COLOR_BGR2BGR565', 'COLOR_BGR2BGRA', 'COLOR_BGR2GRAY', 'COLOR_BGR2HLS', 'COLOR_BGR2HLS_FULL', 'COLOR_BGR2HSV', 'COLOR_BGR2HSV_FULL', 'COLOR_BGR2LAB', 'COLOR_BGR2LUV', 'COLOR_BGR2Lab', 'COLOR_BGR2Luv', 'COLOR_BGR2RGB', 'COLOR_BGR2RGBA', 'COLOR_BGR2XYZ', 'COLOR_BGR2YCR_CB', 'COLOR_BGR2YCrCb', 'COLOR_BGR2YUV', 'COLOR_BGR2YUV_I420', 'COLOR_BGR2YUV_IYUV', 'COLOR_BGR2YUV_YV12', 'COLOR_BGR5552BGR', 'COLOR_BGR5552BGRA', 'COLOR_BGR5552GRAY', 'COLOR_BGR5552RGB', 'COLOR_BGR5552RGBA', 'COLOR_BGR5652BGR', 'COLOR_BGR5652BGRA', 'COLOR_BGR5652GRAY', 'COLOR_BGR5652RGB', 'COLOR_BGR5652RGBA', 'COLOR_BGRA2BGR', 'COLOR_BGRA2BGR555', 'COLOR_BGRA2BGR565', 'COLOR_BGRA2GRAY', 'COLOR_BGRA2RGB', 'COLOR_BGRA2RGBA', 'COLOR_BGRA2YUV_I420', 'COLOR_BGRA2YUV_IYUV', 'COLOR_BGRA2YUV_YV12', 'COLOR_BayerBG2BGR', 'COLOR_BayerBG2BGRA', 'COLOR_BayerBG2BGR_EA', 'COLOR_BayerBG2BGR_VNG', 'COLOR_BayerBG2GRAY', 'COLOR_BayerBG2RGB', 'COLOR_BayerBG2RGBA', 'COLOR_BayerBG2RGB_EA', 'COLOR_BayerBG2RGB_VNG', 'COLOR_BayerGB2BGR', 'COLOR_BayerGB2BGRA', 'COLOR_BayerGB2BGR_EA', 'COLOR_BayerGB2BGR_VNG', 'COLOR_BayerGB2GRAY', 'COLOR_BayerGB2RGB', 'COLOR_BayerGB2RGBA', 'COLOR_BayerGB2RGB_EA', 'COLOR_BayerGB2RGB_VNG', 'COLOR_BayerGR2BGR', 'COLOR_BayerGR2BGRA', 'COLOR_BayerGR2BGR_EA', 'COLOR_BayerGR2BGR_VNG', 'COLOR_BayerGR2GRAY', 'COLOR_BayerGR2RGB', 'COLOR_BayerGR2RGBA', 'COLOR_BayerGR2RGB_EA', 'COLOR_BayerGR2RGB_VNG', 'COLOR_BayerRG2BGR', 'COLOR_BayerRG2BGRA', 'COLOR_BayerRG2BGR_EA', 'COLOR_BayerRG2BGR_VNG', 'COLOR_BayerRG2GRAY', 'COLOR_BayerRG2RGB', 'COLOR_BayerRG2RGBA', 'COLOR_BayerRG2RGB_EA', 'COLOR_BayerRG2RGB_VNG', 'COLOR_COLORCVT_MAX', 'COLOR_GRAY2BGR', 'COLOR_GRAY2BGR555', 'COLOR_GRAY2BGR565', 'COLOR_GRAY2BGRA', 'COLOR_GRAY2RGB', 'COLOR_GRAY2RGBA', 'COLOR_HLS2BGR', 'COLOR_HLS2BGR_FULL', 'COLOR_HLS2RGB', 'COLOR_HLS2RGB_FULL', 'COLOR_HSV2BGR', 'COLOR_HSV2BGR_FULL', 'COLOR_HSV2RGB', 'COLOR_HSV2RGB_FULL', 'COLOR_LAB2BGR', 'COLOR_LAB2LBGR', 'COLOR_LAB2LRGB', 'COLOR_LAB2RGB', 'COLOR_LBGR2LAB', 'COLOR_LBGR2LUV', 'COLOR_LBGR2Lab', 'COLOR_LBGR2Luv', 'COLOR_LRGB2LAB', 'COLOR_LRGB2LUV', 'COLOR_LRGB2Lab', 'COLOR_LRGB2Luv', 'COLOR_LUV2BGR', 'COLOR_LUV2LBGR', 'COLOR_LUV2LRGB', 'COLOR_LUV2RGB', 'COLOR_Lab2BGR', 'COLOR_Lab2LBGR', 'COLOR_Lab2LRGB', 'COLOR_Lab2RGB', 'COLOR_Luv2BGR', 'COLOR_Luv2LBGR', 'COLOR_Luv2LRGB', 'COLOR_Luv2RGB', 'COLOR_M_RGBA2RGBA', 'COLOR_RGB2BGR', 'COLOR_RGB2BGR555', 'COLOR_RGB2BGR565', 'COLOR_RGB2BGRA', 'COLOR_RGB2GRAY', 'COLOR_RGB2HLS', 'COLOR_RGB2HLS_FULL', 'COLOR_RGB2HSV', 'COLOR_RGB2HSV_FULL', 'COLOR_RGB2LAB', 'COLOR_RGB2LUV', 'COLOR_RGB2Lab', 'COLOR_RGB2Luv', 'COLOR_RGB2RGBA', 'COLOR_RGB2XYZ', 'COLOR_RGB2YCR_CB', 'COLOR_RGB2YCrCb', 'COLOR_RGB2YUV', 'COLOR_RGB2YUV_I420', 'COLOR_RGB2YUV_IYUV', 'COLOR_RGB2YUV_YV12', 'COLOR_RGBA2BGR', 'COLOR_RGBA2BGR555', 'COLOR_RGBA2BGR565', 'COLOR_RGBA2BGRA', 'COLOR_RGBA2GRAY', 'COLOR_RGBA2M_RGBA', 'COLOR_RGBA2RGB', 'COLOR_RGBA2YUV_I420', 'COLOR_RGBA2YUV_IYUV', 'COLOR_RGBA2YUV_YV12', 'COLOR_RGBA2mRGBA', 'COLOR_XYZ2BGR', 'COLOR_XYZ2RGB', 'COLOR_YCR_CB2BGR', 'COLOR_YCR_CB2RGB', 'COLOR_YCrCb2BGR', 'COLOR_YCrCb2RGB', 'COLOR_YUV2BGR', 'COLOR_YUV2BGRA_I420', 'COLOR_YUV2BGRA_IYUV', 'COLOR_YUV2BGRA_NV12', 'COLOR_YUV2BGRA_NV21', 'COLOR_YUV2BGRA_UYNV', 'COLOR_YUV2BGRA_UYVY', 'COLOR_YUV2BGRA_Y422', 'COLOR_YUV2BGRA_YUNV', 'COLOR_YUV2BGRA_YUY2', 'COLOR_YUV2BGRA_YUYV', 'COLOR_YUV2BGRA_YV12', 'COLOR_YUV2BGRA_YVYU', 'COLOR_YUV2BGR_I420', 'COLOR_YUV2BGR_IYUV', 'COLOR_YUV2BGR_NV12', 'COLOR_YUV2BGR_NV21', 'COLOR_YUV2BGR_UYNV', 'COLOR_YUV2BGR_UYVY', 'COLOR_YUV2BGR_Y422', 'COLOR_YUV2BGR_YUNV', 'COLOR_YUV2BGR_YUY2', 'COLOR_YUV2BGR_YUYV', 'COLOR_YUV2BGR_YV12', 'COLOR_YUV2BGR_YVYU', 'COLOR_YUV2GRAY_420', 'COLOR_YUV2GRAY_I420', 'COLOR_YUV2GRAY_IYUV', 'COLOR_YUV2GRAY_NV12', 'COLOR_YUV2GRAY_NV21', 'COLOR_YUV2GRAY_UYNV', 'COLOR_YUV2GRAY_UYVY', 'COLOR_YUV2GRAY_Y422', 'COLOR_YUV2GRAY_YUNV', 'COLOR_YUV2GRAY_YUY2', 'COLOR_YUV2GRAY_YUYV', 'COLOR_YUV2GRAY_YV12', 'COLOR_YUV2GRAY_YVYU', 'COLOR_YUV2RGB', 'COLOR_YUV2RGBA_I420', 'COLOR_YUV2RGBA_IYUV', 'COLOR_YUV2RGBA_NV12', 'COLOR_YUV2RGBA_NV21', 'COLOR_YUV2RGBA_UYNV', 'COLOR_YUV2RGBA_UYVY', 'COLOR_YUV2RGBA_Y422', 'COLOR_YUV2RGBA_YUNV', 'COLOR_YUV2RGBA_YUY2', 'COLOR_YUV2RGBA_YUYV', 'COLOR_YUV2RGBA_YV12', 'COLOR_YUV2RGBA_YVYU', 'COLOR_YUV2RGB_I420', 'COLOR_YUV2RGB_IYUV', 'COLOR_YUV2RGB_NV12', 'COLOR_YUV2RGB_NV21', 'COLOR_YUV2RGB_UYNV', 'COLOR_YUV2RGB_UYVY', 'COLOR_YUV2RGB_Y422', 'COLOR_YUV2RGB_YUNV', 'COLOR_YUV2RGB_YUY2', 'COLOR_YUV2RGB_YUYV', 'COLOR_YUV2RGB_YV12', 'COLOR_YUV2RGB_YVYU', 'COLOR_YUV420P2BGR', 'COLOR_YUV420P2BGRA', 'COLOR_YUV420P2GRAY', 'COLOR_YUV420P2RGB', 'COLOR_YUV420P2RGBA', 'COLOR_YUV420SP2BGR', 'COLOR_YUV420SP2BGRA', 'COLOR_YUV420SP2GRAY', 'COLOR_YUV420SP2RGB', 'COLOR_YUV420SP2RGBA', 'COLOR_YUV420p2BGR', 'COLOR_YUV420p2BGRA', 'COLOR_YUV420p2GRAY', 'COLOR_YUV420p2RGB', 'COLOR_YUV420p2RGBA', 'COLOR_YUV420sp2BGR', 'COLOR_YUV420sp2BGRA', 'COLOR_YUV420sp2GRAY', 'COLOR_YUV420sp2RGB', 'COLOR_YUV420sp2RGBA', 'COLOR_mRGBA2RGBA'] 04_image_color_split.py import cv2 img = cv2.imread('./images/input.jpg', cv2.IMREAD_COLOR) gray_img = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY) yuv_img = cv2.cvtColor(img, cv2.COLOR_BGR2YUV) y,u,v = cv2.split(yuv_img) cv2.imshow('Grayscale image', gray_img) cv2.imshow('Y channel', y) cv2.imshow('U channel', u) cv2.imshow('V channel', v) cv2.waitKey() 合并图像色带 05_image_color_merge.py import cv2 img = cv2.imread('./images/input.jpg', cv2.IMREAD_COLOR) g,b,r = cv2.split(img) gbr_img = cv2.merge((g,b,r)) rbr_img = cv2.merge((r,b,r)) cv2.imshow('Original', img) cv2.imshow('GRB', gbr_img) cv2.imshow('RBR', rbr_img) cv2.waitKey() 移动translation 06_image_translation.py import cv2 import numpy as np img = cv2.imread('images/input.jpg') num_rows, num_cols = img.shape[:2] translation_matrix = np.float32([ [1,0,70], [0,1,110] ]) img_translation = cv2.warpAffine(img, translation_matrix, (num_cols + 70, num_rows + 110)) translation_matrix = np.float32([ [1,0,-30], [0,1,-50] ]) img_translation = cv2.warpAffine(img_translation, translation_matrix, (num_cols + 70 + 30, num_rows + 110 + 50)) cv2.imshow('Translation', img_translation) cv2.waitKey() 旋转 07_image_rotation.py import cv2 import numpy as np img = cv2.imread('images/input.jpg') num_rows, num_cols = img.shape[:2] translation_matrix = np.float32([ [1,0,70], [0,1,110] ]) img_translation = cv2.warpAffine(img, translation_matrix, (num_cols + 70, num_rows + 110)) translation_matrix = np.float32([ [1,0,-30], [0,1,-50] ]) img_translation = cv2.warpAffine(img_translation, translation_matrix, (num_cols + 70 + 30, num_rows + 110 + 50)) cv2.imshow('Translation', img_translation) cv2.waitKey() 缩放 08_image_scaling.py import cv2 img = cv2.imread('images/input.jpg') img_scaled = cv2.resize(img,None,fx=1.2, fy=1.2, interpolation = cv2.INTER_LINEAR) cv2.imshow('Scaling - Linear Interpolation', img_scaled) img_scaled = cv2.resize(img,None,fx=1.2, fy=1.2, interpolation = cv2.INTER_CUBIC) cv2.imshow('Scaling - Cubic Interpolation', img_scaled) img_scaled = cv2.resize(img,(450, 400), interpolation = cv2.INTER_AREA) cv2.imshow('Scaling - Skewed Size', img_scaled) cv2.waitKey() 仿射变换 09_affine_transformation.py import cv2 import numpy as np img = cv2.imread('images/input.jpg') rows, cols = img.shape[:2] src_points = np.float32([[0,0], [cols-1,0], [0,rows-1]]) dst_points = np.float32([[0,0], [int(0.6*(cols-1)),0], [int(0.4*(cols-1)),rows-1]]) affine_matrix = cv2.getAffineTransform(src_points, dst_points) img_output = cv2.warpAffine(img, affine_matrix, (cols,rows)) cv2.imshow('Input', img) cv2.imshow('Output', img_output) cv2.waitKey() 射影变换 10_projective_transformation.py import cv2 import numpy as np img = cv2.imread('images/input.jpg') rows, cols = img.shape[:2] src_points = np.float32([[0,0], [cols-1,0], [0,rows-1], [cols-1,rows-1]]) dst_points = np.float32([[0,0], [cols-1,0], [int(0.33*cols),rows-1], [int(0.66*cols),rows-1]]) projective_matrix = cv2.getPerspectiveTransform(src_points, dst_points) img_output = cv2.warpPerspective(img, projective_matrix, (cols,rows)) cv2.imshow('Input', img) cv2.imshow('Output', img_output) cv2.waitKey() 图像变形 11_image_warping.py import numpy as np import math img = cv2.imread('images/input.jpg', cv2.IMREAD_GRAYSCALE) rows, cols = img.shape ##################### # Vertical wave img_output = np.zeros(img.shape, dtype=img.dtype) for i in range(rows): for j in range(cols): offset_x = int(25.0 * math.sin(2 * 3.14 * i / 180)) offset_y = 0 if j+offset_x < rows: img_output[i,j] = img[i,(j+offset_x)%cols] else: img_output[i,j] = 0 cv2.imshow('Input', img) cv2.imshow('Vertical wave', img_output) ##################### # Horizontal wave img_output = np.zeros(img.shape, dtype=img.dtype) for i in range(rows): for j in range(cols): offset_x = 0 offset_y = int(16.0 * math.sin(2 * 3.14 * j / 150)) if i+offset_y < rows: img_output[i,j] = img[(i+offset_y)%rows,j] else: img_output[i,j] = 0 cv2.imshow('Horizontal wave', img_output) ##################### # Both horizontal and vertical img_output = np.zeros(img.shape, dtype=img.dtype) for i in range(rows): for j in range(cols): offset_x = int(20.0 * math.sin(2 * 3.14 * i / 150)) offset_y = int(20.0 * math.cos(2 * 3.14 * j / 150)) if i+offset_y < rows and j+offset_x < cols: img_output[i,j] = img[(i+offset_y)%rows,(j+offset_x)%cols] else: img_output[i,j] = 0 cv2.imshow('Multidirectional wave', img_output) ##################### # Concave effect img_output = np.zeros(img.shape, dtype=img.dtype) for i in range(rows): for j in range(cols): offset_x = int(128.0 * math.sin(2 * 3.14 * i / (2*cols))) offset_y = 0 if j+offset_x < cols: img_output[i,j] = img[i,(j+offset_x)%cols] else: img_output[i,j] = 0 cv2.imshow('Concave', img_output) cv2.waitKey() 参考资料 讨论qq群144081101 591302926 567351477 钉钉免费群21745728 本文最新版本地址 本文涉及的python测试开发库 谢谢点赞! 本文相关海量书籍下载

优秀的个人博客,低调大师

[雪峰磁针石博客]python库介绍-图像处理工具pillow中文文档-手册(2018 5.*)

概述 Python Imaging Library给Python解释器增加了图像处理能力。 该库提供了广泛的文件格式支持,高效的内部展现,以及十分强大的图像处理能力。 核心图像库专为以几种存储为基本像素格式数据的快速访问而设计。它为通用图像处理工具提供了坚实的基础。 我们来看看这个库的用途。 图像存储 PIL适合图像归档和图像批量处理,你可以使用它建立缩略图,转换格式,打印图片等。 现在的版本可以识别和读取大量的图片格式,写入常用的转换和表示格式。 图像显示 当前版本包含了Tk PhotoImage和BitmapImage接口, 以及Windows DIB interface ,可以在PythonWin和其他基于Windows的工具包中使用。许多其他GUI工具包带有某种类型的PIL支持。 为了方便调试还提供了show()方法,可以保存图像到磁盘并调用外显示。它将图像保存到磁盘,并调用外部显示工具。 图像处理 这个库包含了基本的图像处理功能,包括点操作,使用内置卷积内核过滤,色彩空间转换。 这个库还支持更改图像大小、旋转、任意仿射变换。 直方图方法允许你统计图像,这可以用于对比度增强和全局统计分析。 教程 使用 Image 类 PIL最重要的类是Image, 你可以通过多种方法创建这个类的实例,比如从文件加载图像,或者处理其他图像, 或者从或从头开始创建图像。 要从文件加载图像,请使用:Image模块中的open函数: >>> from PIL import Image >>> im = Image.open("hopper.ppm") 如果成功,这个函数返回Image对象。 您现在可以使用实例属性来检查文件内容: >>> print(im.format, im.size, im.mode) PPM (512, 512) RGB format属为图像来源。如果不是从文件读取就是None。size属性是包含宽度和高度(像素)的二元组)。模式属性定义了图像中波段的数量和名称,以及像素类型和深度。 常见模式为灰度图像为“L”(亮度),真彩色图像为“RGB”,印刷四色为“CMYK”。 如果文件无法打开,则会引发IOError异常。 获得了Image类的实例,就可以使用此类定义的方法来处理和操作图像。 例如让我们显示刚刚加载的图像: >>> im.show() 注意 show的标准版本效率不高,因为它将图像保存到临时文件并调用xv工具显示图像。 如果你没有安装xv,它甚至不会工作。 它对于调试和测试非常方便。 下面实例把上述步骤给串起来 pillow_read.py from PIL import Image im = Image.open("demo.jpg") print(im.format, im.size, im.mode) im.show() 代码地址 以下各节概述了此库中提供的不同功能。 参考资料 讨论qq群144081101 591302926 567351477 钉钉免费群21745728 本文相关书籍下载 本文涉及的python测试开发库 谢谢点赞! 英文参考 本文最新版本) 代码地址 读写图像 PIL库支持大量图片格式。使用Image模块的open()函数从磁盘读取文件。你不需要知道文件格式就能打开它,PIL能够根据文件内容自动确定确定文件格式。 要保存文件,使用Image类的save()方法。保存文件的时候文件名变得重要了。除非你指定格式,PIL将会以文件名的扩展名作为格式保存。 转换文件为JPEG import os, sys from PIL import Image for infile in sys.argv[1:]: f, e = os.path.splitext(infile) outfile = f + ".jpg" if infile != outfile: try: Image.open(infile).save(outfile) except IOError: print("cannot convert", infile) save()方法的第二个参数可以指定文件格式,如果你使用非标准的扩展名你必须这样做。 创建 JPEG 缩略图 import os, sys from PIL import Image size = (128, 128) for infile in sys.argv[1:]: outfile = os.path.splitext(infile)[0] + ".thumbnail" if infile != outfile: try: im = Image.open(infile) im.thumbnail(size) im.save(outfile, "JPEG") except IOError: print("cannot create thumbnail for", infile) 需要注意的是,除非真的需要,否则库不会解码或加载栅格数据。打开文件时,会读取文件头以确定文件格式并提取解码文件所需的模式,大小和其他属性,但文件的其余部分在稍后才能处理。 这意味着打开图像文件是快速操作,和文件大小和压缩类型无关。比如快速识别图像文件: import sys from PIL import Image for infile in sys.argv[1:]: try: with Image.open(infile) as im: print(infile, im.format, "%dx%d" % im.size, im.mode) except IOError: pass 剪切,粘贴,合并图像 Image类包含允许您操作图像内区域的方法。要从图像中提取子矩形,请使用crop()方法。 复制图像中的子矩形 box = (100, 100, 400, 400) region = im.crop(box) 该区域由四元组定义,其中坐标是(左,上,右,下)。 PIL使用左上角为 (0, 0) 的坐标系。另请注意,坐标是指像素之间的位置,因此上例中的区域恰好为300x300像素。 现在可以以某种方式处理该区域并粘贴回来。 处理子矩形并粘贴回来 region = region.transpose(Image.ROTATE_180) im.paste(region, box) 当粘贴区域时,区域的大小必须完全匹配。但是模式不需要匹配。模式不匹配时会在粘贴之前自动转换。 滚动图像 def roll(image, delta): """Roll an image sideways.""" xsize, ysize = image.size delta = delta % xsize if delta == 0: return image part1 = image.crop((0, 0, delta, ysize)) part2 = image.crop((delta, 0, xsize, ysize)) part1.load() part2.load() image.paste(part2, (0, 0, xsize-delta, ysize)) image.paste(part1, (xsize-delta, 0, xsize, ysize)) return image 调用示例: pillow_roll.py from PIL import Image def roll(image, delta): """Roll an image sideways.""" xsize, ysize = image.size delta = delta % xsize if delta == 0: return image part1 = image.crop((0, 0, delta, ysize)) part2 = image.crop((delta, 0, xsize, ysize)) part1.load() part2.load() image.paste(part2, (0, 0, xsize-delta, ysize)) image.paste(part1, (xsize-delta, 0, xsize, ysize)) return image im = Image.open("demo.jpg") im = roll(im,100) im.show() [代码地址]https://github.com/china-testing/python-api-tesing/tree/master/python3_libraries/pillow) 请注意粘贴时首先调用crop(),如果未调用则在paste命令中使用图像之前,不会执行裁剪操作。这意味着part1会从第一次粘贴已经修改的图像版本中剪切掉。 粘贴方法也可以将透明度掩码作为可选参数。在此掩码中,值255表示粘贴的图像在该位置不透明(即按原样使用粘贴的图像)。值0表示粘贴的图像是完全透明的。中间值表示不同级别的透明度。例如,粘贴RGBA图像并将其用作蒙版将粘贴图像的不透明部分,但不粘贴透明背景。 PIL还允许您使用多波段图像的各个波段,例如RGB图像。拆分方法会创建新图像,每个图像都包含原始多波段图像中的一个波段。合并功能采用模式和图像元组,并将它们组合成新图像。以下示例交换RGB图像的三个波段: 分割和合并色带 r, g, b = im.split() im = Image.merge("RGB", (b, g, r)) 注意,对于单波段图像,split()会返回图像本身。要使用单独的色带,可能首先要将图像转换为“RGB”。 几何变换 PIL.Image.Image类包含调整resize()和rotate()图像的方法。前者需要给出尺寸的元组,后者是逆时针方向的角度。 简单的几何变换 out = im.resize((128, 128)) out = im.rotate(45) # degrees counter-clockwise 要以90度的步幅旋转图像,您可以使用rotate()方法或transpose()方法。后者也可用于翻转水平或垂直轴周围的图像。 转置图像 out = im.transpose(Image.FLIP_LEFT_RIGHT) out = im.transpose(Image.FLIP_TOP_BOTTOM) out = im.transpose(Image.ROTATE_90) out = im.transpose(Image.ROTATE_180) out = im.transpose(Image.ROTATE_270) 如果expand标志为真,transpose(ROTATE)操作也可以与rotate()操作完全相同,以提供与图像大小相同的更改。 可以通transform()方法执行更常用的图像转换。 示例: #!/usr/bin/python3 # -*- coding: utf-8 -*- # Author: xurongzhong#126.com 技术支持qq群:6089740 # CreateDate: 2018-3-27 # rotate.py import glob import os from PIL import Image def rotate(files, dst, value=90): for file_ in files: img = Image.open(file_) img = img.rotate(value) name = "{}{}{}".format(dst, os.sep, os.path.basename(file_)) img.save(name) src = r'/home/andrew/code/tmp_photos' dst = r'/home/andrew/code/tmp_photos2' common = glob.glob('{}{}*.*'.format(src, os.sep)) rotate(common, dst) 代码地址 颜色转换 PIL允许您使用convert() 方法在不同的像素表示之间转换图像。 模式转换 from PIL import Image im = Image.open("hopper.ppm").convert("L") 该库支持每种支持模式和“L”和“RGB”模式之间的转换。要在其他模式之间转换,您可能必须使用中间图像(通常是“RGB”)图像。 图像增强 PIL提供了许多可用于增强图像的方法和模块。 过滤器 ImageFilter模块包含许多可以与filter()方法一起使用的预定义增强过滤器。 应用过滤器 from PIL import ImageFilter out = im.filter(ImageFilter.DETAIL) 点操作point()方法可用于转换图像的像素值(例如图像对比度操作)。在大多数情况下,期望一个参数的函数对象可以传递给此方法。每个像素都根据该功能进行处理: # multiply each pixel by 1.2 out = im.point(lambda i: i * 1.2) 使用上述技巧,您可以快速将任何简单表达式应用于图像。你也可以结合point()和paste()方法来选择性地修改图像: 处理单个色带 # split the image into individual bands source = im.split() R, G, B = 0, 1, 2 # select regions where red is less than 100 mask = source[R].point(lambda i: i < 100 and 255) # process the green band out = source[G].point(lambda i: i * 0.7) # paste the processed band back, but only where red was < 100 source[G].paste(out, None, mask) # build a new multiband image im = Image.merge(im.mode, source) Python仅根据确定结果所需的逻辑表达式部分进行评估,并返回检查的最后值作为表达式的结果。因此,如果上面的表达式为假(0),Python不会查看第二个操作数,并返回0.否则,返回255。 增强 对于更高级的图像增强,您可以使用ImageEnhance模块中的类。从图像创建后,可以使用增强对象快速尝试不同的设置。 您可以用这种方式调整对比度,亮度,色彩平衡和清晰度。 增强图像 from PIL import ImageEnhance enh = ImageEnhance.Contrast(im) enh.enhance(1.3).show("30% more contrast") 图像序列 Python图像库包含对图像序列(也称为动画格式)的一些基本支持。支持的序列格式包括FLI/FLC, GIF和一些实验格式。 TIFF文件也可以包含多个帧。 当你打开一个序列文件时,PIL自动加载序列中的第一帧。您可以使用seek和tell方法在不同的帧之间移动: 读序列 from PIL import Image im = Image.open("animation.gif") im.seek(1) # skip to the second frame try: while 1: im.seek(im.tell()+1) # do something to im except EOFError: pass # end of sequence 正如在这个例子中看到的,当序列结束时,你会得到EOFError异常。 注意当前版本库中的大多数驱动程序只允许您寻找下一帧(如上例所示)。要倒回文件,您可能必须重新打开它。 下面的类让你使用for语句来遍历序列: from PIL import ImageSequence for frame in ImageSequence.Iterator(im): # ...do something to frame... 后记打印Python影像库包括在Postscript打印机上打印图像,文本和图形的功能。这里有一个简单的例子: from PIL import Image from PIL import PSDraw im = Image.open("hopper.ppm") title = "hopper" box = (1*72, 2*72, 7*72, 10*72) # in points ps = PSDraw.PSDraw() # default is sys.stdout ps.begin_document(title) # draw the image (75 dpi) ps.image(box, im, 75) ps.rectangle(box) # draw title ps.setfont("HelveticaNarrow-Bold", 36) ps.text((3*72, 4*72), title) ps.end_document() 更多关于读图片 如前所述,Image模块的open() 函数用于打开图像文件。在大多数情况下,您只需将文件名作为参数传递给它: from PIL import Image im = Image.open("hopper.ppm") 如果一切顺利,结果是一个PIL.Image.Image对象。否则,会引发IOError异常。 您可以使用文件类对象而不是文件名。该对象必须实现read(), seek()和tell()方法,并以二进制模式打开。 从打开的文件中读取 from PIL import Image with open("hopper.ppm", "rb") as fp: im = Image.open(fp) 要从字符串数据读取图像,请使用StringIO类: 从字符串中读取 import StringIO im = Image.open(StringIO.StringIO(buffer)) 请注意,在读取图像标题之前,库会回滚文件(使用seek(0))。另外,当读取图像数据时(通过加载方法),也将使用seek。如果映像文件嵌入到较大的文件中,例如tar文件,则可以使用ContainerIO或TarIO模块访问它。 从tar档案中读取 from PIL import Image, TarIO fp = TarIO.TarIO("Tests/images/hopper.tar", "hopper.jpg") im = Image.open(fp) 控制解码器 某些解码器允许您在从文件中读取图像的同时操作图像。当创建缩略图时(速度通常比质量更重要)和打印到黑白激光打印机(只需要灰度版本的图像时)时,通常可以使用此功能来加速解码。 draft() 方法处理已打开但尚未加载的图像,以便尽可能匹配给定的模式和大小。这是通过重新配置图像解码器完成的。 以草稿模式阅读这仅适用于JPEG和MPO文件。 from PIL import Image from __future__ import print_function im = Image.open(file) print("original =", im.mode, im.size) im.draft("L", (100, 100)) print("draft =", im.mode, im.size) 这样打印出如下内容: original = RGB (512, 512) draft = L (128, 128) 请注意,生成的图像可能不完全符合请求的模式和尺寸。为确保图像不大于给定大小,请改用缩略图方法。

优秀的个人博客,低调大师

[雪峰磁针石博客]数据分析工具pandas快速入门教程2-pandas数据结构

创建数据 Series和python的列表类似。DataFrame则类似值为Series的字典。 create.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- # create.py import pandas as pd print("\n\n创建序列Series") s = pd.Series(['banana', 42]) print(s) print("\n\n指定索引index创建序列Series") s = pd.Series(['Wes McKinney', 'Creator of Pandas'], index=['Person', 'Who']) print(s) # 注意:列名未必为执行的顺序,通常为按字母排序 print("\n\n创建数据帧DataFrame") scientists = pd.DataFrame({ ' Name': ['Rosaline Franklin', 'William Gosset'], ' Occupation': ['Chemist', 'Statistician'], ' Born': ['1920-07-25', '1876-06-13'], ' Died': ['1958-04-16', '1937-10-16'], ' Age': [37, 61]}) print(scientists) print("\n\n指定顺序(index和columns)创建数据帧DataFrame") scientists = pd.DataFrame( data={'Occupation': ['Chemist', 'Statistician'], 'Born': ['1920-07-25', '1876-06-13'], 'Died': ['1958-04-16', '1937-10-16'], 'Age': [37, 61]}, index=['Rosaline Franklin', 'William Gosset'], columns=['Occupation', 'Born', 'Died', 'Age']) print(scientists) 执行结果: $ ./create.py 创建序列Series 0 banana 1 42 dtype: object 指定索引index创建序列Series Person Wes McKinney Who Creator of Pandas dtype: object 创建数据帧DataFrame Name Occupation Born Died Age 0 Rosaline Franklin Chemist 1920-07-25 1958-04-16 37 1 William Gosset Statistician 1876-06-13 1937-10-16 61 指定顺序(index和columns)创建数据帧DataFrame Occupation Born Died Age Rosaline Franklin Chemist 1920-07-25 1958-04-16 37 William Gosset Statistician 1876-06-13 1937-10-16 61 Series 官方文档:http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.html Series的属性 属性 描述 loc 使用索引值获取子集 iloc 使用索引位置获取子集 dtype或dtypes 类型 T 转置 shape 数据的尺寸 size 元素的数量 values ndarray或类似ndarray的Series Series的方法 方法 描述 append 连接2个或更多系列 corr 计算与其他Series的关联 cov 与其他Series计算协方差 describe 计算汇总统计 drop duplicates 返回一个没有重复项的Series equals Series是否具有相同的元素 get values 获取Series的值,与values属性相同 hist 绘制直方图 min 返回最小值 max 返回最大值 mean 返回算术平均值 median 返回中位数 mode(s) 返回mode(s) replace 用指定值替换系列中的值 sample 返回Series中值的随机样本 sort values 排序 to frame 转换为数据帧 transpose 返回转置 unique 返回numpy.ndarray唯一值 series.py #!/usr/bin/python3 # -*- coding: utf-8 -*- # CreateDate: 2018-3-14 # series.py import pandas as pd import numpy as np scientists = pd.DataFrame( data={'Occupation': ['Chemist', 'Statistician'], 'Born': ['1920-07-25', '1876-06-13'], 'Died': ['1958-04-16', '1937-10-16'], 'Age': [37, 61]}, index=['Rosaline Franklin', 'William Gosset'], columns=['Occupation', 'Born', 'Died', 'Age']) print(scientists) # 从数据帧(DataFrame)获取的行或者列为Series first_row = scientists.loc['William Gosset'] print(type(first_row)) print(first_row) # index和keys是一样的 print(first_row.index) print(first_row.keys()) print(first_row.values) print(first_row.index[0]) print(first_row.keys()[0]) # Pandas.Series和numpy.ndarray很类似 ages = scientists['Age'] print(ages) # 统计,更多参考http://pandas.pydata.org/pandas-docs/stable/basics.html#descriptive-statistics print(ages.mean()) print(ages.min()) print(ages.max()) print(ages.std()) scientists = pd.read_csv('../data/scientists.csv') ages = scientists['Age'] print(ages) print(ages.mean()) print(ages.describe()) print(ages[ages > ages.mean()]) print(ages > ages.mean()) manual_bool_values = [True, True, False, False, True, True, False, False] print(ages[manual_bool_values]) print(ages + ages) print(ages * ages) print(ages + 100) print(ages * 2) print(ages + pd.Series([1, 100])) # print(ages + np.array([1, 100])) 会报错,不同类型相加,大小一定要一样 print(ages + np.array([1, 100, 1, 100, 1, 100, 1, 100])) # 排序: 默认有自动排序 print(ages) rev_ages = ages.sort_index(ascending=False) print(rev_ages) print(ages * 2) print(ages + rev_ages) 执行结果 $ python3 series.py Occupation Born Died Age Rosaline Franklin Chemist 1920-07-25 1958-04-16 37 William Gosset Statistician 1876-06-13 1937-10-16 61 <class 'pandas.core.series.Series'> Occupation Statistician Born 1876-06-13 Died 1937-10-16 Age 61 Name: William Gosset, dtype: object Index(['Occupation', 'Born', 'Died', 'Age'], dtype='object') Index(['Occupation', 'Born', 'Died', 'Age'], dtype='object') ['Statistician' '1876-06-13' '1937-10-16' 61] Occupation Occupation Rosaline Franklin 37 William Gosset 61 Name: Age, dtype: int64 49.0 37 61 16.97056274847714 0 37 1 61 2 90 3 66 4 56 5 45 6 41 7 77 Name: Age, dtype: int64 59.125 count 8.000000 mean 59.125000 std 18.325918 min 37.000000 25% 44.000000 50% 58.500000 75% 68.750000 max 90.000000 Name: Age, dtype: float64 1 61 2 90 3 66 7 77 Name: Age, dtype: int64 0 False 1 True 2 True 3 True 4 False 5 False 6 False 7 True Name: Age, dtype: bool 0 37 1 61 4 56 5 45 Name: Age, dtype: int64 0 74 1 122 2 180 3 132 4 112 5 90 6 82 7 154 Name: Age, dtype: int64 0 1369 1 3721 2 8100 3 4356 4 3136 5 2025 6 1681 7 5929 Name: Age, dtype: int64 0 137 1 161 2 190 3 166 4 156 5 145 6 141 7 177 Name: Age, dtype: int64 0 74 1 122 2 180 3 132 4 112 5 90 6 82 7 154 Name: Age, dtype: int64 0 38.0 1 161.0 2 NaN 3 NaN 4 NaN 5 NaN 6 NaN 7 NaN dtype: float64 0 38 1 161 2 91 3 166 4 57 5 145 6 42 7 177 Name: Age, dtype: int64 0 37 1 61 2 90 3 66 4 56 5 45 6 41 7 77 Name: Age, dtype: int64 7 77 6 41 5 45 4 56 3 66 2 90 1 61 0 37 Name: Age, dtype: int64 0 74 1 122 2 180 3 132 4 112 5 90 6 82 7 154 Name: Age, dtype: int64 0 74 1 122 2 180 3 132 4 112 5 90 6 82 7 154 Name: Age, dtype: int64 数据帧(DataFrame) DataFrame是最常见的Pandas对象,可认为是Python存储类似电子表格的数据的方式。Series多常见功能都包含在DataFrame中。 子集的方法 注意ix现在已经不推荐使用。 DataFrame常用的索引操作有: 方式 描述 df[val] 选择单个列 df [[ column1, column2, ... ]] 选择多个列 df.loc[val] 选择行 loc [[ label1 , label2 ,...]] | 选择多行 |df.loc[:, val] | 基于行index选择列 | df.loc[val1, val2] | 选择行列 |df.iloc[row number] | 基于行数选择行 | iloc [[ row1, row2, ...]] Multiple rows by row number | 基于行数选择多行 |df.iloc[:, where] | 选择列 | df.iloc[where_i, where_j] | 选择行列 |df.at[label_i, label_j] | 选择值 |df.iat[i, j] | 选择值 |reindex method | 通过label选择多行或列 |get_value, set_value | 通过label选择耽搁行或列 df[bool] | 选择行df [[ bool1, bool2, ...]] | 选择行df[ start :stop: step ] | 基于行数选择行 #!/usr/bin/python3 # -*- coding: utf-8 -*- # CreateDate: 2018-3-31 # df.py import pandas as pd import numpy as np scientists = pd.read_csv('../data/scientists.csv') print(scientists[scientists['Age'] > scientists['Age'].mean()]) first_half = scientists[: 4] second_half = scientists[ 4 :] print(first_half) print(second_half) print(first_half + second_half) print(scientists * 2) 执行结果 #!/usr/bin/python3 # -*- coding: utf-8 -*- # df.py import pandas as pd import numpy as np scientists = pd.read_csv('../data/scientists.csv') print(scientists[scientists['Age'] > scientists['Age'].mean()]) first_half = scientists[: 4] second_half = scientists[ 4 :] print(first_half) print(second_half) print(first_half + second_half) print(scientists * 2) 执行结果 $ python3 df.py Name Born Died Age Occupation 1 William Gosset 1876-06-13 1937-10-16 61 Statistician 2 Florence Nightingale 1820-05-12 1910-08-13 90 Nurse 3 Marie Curie 1867-11-07 1934-07-04 66 Chemist 7 Johann Gauss 1777-04-30 1855-02-23 77 Mathematician Name Born Died Age Occupation 0 Rosaline Franklin 1920-07-25 1958-04-16 37 Chemist 1 William Gosset 1876-06-13 1937-10-16 61 Statistician 2 Florence Nightingale 1820-05-12 1910-08-13 90 Nurse 3 Marie Curie 1867-11-07 1934-07-04 66 Chemist Name Born Died Age Occupation 4 Rachel Carson 1907-05-27 1964-04-14 56 Biologist 5 John Snow 1813-03-15 1858-06-16 45 Physician 6 Alan Turing 1912-06-23 1954-06-07 41 Computer Scientist 7 Johann Gauss 1777-04-30 1855-02-23 77 Mathematician Name Born Died Age Occupation 0 NaN NaN NaN NaN NaN 1 NaN NaN NaN NaN NaN 2 NaN NaN NaN NaN NaN 3 NaN NaN NaN NaN NaN 4 NaN NaN NaN NaN NaN 5 NaN NaN NaN NaN NaN 6 NaN NaN NaN NaN NaN 7 NaN NaN NaN NaN NaN Name Born \ 0 Rosaline FranklinRosaline Franklin 1920-07-251920-07-25 1 William GossetWilliam Gosset 1876-06-131876-06-13 2 Florence NightingaleFlorence Nightingale 1820-05-121820-05-12 3 Marie CurieMarie Curie 1867-11-071867-11-07 4 Rachel CarsonRachel Carson 1907-05-271907-05-27 5 John SnowJohn Snow 1813-03-151813-03-15 6 Alan TuringAlan Turing 1912-06-231912-06-23 7 Johann GaussJohann Gauss 1777-04-301777-04-30 Died Age Occupation 0 1958-04-161958-04-16 74 ChemistChemist 1 1937-10-161937-10-16 122 StatisticianStatistician 2 1910-08-131910-08-13 180 NurseNurse 3 1934-07-041934-07-04 132 ChemistChemist 4 1964-04-141964-04-14 112 BiologistBiologist 5 1858-06-161858-06-16 90 PhysicianPhysician 6 1954-06-071954-06-07 82 Computer ScientistComputer Scientist 7 1855-02-231855-02-23 154 MathematicianMathematician 修改列 #!/usr/bin/python3 # -*- coding: utf-8 -*- # Author: xurongzhong#126.com wechat:pythontesting qq:37391319 # qq群:144081101 591302926 567351477 # CreateDate: 2018-06-07 # change.py import pandas as pd import numpy as np import random scientists = pd.read_csv('../data/scientists.csv') print(scientists['Born'].dtype) print(scientists['Died'].dtype) print(scientists.head()) # 转为日期 参考:https://docs.python.org/3.5/library/datetime.html born_datetime = pd.to_datetime(scientists['Born'], format='%Y-%m-%d') died_datetime = pd.to_datetime(scientists['Died'], format='%Y-%m-%d') # 增加列 scientists['born_dt'], scientists['died_dt'] = (born_datetime, died_datetime) print(scientists.shape) print(scientists.head()) random.seed(42) random.shuffle(scientists['Age']) # 此修改会作用于scientists print(scientists.head()) scientists['age_days_dt'] = (scientists['died_dt'] - scientists['born_dt']) print(scientists.head()) 执行结果: $ python3 change.py object object Name Born Died Age Occupation 0 Rosaline Franklin 1920-07-25 1958-04-16 37 Chemist 1 William Gosset 1876-06-13 1937-10-16 61 Statistician 2 Florence Nightingale 1820-05-12 1910-08-13 90 Nurse 3 Marie Curie 1867-11-07 1934-07-04 66 Chemist 4 Rachel Carson 1907-05-27 1964-04-14 56 Biologist (8, 7) Name Born Died Age Occupation born_dt \ 0 Rosaline Franklin 1920-07-25 1958-04-16 37 Chemist 1920-07-25 1 William Gosset 1876-06-13 1937-10-16 61 Statistician 1876-06-13 2 Florence Nightingale 1820-05-12 1910-08-13 90 Nurse 1820-05-12 3 Marie Curie 1867-11-07 1934-07-04 66 Chemist 1867-11-07 4 Rachel Carson 1907-05-27 1964-04-14 56 Biologist 1907-05-27 died_dt 0 1958-04-16 1 1937-10-16 2 1910-08-13 3 1934-07-04 4 1964-04-14 /usr/lib/python3.5/random.py:272: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy x[i], x[j] = x[j], x[i] Name Born Died Age Occupation born_dt \ 0 Rosaline Franklin 1920-07-25 1958-04-16 66 Chemist 1920-07-25 1 William Gosset 1876-06-13 1937-10-16 56 Statistician 1876-06-13 2 Florence Nightingale 1820-05-12 1910-08-13 41 Nurse 1820-05-12 3 Marie Curie 1867-11-07 1934-07-04 77 Chemist 1867-11-07 4 Rachel Carson 1907-05-27 1964-04-14 90 Biologist 1907-05-27 died_dt 0 1958-04-16 1 1937-10-16 2 1910-08-13 3 1934-07-04 4 1964-04-14 Name Born Died Age Occupation born_dt \ 0 Rosaline Franklin 1920-07-25 1958-04-16 66 Chemist 1920-07-25 1 William Gosset 1876-06-13 1937-10-16 56 Statistician 1876-06-13 2 Florence Nightingale 1820-05-12 1910-08-13 41 Nurse 1820-05-12 3 Marie Curie 1867-11-07 1934-07-04 77 Chemist 1867-11-07 4 Rachel Carson 1907-05-27 1964-04-14 90 Biologist 1907-05-27 died_dt age_days_dt 0 1958-04-16 13779 days 1 1937-10-16 22404 days 2 1910-08-13 32964 days 3 1934-07-04 24345 days 4 1964-04-14 20777 days 数据导入导出 out.py #!/usr/bin/python3 # -*- coding: utf-8 -*- # Author: china-testing#126.com wechat:pythontesting qq群:630011153 # CreateDate: 2018-3-31 # out.py import pandas as pd import numpy as np import random scientists = pd.read_csv('../data/scientists.csv') names = scientists['Name'] print(names) names.to_pickle('../output/scientists_names_series.pickle') scientists.to_pickle('../output/scientists_df.pickle') # .p, .pkl, .pickle 是常用的pickle文件扩展名 scientist_names_from_pickle = pd.read_pickle('../output/scientists_df.pickle') print(scientist_names_from_pickle) names.to_csv('../output/scientist_names_series.csv') scientists.to_csv('../output/scientists_df.tsv', sep='\t') # 不输出行号 scientists.to_csv('../output/scientists_df_no_index.csv', index=None) # Series可以转为df再输出成excel文件 names_df = names.to_frame() names_df.to_excel('../output/scientists_names_series_df.xls') names_df.to_excel('../output/scientists_names_series_df.xlsx') scientists.to_excel('../output/scientists_df.xlsx', sheet_name='scientists', index=False) 执行结果: $ python3 out.py 0 Rosaline Franklin 1 William Gosset 2 Florence Nightingale 3 Marie Curie 4 Rachel Carson 5 John Snow 6 Alan Turing 7 Johann Gauss Name: Name, dtype: object Name Born Died Age Occupation 0 Rosaline Franklin 1920-07-25 1958-04-16 37 Chemist 1 William Gosset 1876-06-13 1937-10-16 61 Statistician 2 Florence Nightingale 1820-05-12 1910-08-13 90 Nurse 3 Marie Curie 1867-11-07 1934-07-04 66 Chemist 4 Rachel Carson 1907-05-27 1964-04-14 56 Biologist 5 John Snow 1813-03-15 1858-06-16 45 Physician 6 Alan Turing 1912-06-23 1954-06-07 41 Computer Scientist 7 Johann Gauss 1777-04-30 1855-02-23 77 Mathematician 注意:序列一般是直接输出成excel文件 更多的输入输出方法: 方式 描述 to_clipboard 将数据保存到系统剪贴板进行粘贴 to_dense 将数据转换为常规“密集”DataFrame to_dict 将数据转换为Python字典 to_gbq 将数据转换为Google BigQuery表格 toJidf 将数据保存为分层数据格式(HDF) to_msgpack 将数据保存到可移植的类似JSON的二进制文件中 toJitml 将数据转换为HTML表格 tojson 将数据转换为JSON字符串 toJatex 将数据转换为LTEXtabular环境 to_records 将数据转换为记录数组 to_string 将DataFrame显示为stdout的字符串 to_sparse 将数据转换为SparceDataFrame to_sql 将数据保存到SQL数据库中 to_stata 将数据转换为Stata dta文件 读CSV文件 read_csv.py #!/usr/bin/python3 # -*- coding: utf-8 -*- # Author: china-testing#126.com wechat:pythontesting QQ群:630011153 # CreateDate: 2018-3-9 # read_csv.py import pandas as pd df = pd.read_csv("1.csv", header=None) # 不读取列名 print("df:") print(df) print("df.head():") print(df.head()) # head(self, n=5),默认为5行,类似的有tail print("df.tail():") print(df.tail()) df = pd.read_csv("1.csv") # 默认读取列名 print("df:") print(df) df = pd.read_csv("1.csv", names=['号码','群号']) # 自定义列名 print("df:") print(df) # 自定义列名,去掉第一行 df = pd.read_csv("1.csv", skiprows=[0], names=['号码','群号']) print("df:") print(df) 执行结果: df: 0 1 0 qq qqgroup 1 37391319 144081101 2 37391320 144081102 3 37391321 144081103 4 37391322 144081104 5 37391323 144081105 6 37391324 144081106 7 37391325 144081107 8 37391326 144081108 9 37391327 144081109 10 37391328 144081110 11 37391329 144081111 12 37391330 144081112 13 37391331 144081113 14 37391332 144081114 15 37391333 144081115 df.head(): 0 1 0 qq qqgroup 1 37391319 144081101 2 37391320 144081102 3 37391321 144081103 4 37391322 144081104 df.tail(): 0 1 11 37391329 144081111 12 37391330 144081112 13 37391331 144081113 14 37391332 144081114 15 37391333 144081115 df: qq qqgroup 0 37391319 144081101 1 37391320 144081102 2 37391321 144081103 3 37391322 144081104 4 37391323 144081105 5 37391324 144081106 6 37391325 144081107 7 37391326 144081108 8 37391327 144081109 9 37391328 144081110 10 37391329 144081111 11 37391330 144081112 12 37391331 144081113 13 37391332 144081114 14 37391333 144081115 df: 号码 群号 0 qq qqgroup 1 37391319 144081101 2 37391320 144081102 3 37391321 144081103 4 37391322 144081104 5 37391323 144081105 6 37391324 144081106 7 37391325 144081107 8 37391326 144081108 9 37391327 144081109 10 37391328 144081110 11 37391329 144081111 12 37391330 144081112 13 37391331 144081113 14 37391332 144081114 15 37391333 144081115 df: 号码 群号 0 37391319 144081101 1 37391320 144081102 2 37391321 144081103 3 37391322 144081104 4 37391323 144081105 5 37391324 144081106 6 37391325 144081107 7 37391326 144081108 8 37391327 144081109 9 37391328 144081110 10 37391329 144081111 11 37391330 144081112 12 37391331 144081113 13 37391332 144081114 14 37391333 144081115 写CSV文件 #!/usr/bin/python3 # -*- coding: utf-8 -*- # write_csv.py import pandas as pd data ={'qq': [37391319,37391320], 'group':[1,2]} df = pd.DataFrame(data=data, columns=['qq','group']) df.to_csv('2.csv',index=False) 读写excel和csv类似,不过要改用read_excel来读,excel_summary_demo, 提供了多个excel求和的功能,可以做为excel读写的实例,这里不再赘述。 参考资料 技术支持qq群144081101 591302926 567351477 钉钉免费群21745728 本文最新版本地址 本文涉及的python测试开发库 谢谢点赞! 本文相关海量书籍下载 源码下载 本文英文版书籍下载

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

用户登录
用户注册