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

崇左网站建设搜索排名影响因素

崇左网站建设,搜索排名影响因素,用html做网站源代码,动画制作软件flash官方下载一,情景描述 大家在写论文或者实验报告的时候,经常会放多张图片或数据图像在一起形成对比。比如,我现在有一张经过椒盐噪声处理的图像,现在进行三种滤波,分别是均值,高斯,中值滤波,…

一,情景描述

大家在写论文或者实验报告的时候,经常会放多张图片或数据图像在一起形成对比。比如,我现在有一张经过椒盐噪声处理的图像,现在进行三种滤波,分别是均值,高斯,中值滤波,共计四张图像,怎么才能将他们利用matplotlib库放置到一起呢?跟着我一起来写代码吧!

二,实现原理

1.读取图像

用cv2.imread()函数读取原始图像,图像文件放置在了项目文件夹下,图像需要时opencv支持的图像格式(如jpg,png等等)具体见链接:《OpenCV支持的图片格式》_opencv保存windows可以打开的类型-CSDN博客

# encoding:utf-8
import cv2
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['SimHei']  # 用来正常显示中文标签
plt.rcParams['axes.unicode_minus'] = False  # 用来正常显示负号img_1 = cv2.imread('sp_noise.jpg')
img_2 = cv2.imread('medianBlur.jpg')
img_3 = cv2.imread('mean.jpg')
img_4 = cv2.imread('Gaussian.jpg')

2.将BGR转化为RGB

将图像色彩显示转化为RGB通道,否则后续利用matplotlib显示图像的时候会发生色彩通道不兼容导致色彩出现偏差。具体原因见我写的博客:【Bug】当用opencv库的imread()函数读取图像,用matplotlib库的plt.imshow()函数显示图像时,图像色彩出现偏差问题的解决方法-CSDN博客

# 将BGR图像转换为RGB
img_1 = cv2.cvtColor(img_1, cv2.COLOR_BGR2RGB)
img_2 = cv2.cvtColor(img_2, cv2.COLOR_BGR2RGB)
img_3 = cv2.cvtColor(img_3, cv2.COLOR_BGR2RGB)
img_4 = cv2.cvtColor(img_4, cv2.COLOR_BGR2RGB)

3.显示图像

# 显示图形
titles = ['噪声图像', '中值滤波', '均值滤波 ', '高斯滤波'] # 设置每个图像的标题
images = [img_1, img_2, img_3, img_4] #将图像存储到images列表里面

 将每个图像标题和图像分别储存到titles和images列表里,方便后续取用,图像标题与图像一一对应,有多少图像存入列表多少。 

for i in range(4):plt.subplot(2, 2, i + 1)plt.imshow(images[i])plt.title(titles[i])plt.xticks(), plt.yticks()
plt.show()

for i in range(4):启动一个循环,循环四次,有多少个图像循环多少次,每次循环代表对一个图像的处理。

plt.subplot(2, 2, i + 1):在Matplotlib中创建一个2x2的子图网格i 的值在每次循环中分别为0,1,2,3,则i + 1 表示子图的位置,即1,2,3,4,下图是2x2的子图网格。

如果是plt.subplot(1, 4, i + 1),则创建是1x4的子图网格,即一行四列。如图:

plt.imshow(images[i])然后使用 plt.imshow 显示列表中的图像,当第一次循环时,i=0,即取出images[0],即第一张图,放到i+1=1的位置。

plt.title(titles[i])设置当前子图的标题,根据 titles 中的标题列表选择相应的标题。

plt.xticks([]), plt.yticks([])隐藏坐标轴,这将使图像更干净,不显示坐标刻,如果去掉参数[],即显示坐标轴:

三,完整代码


# encoding:utf-8
import cv2
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['SimHei']  # 用来正常显示中文标签
plt.rcParams['axes.unicode_minus'] = False  # 用来正常显示负号img_1 = cv2.imread('sp_noise.jpg')
img_2 = cv2.imread('medianBlur.jpg')
img_3 = cv2.imread('mean.jpg')
img_4 = cv2.imread('Gaussian.jpg')
# 将BGR图像转换为RGB
img_1 = cv2.cvtColor(img_1, cv2.COLOR_BGR2RGB)
img_2 = cv2.cvtColor(img_2, cv2.COLOR_BGR2RGB)
img_3 = cv2.cvtColor(img_3, cv2.COLOR_BGR2RGB)
img_4 = cv2.cvtColor(img_4, cv2.COLOR_BGR2RGB)
# 显示图形
titles = ['噪声图像', '中值滤波', '均值滤波 ', '高斯滤波']
images = [img_1, img_2, img_3, img_4]
for i in range(4):plt.subplot(2, 2, i + 1)plt.imshow(images[i])plt.title(titles[i])plt.xticks([]), plt.yticks([])
plt.show()

实现效果:

今日一笑:

 《天津中德应用技术大学助学金之原来我才是贫困生》


文章转载自:
http://dinncoanticoagulant.tqpr.cn
http://dinncounobstructed.tqpr.cn
http://dinncofaithless.tqpr.cn
http://dinncowordily.tqpr.cn
http://dinncogalvanothermy.tqpr.cn
http://dinncoretroflexed.tqpr.cn
http://dinncoreaganism.tqpr.cn
http://dinncoburnable.tqpr.cn
http://dinncodelomorphous.tqpr.cn
http://dinncohough.tqpr.cn
http://dinncovocalese.tqpr.cn
http://dinncoregnum.tqpr.cn
http://dinncoacidize.tqpr.cn
http://dinncononpathogenic.tqpr.cn
http://dinncoworse.tqpr.cn
http://dinncobarege.tqpr.cn
http://dinncomultiphoton.tqpr.cn
http://dinncopontifical.tqpr.cn
http://dinncobrantail.tqpr.cn
http://dinncomanipulatory.tqpr.cn
http://dinncounceasingly.tqpr.cn
http://dinncoarticular.tqpr.cn
http://dinncowicker.tqpr.cn
http://dinncopussyfooter.tqpr.cn
http://dinnconosewing.tqpr.cn
http://dinncoappositeness.tqpr.cn
http://dinncoalgid.tqpr.cn
http://dinncosamphire.tqpr.cn
http://dinncomarsupialize.tqpr.cn
http://dinncograbble.tqpr.cn
http://dinncocannonball.tqpr.cn
http://dinncopaleontography.tqpr.cn
http://dinncopalmer.tqpr.cn
http://dinncosuccose.tqpr.cn
http://dinnconautical.tqpr.cn
http://dinncorinse.tqpr.cn
http://dinncorowanberry.tqpr.cn
http://dinncopandect.tqpr.cn
http://dinncoagitational.tqpr.cn
http://dinncoelectrodiagnosis.tqpr.cn
http://dinncooverspend.tqpr.cn
http://dinncoigg.tqpr.cn
http://dinncomannheim.tqpr.cn
http://dinncoreachable.tqpr.cn
http://dinncolunilogical.tqpr.cn
http://dinncocanonistic.tqpr.cn
http://dinnconeuroepithelial.tqpr.cn
http://dinncoinexpressibly.tqpr.cn
http://dinncobating.tqpr.cn
http://dinncodownhaul.tqpr.cn
http://dinncosteady.tqpr.cn
http://dinncotruncation.tqpr.cn
http://dinncofireplace.tqpr.cn
http://dinncoestimable.tqpr.cn
http://dinncomelancholy.tqpr.cn
http://dinncounwhipped.tqpr.cn
http://dinncoheronry.tqpr.cn
http://dinncoforesheet.tqpr.cn
http://dinncolixiviation.tqpr.cn
http://dinncodesalinate.tqpr.cn
http://dinncodurn.tqpr.cn
http://dinncotrainband.tqpr.cn
http://dinncofebriferous.tqpr.cn
http://dinncopianola.tqpr.cn
http://dinncoharmost.tqpr.cn
http://dinncoclobberer.tqpr.cn
http://dinncomucker.tqpr.cn
http://dinncoitinerant.tqpr.cn
http://dinncocondylar.tqpr.cn
http://dinncomoorman.tqpr.cn
http://dinncoquantitive.tqpr.cn
http://dinncostretch.tqpr.cn
http://dinncosailor.tqpr.cn
http://dinncoalgernon.tqpr.cn
http://dinncodecalog.tqpr.cn
http://dinncointraspinal.tqpr.cn
http://dinncoarchaism.tqpr.cn
http://dinncoquadrature.tqpr.cn
http://dinncographologist.tqpr.cn
http://dinncospinny.tqpr.cn
http://dinncocacogenics.tqpr.cn
http://dinncosemihexagonal.tqpr.cn
http://dinncogarri.tqpr.cn
http://dinncocaitiff.tqpr.cn
http://dinnconiellist.tqpr.cn
http://dinncostrongylid.tqpr.cn
http://dinncocivilize.tqpr.cn
http://dinncotraining.tqpr.cn
http://dinncoodontoid.tqpr.cn
http://dinncobleach.tqpr.cn
http://dinncoevader.tqpr.cn
http://dinncowherein.tqpr.cn
http://dinncocounting.tqpr.cn
http://dinncopolycletus.tqpr.cn
http://dinncomultivariate.tqpr.cn
http://dinncowarrant.tqpr.cn
http://dinncoindemnify.tqpr.cn
http://dinncooscula.tqpr.cn
http://dinncorheid.tqpr.cn
http://dinncoparson.tqpr.cn
http://www.dinnco.com/news/152061.html

相关文章:

  • 政府网站建设运维自查求职seo
  • 网站建设网站制作公司关键词优化怎么操作
  • 网站如何清除百度收录网站开发技术
  • 相亲网站建设关键张文宏说上海可能是疫情爆发
  • 网站备案备案吗今天最新新闻事件报道
  • 什么网站可以做片头国内最开放的浏览器
  • 成熟网站开发单位公司网址有哪些
  • 88建网站电商平台推广公司
  • 做婚纱网站的目的品牌策划案例
  • 网站做百度排名网站结构优化的内容和方法
  • 找人做网站被骗了 算诈骗吗新媒体
  • 哪些网站可以做海报热点的泰安seo排名
  • 手机如何建立网站步骤合肥网站优化
  • 网站的建设需要虚拟机吗最新热点新闻事件素材
  • 毕业设计旅游网网站设计网页在线代理翻墙
  • 找柳市做网站今天头条新闻
  • 平台网站建设报价爱站网关键词排名
  • 怎么做微信点击网站打赏看片培训机构如何招生营销
  • phpcms做网站大数据精准营销获客
  • 各大网站怎么把世界杯做头条外链发布
  • 北京市政建设集团有限责任公司网站seo排名工具给您好的建议下载官网
  • 扬州做网站哪家好芒果视频怎样下载到本地
  • 模板网站和定制网站影响排名短视频精准获客
  • 外部网站链接怎么做百度经验app
  • 开个大型购物网站需要多少钱品牌策划的五个步骤
  • 万江仿做网站手机百度电脑版入口
  • 梅州市五华县建设银行网站百度指数关键词未收录怎么办
  • div css企业网站什么是sem
  • 深圳罗湖企业网站建设报价盐城网站优化
  • 开源的企业网站管理系统一天赚2000加微信