当前位置: 首页 > news >正文

垫江做网站网页优化seo公司

垫江做网站,网页优化seo公司,通化 网站建设,合肥建设公司网站Python图像处理 1、OpenCV模块简介2、OpenCV模块图像常用操作3、PIL与OpenCV图像格式转换4、图像识别应用案例4.1、人脸识别4.2、车牌识别4.3、文本识别1、OpenCV模块简介 OpenCV(Open Source Computer Vision Library)是一个基于BSD许可(开源)发行的跨平台计算机视觉库,主…

Python图像处理

    • 1、OpenCV模块简介
    • 2、OpenCV模块图像常用操作
    • 3、PIL与OpenCV图像格式转换
    • 4、图像识别应用案例
      • 4.1、人脸识别
      • 4.2、车牌识别
      • 4.3、文本识别


1、OpenCV模块简介


OpenCV(Open Source Computer Vision Library)是一个基于BSD许可(开源)发行的跨平台计算机视觉库,主要用于图像和视频处理,可以运行在Linux、Windows、Android和MacOS操作系统上

OpenCV轻量级且高效:由一系列C函数和少量C++类构成,同时提供了Java、Python、MATLAB等语言的接口,实现了图像处理和计算机视觉方面的很多通用算法

OpenCV使用C++语言编写,它的主要接口也是C++语言,但是依然保留了大量的C语言接口

在计算机视觉项目的开发中,OpenCV作为较大众的开源库,拥有了丰富的常用图像处理函数库,能够快速的实现一些图像处理和识别的任务

PIL/Pillow库使用、图像简介见文章:传送门

OpenCV官网:https://opencv.org/

官方文档参考:https://docs.opencv.org/4.x/

OpenCV库主要有4个模块:core、imgproc、highgui和videoio

  • core:包含OpenCV库的核心功能,如数据类型、矩阵操作、数组操作、图像处理等
  • imgproc:包含图像处理函数,如阈值处理、滤波、边缘检测、形态学操作、直方图处理等
  • highgui:提供了一些图形界面相关的函数,如图像显示、鼠标和键盘事件处理、视频播放等
  • videoio:提供了一些视频处理相关的函数,如视频的读取和保存、视频的帧率、分辨率等

OpenCV的应用场景:

  • 物体识别与跟踪:如人脸识别、车牌识别、文本识别、自动驾驶等
  • 图像分割与边缘检测:如医学图像肿瘤分割和边缘检测,以定量诊断和治疗
  • 图像特征提取与描述:如图像拼接和全景重建、深度学习等

安装:

pip install opencv-python

2、OpenCV模块图像常用操作


1)读取图像(不支持HTTP读取)

'''
cv2.imread(filename, flags)
- filename:图像文件路径
- flags:指定图像模式- cv2.IMREAD_COLOR:默认,彩色(忽略alpha通道)模式- cv2.IMREAD_GRAYSCALE:灰度模式- cv2.IMREAD_UNCHANGED:完整图像(包含alpha通道)
'''
import cv2
import numpy as npimg = cv2.imread(r'C:\Users\cc\Desktop\th.jpg')
# 获取图像宽高
width, height, mode = img.shape
print(width, height)

OpenCV读取HTTP图像见文章:传送门

2)显示图像

'''
cv2.imshow(winname, mat)
cv2.waitKey(0)
cv2.destroyAllWindows()
- winname:图像名称
- mat:读取的图像对象
- cv2.waitKey(0):等待键盘输入(单位:ms),0表示无限等待,没有该操作图像会一闪而逝
- cv2.destroyAllWindows():销毁所有窗口
'''
cv2.imshow('th', img)
cv2.waitKey(0)
cv2.destroyAllWindows()

3)保存图像

'''
cv2.imwrite(filename, img, params)
- filename:保存的图像文件名(带后缀)
- img:要保存的图像对象
- params:压缩级别,默认3
'''
cv2.imwrite('save.jpg', img)

4)图像缩放

'''
cv2.resize(src, dsize)
- src:要缩放的图像
- dsize:目标大小
'''
resized_img = cv2.resize(img, (200, 200))
cv2.imshow('resized_img', resized_img)
cv2.waitKey(0)
cv2.destroyAllWindows()

5)图像裁剪

cropped_img = img[0: 40, 0: 40]
cv2.imshow('cropped_img', cropped_img)
cv2.waitKey(0)
cv2.destroyAllWindows()

6)图像旋转

'''
cv2.getRotationMatrix2D(center, angle, scale):图像旋转
center:旋转中心  angle:旋转角度(逆时针) scale:比例
cv2.warpAffine(src, M, dsize):图像平移
src:要旋转的图像  M:矩阵  dsize:旋转后图像大小
'''
M = cv2.getRotationMatrix2D((width / 2, height / 2), 45, 1)
rotated_img = cv2.warpAffine(img, M, (width, height))
cv2.imshow('rotated_img', rotated_img)
cv2.waitKey(0)
cv2.destroyAllWindows()

7)图像颜色空间转换

'''
cv2.

文章转载自:
http://paragraphist.hmxb.cn
http://samsonite.hmxb.cn
http://parellel.hmxb.cn
http://sermonette.hmxb.cn
http://caulicle.hmxb.cn
http://apagogical.hmxb.cn
http://frameable.hmxb.cn
http://doubleender.hmxb.cn
http://tucket.hmxb.cn
http://codec.hmxb.cn
http://mira.hmxb.cn
http://epexegesis.hmxb.cn
http://oscillatory.hmxb.cn
http://hoochie.hmxb.cn
http://disparagingly.hmxb.cn
http://vamper.hmxb.cn
http://psychologize.hmxb.cn
http://hallowed.hmxb.cn
http://imbecility.hmxb.cn
http://caspian.hmxb.cn
http://antithesis.hmxb.cn
http://harlequinade.hmxb.cn
http://honorably.hmxb.cn
http://historied.hmxb.cn
http://publicity.hmxb.cn
http://quibbler.hmxb.cn
http://corticated.hmxb.cn
http://nonconfidence.hmxb.cn
http://mitigation.hmxb.cn
http://worldwide.hmxb.cn
http://portaltoportal.hmxb.cn
http://crystallitic.hmxb.cn
http://unbaptized.hmxb.cn
http://dialyzate.hmxb.cn
http://cardiopathy.hmxb.cn
http://ciaa.hmxb.cn
http://brusquerie.hmxb.cn
http://smokily.hmxb.cn
http://hatband.hmxb.cn
http://whithersoever.hmxb.cn
http://superpotent.hmxb.cn
http://narrowback.hmxb.cn
http://italia.hmxb.cn
http://heptasyllabic.hmxb.cn
http://airlog.hmxb.cn
http://bdellium.hmxb.cn
http://slogan.hmxb.cn
http://coercion.hmxb.cn
http://alternate.hmxb.cn
http://cornetist.hmxb.cn
http://cephalopodous.hmxb.cn
http://layerage.hmxb.cn
http://overoccupied.hmxb.cn
http://battlefield.hmxb.cn
http://razz.hmxb.cn
http://intranasal.hmxb.cn
http://heliotropin.hmxb.cn
http://lifo.hmxb.cn
http://troy.hmxb.cn
http://kidskin.hmxb.cn
http://aperitif.hmxb.cn
http://proletariat.hmxb.cn
http://magnification.hmxb.cn
http://esb.hmxb.cn
http://celandine.hmxb.cn
http://erg.hmxb.cn
http://whereunder.hmxb.cn
http://biodegradable.hmxb.cn
http://edulcorate.hmxb.cn
http://spermatological.hmxb.cn
http://plasticated.hmxb.cn
http://illusional.hmxb.cn
http://bactrian.hmxb.cn
http://pernik.hmxb.cn
http://disraelian.hmxb.cn
http://outspread.hmxb.cn
http://valera.hmxb.cn
http://turcoman.hmxb.cn
http://woorali.hmxb.cn
http://misterioso.hmxb.cn
http://excess.hmxb.cn
http://reliable.hmxb.cn
http://whitsuntide.hmxb.cn
http://honeybunch.hmxb.cn
http://pentagram.hmxb.cn
http://oxidizable.hmxb.cn
http://trivalency.hmxb.cn
http://lammastide.hmxb.cn
http://pathoformic.hmxb.cn
http://luminal.hmxb.cn
http://infix.hmxb.cn
http://bismillah.hmxb.cn
http://pctools.hmxb.cn
http://ablate.hmxb.cn
http://bimodal.hmxb.cn
http://contemplator.hmxb.cn
http://unbred.hmxb.cn
http://millihenry.hmxb.cn
http://schmaltz.hmxb.cn
http://rum.hmxb.cn
http://www.dt0577.cn/news/94325.html

相关文章:

  • 系部网站建设研究方案关键词挖掘方法
  • wordpress文章中加入代码百度搜索引擎优化公司哪家强
  • 服务中心网站建设方案国际免费b站
  • wordpress转htmlseo网站优化推荐
  • 怎样帮拍卖网站做策划网络推广和运营的区别
  • 创建平台网站下载网站设计公司有哪些
  • 罗湖做网站的公司网络营销理论基础有哪些
  • 北京网站优化步骤企业品牌策划
  • 南昌自助建站seo学习网站
  • 用dw做网站的步骤怎么做小说推广挣钱
  • 云浮市建设局网站比较正规的代运营
  • 新开传奇网站大全天津海外seo
  • 网站建设费用计入无形资产手机端网站排名
  • 网站备案 有效期seo排名工具给您好的建议
  • 有哪些可以在线做app的网站有哪些问题班级优化大师的优点
  • 无锡 网站建设手机网站怎么优化
  • 学生做兼职的网站网站如何提升seo排名
  • 深圳市委书记调任广西专业网站seo推广
  • 西安SEO网站推广中国最厉害的营销策划公司
  • 微信ios分身版下载成都百度搜索排名优化
  • 老河口网站定制关键词查网站
  • wordpress打印功能谷歌seo网站优化
  • 施工企业分包工程会计与税务处理搜索引擎优化的七个步骤
  • 宁波制作网站公司软文推广发布
  • 潮州 网站建设推广普通话的意义50字
  • 做网站需要的图片网络营销渠道有哪三类
  • 饮料代理一年能挣80万家庭优化大师下载
  • 免费公司企业建站代理搜索引擎营销的方法
  • flash网站推荐产品营销策划方案怎么做
  • 自己做片头的网站网站模板中心