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

网站开发课程有哪些保定关键词排名推广

网站开发课程有哪些,保定关键词排名推广,网站如何做支付系统,江西建设厅网站查询施工员【 声明:版权所有,欢迎转载,请勿用于商业用途。 联系信箱:feixiaoxing 163.com】 很多人一想到图像处理,本能的第一反应就是opencv,这也没有错。但是呢,这里面还是有一个问题的,不知…

【 声明:版权所有,欢迎转载,请勿用于商业用途。 联系信箱:feixiaoxing @163.com】

        很多人一想到图像处理,本能的第一反应就是opencv,这也没有错。但是呢,这里面还是有一个问题的,不知道大家有没有想过,如果我们为了降低成本,需要把图像放到mcu来处理,这个时候应该怎么做呢?都知道,mcu的ram和flash都是有限的,根本无法容纳那么大的opencv库。所以,这边还是建议大家,opencv是可以用,但是基础的算法库最好还是可以自己写出来。

        对于写算法的人来说,最麻烦的事情,莫过于图片的读取和保存了,算法本身一般并不是那么复杂。所以这部分好在qt已经帮我们做了一部分,我们直接拿QImage类就可以实现基础的算法编写了。

1、相关类

        qt里面的QImage十分方便,输入路径,就是实现图片的保存和加载。

2、参考代码

        如下面代码所示,这就是一个简单的图像处理代码,将原来的彩色图片,变成了灰色图片。整个应用没有界面,就是一个单纯的应用。所有的操作都放在了processImage函数里面。

#include <QImage>
#include <QDebug>void processImage(QString inputPath, QString outputPath) 
{// load imageQImage inputImage(inputPath);if (inputImage.isNull()) {qDebug() << "Failed to load image";return;}// get image inforint width = inputImage.width();int height = inputImage.height();// loop to process pixelfor (int y = 0; y < height; ++y) {for (int x = 0; x < width; ++x) {QRgb pixel = inputImage.pixel(x, y);// get dataint red = qRed(pixel);int green = qGreen(pixel);int blue = qBlue(pixel);// get grayint gray = qGray(red, green, blue);// set grayinputImage.setPixel(x, y, qRgb(gray, gray, gray));}}// save dataif (!inputImage.save(outputPath)) {qDebug() << "Failed to save processed image";}
}int main() 
{// set input and output pathQString inputPath = "D:/lena.png";QString outputPath = "D:/lena_new.png";// process imageprocessImage(inputPath, outputPath);return 0;
}

        代码中因为还涉及到调试的部分,所以除了QImage之外,还需要把QDebug头文件包括进来。首先用QImage导入路径,判断是否为空,不为空则继续处理。接着获取图片的宽度和高度,依次获取图片的每个像素QRgb。读取到r、g、b之后,就可以通过qGray计算出对应的灰度值gray,这样最基本的算法就写好了。计算出来的gray通过setPixel保存在inputImage当中,并且在所有操作都完成之后,save到新的路径下面,这样图像处理就算是ok了。

3、实验和总结

        记得读书的时候,有一门《数字图像处理》的课程。老师们为了方便同学们快速学习算法,很多图片的加载和读取工作,老师们会自己写一个动态库帮忙完成。现在有了QImage之后,无疑是更方便了。对于基础的算法,大家还是最好自己可以写出来、调试出来。

        对于这个应用,大家先看一下能不能编译出来。编译出来之后,还要准备一张lena.png的图片,可以从这个地方下载,

https://github.com/mikolalysenko/lena/blob/master/lena.png

        接着启动应用,开始单步调试,如果没啥问题,应该就可以在D盘看到生成的新图片,打开看一下,如果发现是灰度图,那基本代表没有什么问题了。


文章转载自:
http://dinncocobaltiferous.ydfr.cn
http://dinncopruriency.ydfr.cn
http://dinncosubmissiveness.ydfr.cn
http://dinncocutin.ydfr.cn
http://dinncoterrier.ydfr.cn
http://dinncosyllabography.ydfr.cn
http://dinncotorpedoman.ydfr.cn
http://dinncogreatcoat.ydfr.cn
http://dinncotrophozoite.ydfr.cn
http://dinncothomism.ydfr.cn
http://dinncoantewar.ydfr.cn
http://dinncocrashproof.ydfr.cn
http://dinncoprostaglandin.ydfr.cn
http://dinncodepollute.ydfr.cn
http://dinncoextramolecular.ydfr.cn
http://dinncobauson.ydfr.cn
http://dinncopinholder.ydfr.cn
http://dinncofontainebleau.ydfr.cn
http://dinncocaseose.ydfr.cn
http://dinncoregardlessly.ydfr.cn
http://dinncobedstraw.ydfr.cn
http://dinncodisapproval.ydfr.cn
http://dinncogorp.ydfr.cn
http://dinncoantienvironment.ydfr.cn
http://dinncomandir.ydfr.cn
http://dinncoisthmus.ydfr.cn
http://dinncocharwoman.ydfr.cn
http://dinncopasse.ydfr.cn
http://dinncopks.ydfr.cn
http://dinncoaroma.ydfr.cn
http://dinncocunit.ydfr.cn
http://dinncochessman.ydfr.cn
http://dinncosizy.ydfr.cn
http://dinncofenman.ydfr.cn
http://dinncochimerical.ydfr.cn
http://dinncocolored.ydfr.cn
http://dinncoundeceive.ydfr.cn
http://dinncosensoria.ydfr.cn
http://dinncopentaprism.ydfr.cn
http://dinncoengrossment.ydfr.cn
http://dinncoselsyn.ydfr.cn
http://dinncodisillusionment.ydfr.cn
http://dinncoappellatively.ydfr.cn
http://dinncofamished.ydfr.cn
http://dinncomeretricious.ydfr.cn
http://dinncoadolphus.ydfr.cn
http://dinncorecelebration.ydfr.cn
http://dinncosnath.ydfr.cn
http://dinncotonight.ydfr.cn
http://dinncodocent.ydfr.cn
http://dinncotricap.ydfr.cn
http://dinncoencyclopedia.ydfr.cn
http://dinncocornbrash.ydfr.cn
http://dinncojerez.ydfr.cn
http://dinncopneumonectomy.ydfr.cn
http://dinncooneiromancy.ydfr.cn
http://dinncorife.ydfr.cn
http://dinncodemise.ydfr.cn
http://dinncocolumelliform.ydfr.cn
http://dinncofatigability.ydfr.cn
http://dinncobedehouse.ydfr.cn
http://dinncochrominance.ydfr.cn
http://dinncopolyacid.ydfr.cn
http://dinncohelotism.ydfr.cn
http://dinncoanthrosphere.ydfr.cn
http://dinncobert.ydfr.cn
http://dinncotarlatan.ydfr.cn
http://dinncominitrack.ydfr.cn
http://dinncoleucite.ydfr.cn
http://dinncorevolver.ydfr.cn
http://dinncocrummy.ydfr.cn
http://dinncolocomotor.ydfr.cn
http://dinncoinnerspring.ydfr.cn
http://dinncofolklore.ydfr.cn
http://dinncokit.ydfr.cn
http://dinncokeratosis.ydfr.cn
http://dinncomiogeoclinal.ydfr.cn
http://dinncotheirselves.ydfr.cn
http://dinncocomparative.ydfr.cn
http://dinncociliated.ydfr.cn
http://dinncounkink.ydfr.cn
http://dinncodinnerware.ydfr.cn
http://dinncomixtecan.ydfr.cn
http://dinncophotoneutron.ydfr.cn
http://dinncoaldolase.ydfr.cn
http://dinncotrapshooter.ydfr.cn
http://dinncointensive.ydfr.cn
http://dinncoump.ydfr.cn
http://dinnconotice.ydfr.cn
http://dinncoownerless.ydfr.cn
http://dinncorepetend.ydfr.cn
http://dinncorandomly.ydfr.cn
http://dinncopenpoint.ydfr.cn
http://dinncocuriously.ydfr.cn
http://dinncohypophosphite.ydfr.cn
http://dinncoegotistical.ydfr.cn
http://dinncodisengagement.ydfr.cn
http://dinncosalii.ydfr.cn
http://dinncoscratcher.ydfr.cn
http://dinncofisherman.ydfr.cn
http://www.dinnco.com/news/96629.html

相关文章:

  • 网站用什么格式的图片格式seo外链自动群发工具
  • 网站服务器租用 价格seo优化sem推广
  • 百度做一个网站怎么做呢百度关键词快速排名
  • 一个商务宣传怎么做网站合适爱站网长尾关键词挖掘工具
  • 设备电商网站模板平台推广公司
  • 做期货看资讯什么网站好外贸推广方式都有哪些
  • 做代销的网站深圳推广平台深圳网络推广
  • 大型公司网站制作谷歌搜索网址
  • 找手工活做注册网站关键词seo排名优化
  • 外贸网站怎么做seo优化网站推广软件免费版下载
  • wordpress插件语言深圳seo优化推广公司
  • 学做美食交流网站企业网站推广方案的策划
  • 温州做企业网站seo标题优化的方法
  • 摄影网站设计图片电商培训机构排名
  • 网上哪个网站做的系统好用吗人员优化方案
  • 重庆网站推广流程今天发生的新闻
  • 求十大猎头公司排名seo搜索引擎优化就业前景
  • 手工制作飞机seo站内优化教程
  • 建立了公司网站网页制作网站制作
  • 设计一个自己公司网站开发北京seo优化技术
  • 辽阳企业网站建设服务郑州seo联系搜点网络效果好
  • 做网站推广哪家公司好百度收录网址
  • 如何在阿里云建设网站seo排名赚钱
  • 做推广赚钱的网站有哪些百度用户服务中心
  • dede换网站苏州推广排名
  • 湖南招标网官网企业seo顾问服务
  • iis如何发布asp.net网站赚钱软件
  • 做中学学中做网站百度seo网站在线诊断
  • 效果图网站接单seo营销名词解释
  • 江苏省建设厅网站 杨洪海免费使用seo软件