QT 下OpenCV显示图片

opencv+QT+vs 中显示图片总结 opencv支持QT,QT也有vs插件,所以学习一下用QT显示图片的方法,实现的是图片的读取显示与反转显示。 各种配置完成之后,在vs中新建一个qt项目,项目名字不要有中文,一路确定、下一步,直到完成。在项目下面会自动生成一些文件。.ui为qt设计文件,双击出现 qt设计师 程序,在这当中可以自由拖拽控件来设计界面。 如图,使用 两个按键 两个label 两个scrollarea。 主要用 阅读详情

1,一开始写的程序如下

#include "highgui.h" 

 

int main( int argc, char** argv ) 

{ 

   // 是一个高层调用接口,它通过文件名确定被加载文件的格式; 

   // 且该函数自动分配图像数据结构所需的内存。 

   // cvLoadImage可以读取大多数格式的图像文件,BMP、DIB、JPEG、JPE、PNG、BBM、PPM 

   // SR、RAS、TIFF 

   // 函数执行完后返回一个指针,此指针指向一块为描述该图像文件的数据结构而分配的内存块。 

   IplImage* img = cvLoadImage( argv[1] ,CV_LOAD_IMAGE_ANYCOLOR); 

   //  cvNamedWindow由HighGUI库提供,用于在屏幕上创建一个窗口,将被显示的图像包含于该窗口中。 

   // 函数第一个参数指定了窗口的的窗口标题。 

   // 如果要使用HighGUI库所提供的其他函数与该窗口进行交互,我们将通过该参数值引用这个窗口中。 

  cvNamedWindow("Example1", CV_WINDOW_AUTOSIZE ); 

   // 显示该图像 

   cvShowImage("Example1", img ); 

   // 使程序暂停,等待用户触发一个按键操作,但如果该函数参数设为一个正数,则程序将暂停一段时间, 

   // 时间长为该整数值个毫秒单位 

   // 如果设置为0,那么将一直等待用户触发按键操作。 

   cvWaitKey(0); 

   // 内存释放功能 

  cvReleaseImage( &img ); 

   // 关闭窗口 

   cvDestroyWindow("Example1"); 

} 

这个是调用了/usr/local/lib下面的openCV库文件,交叉编译后下载到开发板,由于板子没有这个GTK这个桌面系统,所以只能建立在QT系统上,

2,使用QT建立源程序

#include"widget.h"

#include"ui_widget.h"

#include<QDebug>

#include"cv.h"

Widget::Widget(QWidget*parent):

    QWidget(parent),

    ui(

Linux下 QT+Opencv 写一个图片显示程序 我的opencv版本是3.4,QT版本是5.3.0 废话不多说直接开始 1首先用QT new一个project  选择QT Widgets Application 然后直接下一步,把Name改成HelloWorld,然后就一直下一步就可以了。 最后的工程截图应该是个这样子 2.界面设置 点击mainwindow.ui 拖出以下界面 其实就是一个Label+Push B... 阅读详情

相关推荐

使用Qt显示OpenCV读取的图片

OpenCV自带了一部分常用的GUI功能,但是更多的图像处理功能需要其他GUI框架来辅助实现,这里通过QT来显示OpenCV读取的图片。

QtCompany的博客 1411

在QT集成开发环境中用OpenCV读取一张图片显示在Qlabel上

开发环境:ubuntu Opencv3.0.0 QT4上一篇文章我们用OpenCV显示了一张图片,现在我们要将读取来的图片显示在QT的标签上。1首先新建一个工程 点击choose,然后一直下一步。 然后会看到这样的一个工程。2在.pro中添加OpenCV库有两种写法 第一种 CONFIG += link_pkgconfig PKGCONFIG += opencv第二种INCLUDEPA

Adorkable_yu的博客 4308

Qt+OpenCV显示图片的两种方法(代码演示)

OpenCV本身提供了一些GUI方法,但使用起来仍有局限性。以C++为例,实际应用中我们大多会使用Qt或MFC来编写GUI程序。相较之下,Qt比MFC更易上手且界面样式更丰富,所以越来越多的C++视觉开发者和公司都倾向用Qt做视觉项目的GUI。Qt中显示OpenCV图像常用的方法有两种,一种是使用QLabel显示,另一种是QGraphicsView显示。

Color Space的博客 3884

利用OpenCV和Qt设计图片显示GUI应用

本文还有配套的精品资源,点击获取 简介:在计算机视觉领域,OpenCV是图像处理和视觉任务的重要工具。为了增强用户交互性,需要图形用户界面(GUI),而Qt则提供了创建美观且功能丰富用户界面的能力。本教程将介绍如何在VS2008环境下,通过结合OpenCV和Qt,构建一个能够显示图片的GUI应用程序。首先,确保系统安装了OpenCV、Qt库和Visual Studio 20...

weixin_42462474的博客 866

QT中通过opencv显示图片

QT中通过opencv显示图片

适合小白的超详细yolov8环境配置+实例运行教程,从零开始教你如何使用yolov8训练自己的数据集(Windows+conda+pycharm)

yolov8源码下载地址:GitHub - ultralytics/ultralytics: NEW - YOLOv8 🚀 in PyTorch > ONNX > OpenVINO > CoreML > TFLiteyolov8使用文档: Home - Ultralytics YOLOv8 Docs教学视频参考: 包会!YOLOv8训练自己的数据集_哔哩哔哩_bilibili先用conda prompt创建一个虚拟环境,我的叫yolov8, python版本用3.10 源码地址:GitHub - ul

CV在读 25万+

FortiClient EMS实战:从安装到配置的全流程优化指南

本文详细解析了FortiClient EMS 7.0版本的部署与优化全流程,帮助企业构建零信任终端安全体系。从环境规划、高效安装、终端纳管到高级运维,提供实战指南和优化技巧,特别适用于Windows Server环境,助力企业提升终端安全管理效率。

weixin_29325007的博客 547

Win11注册表没有MMC的解决方法

本文详细介绍了在Win11系统中解决注册表没有MMC项的问题的方法。通过创建并导入注册表修复文件,我们可以成功地在注册表中添加缺失的MMC项。在操作过程中,需要注意备份注册表、以管理员身份运行工具以及系统更新等事项。希望本文能够帮助到遇到类似问题的用户,提高系统管理的效率和便捷性。如果你还有其他关于Windows操作系统的问题或疑问,欢迎随时提问并寻求帮助。

nntxthml的博客 1552

金融波动率的“捕手”:GARCH模型,揭秘市场波动的“聚集密码”

摘要: GARCH模型(广义自回归条件异方差)是金融时间序列分析中用于捕捉“波动聚类”现象的核心工具。传统模型(如ARIMA)无法刻画金融数据的时变波动特性,而GARCH通过建模条件方差的动态变化(如$\sigma_t^2 = \omega + \alpha \varepsilon_{t-1}^2 + \beta \sigma_{t-1}^2$),精准预测波动率。Python实战显示,GARCH能有效拟合模拟金融数据的波动聚类,残差无自相关,验证了其优越性。该模型在波动率预测、风险价值(VaR)计算和期权定

u010257409的博客 2054

MTK Camera HAL 与 FeaturePipe 架构解析:从硬件抽象到功能管线的工程落地路径

MTK 的 Camera 系统在 Android 平台下采用高度模块化的 HAL 与 FeaturePipe 架构组合,分别承担着底层硬件抽象与上层功能封装的职责。通过将 ISP、3A 算法、Sensor 驱动与图像处理节点解耦封装于功能链条中,联发科平台实现了灵活可控的影像能力调度机制。本文将基于真实项目实践,系统解析 MTK Camera HAL 与 FeaturePipe 架构的设计思路、核心模块与运行机制,结合 AE/AWB/AF 控制流、Buffer 管理策略、功能管线构建方法与多线程调度实现方式

努力分享一些人工智能、计算机视觉、影像等相关的知识干货! 1570

上海计算机学会2020年5月月赛C++乙组T2经济普查

中国正在以前所未有的力度推进脱贫攻坚,国家计划在2020年使得在现行标准下的贫困人口实现全面脱贫,为此,需要对居民的经济状况进行普查。 题目描述 给定一个正整数n,表示人口数量。一开始,每个居民拥有的财产记为a1​,a2​,⋯,an​,财产可能发生两种变化: 一种来源于个体,由某个居民的经济活动而产生。在某个时刻,某个居民的财产会直接变成某个数值,可能升高也可能降低。 一种来源于政策,在某个时刻,国家会对财产低于某个标准线全部的居民,实施政策支持,使得他们的财产全部正好到达标准线。 给定这些变

长春高老师编程 905

【Frida Android】实战篇4:SSL Pinning 证书绑定绕过 Hook 教程(一)

在前两章中,我们学习了中间人抓包与 Hook 抓包的基础方法,这些方法在理想环境下能够有效获取网络请求数据。但在实际的企业级应用中,出于安全防护需求,很多 APP 会启用证书绑定(SSL Pinning)机制。这种机制会让客户端对服务器证书的校验更为严格,导致常规的抓包方法(即使将 BurpSuite/Charles 证书安装到系统信任区)也无法生效。因此,从本章开始,我们将系统学习 SSL Pinning 机制的绕过技术。SSL Pinning(证书绑定)是客户端校验服务器身份的进阶安全机制。

水滴石穿 1610

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

上一篇: 单片机发送中文短信
下一篇: 多驱动 多设备编程,
「已注销」
博客等级 码龄16年 2粉丝 7原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

「已注销」

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值