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

广东网站建设微信商城开发下载手机微信

广东网站建设微信商城开发,下载手机微信,橘色网站模板,wordpress登陆后跳转到首页提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录 前言一、Qt OPENCV 安装测试?1. 安装qt2.安装opencv 的基础库3. 安装的路就决定了不会一帆风顺3.1.QT 安装出错3.2 运行Qt错误 4. opencv实际路径&#…

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档

文章目录

  • 前言
  • 一、Qt OPENCV 安装测试?
    • 1. 安装qt
    • 2.安装opencv 的基础库
    • 3. 安装的路就决定了不会一帆风顺
      • 3.1.QT 安装出错
      • 3.2 运行Qt错误
    • 4. opencv实际路径,添加入Qt工程中
  • 二、使用步骤
    • 1.框架
      • 1. 开启摄像头
      • 2.获取显示图像的内容
    • 2.测试
      • 2.1opencv 调用摄像头发现调用失败反复查找问题,
        • 2.1.1查看摄像头所有参数指令
  • 三、接着测试
    • 1.出现问题1:
    • 2.中途去开启了摄像头做了重启
    • 3.效果如图所示:
  • 总结


前言

提示:这里可以添加本文要记录的大概内容:

嵌入式图像处理


提示:以下是本篇文章正文内容,下面案例可供参考

一、Qt OPENCV 安装测试?

示例:树莓派opencv 的安装方法很多,

  • 一种是下载源码编译然后安装,这种叫做大神。要最新,要全还得自己编译。
  • 一种是通过指令直接下载对应的opencv依赖项,应该是树莓派生态比较好,所以能应用的资源比较多。
    以下是这类安装的方法,但是就是这类的安装还是有一堆问题
    c++ opencv 树莓派运行往下将变得简单,

1. 安装qt

输入一下指令

sudo apt-get install qt5-default
sudo apt-get install qtcreator

在这里插入图片描述
Qt 安装完毕后记得检测一下编译器路径是否对了。
在这里插入图片描述

2.安装opencv 的基础库

一直以为安装opencv c++的库要重新编译树莓派环境下的源码,直到看了大佬的视频才明白,原来只安装依赖项就可以用了,这个真的很省事
命令如下:安装往后记得找一下文件的路径

sudo apt-get install libopencv-devsudo find / -name "libopencv_core.so"

在这里插入图片描述

3. 安装的路就决定了不会一帆风顺

3.1.QT 安装出错

安装时遇到错误,
在ubuntu22.04上安装qt5-defualt时,我会得到以下错误。sudo apt-get install qt5-default
复制
产出:Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package qt5-default is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another sourceE: Package 'qt5-default' has no installation candidate

Stack Overflow用户
发布于 2022-10-18 20:28:25

Ubuntu22.04存储库没有qt5-默认包。
解决了Qt安装出错的问题

您可以通过安装qtbase5 5-dev来获得预构建的库。

sudo apt install qtbase5-dev qt5-qmake

在这里插入图片描述

3.2 运行Qt错误

在这里插入图片描述
在这里插入图片描述
更改编译器,解决了Qt运行出错的问题
在这里插入图片描述
查找摄像头设备,为测试做准备
在这里插入图片描述

在这里插入图片描述

4. opencv实际路径,添加入Qt工程中

INCLUDEPATH +=/usr/include/opencv4\
/usr/include/opencv4/opencv2LIBS +=usr/lib/arm-linux-gnueabihf/libopencv_*.so

在这里插入图片描述
在这里插入图片描述

二、使用步骤

1.框架

在这里插入图片描述

1. 开启摄像头

测试:
静态图像
动态图像

raspistill  //静态图像
raspivid    //动态图像

2.获取显示图像的内容

代码

QT       += core guigreaterThan(QT_MAJOR_VERSION, 4): QT += widgetsCONFIG += c++11# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0SOURCES += \main.cpp \mainwindow.cppHEADERS += \mainwindow.hFORMS += \mainwindow.ui# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += targetINCLUDEPATH +=/usr/include/opencv4\
/usr/include/opencv4/opencv2LIBS +=/usr/lib/arm-linux-gnueabihf/libopencv_*.so
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QLabel>
#include <QPixmap>
#include <QFileDialog>
#include <QDebug>#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>using namespace cv;MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), ui(new Ui::MainWindow)
{ui->setupUi(this);
}MainWindow::~MainWindow()
{delete ui;
}void MainWindow::on_pushButton_clicked()
{// 读取图像文件
//    Mat image = imread("1.jpg");//    // 将OpenCV图像转换为Qt图像类型
//    QImage qImage(image.data, image.cols, image.rows, QImage::Format_RGB888);
//    QPixmap qPixmap = QPixmap::fromImage(qImage);
//    ui->label->setPixmap(qPixmap);// 创建窗口和标签来显示图像// QWidget window;// QLabel label(this);//    label.setPixmap(qPixmap);// window.setCentralWidget(&label);//window.show();// Mat image = imread("1.jpg");// 将OpenCV图像转换为Qt图像类型
//    QImage qImage(image.data, image.cols, image.rows, QImage::Format_RGB888);
//    QPixmap qPixmap = QPixmap::fromImage(qImage);
//    ui->label->setPixmap(qPixmap);QString fileName = QFileDialog::getOpenFileName(this, "选择图片", "", "Images (*.jpg *.png)");if (!fileName.isEmpty()) {// 读取OpenCV图片cv::Mat image = cv::imread(fileName.toUtf8().constData(), cv::IMREAD_COLOR);if (!image.empty()) {// 将OpenCV图片转换为Qt格式QImage qtImage = QImage((const unsigned char*)(image.data), image.cols, image.rows, image.cols * image.channels(), QImage::Format_RGB888);// 显示图片在标签中ui->label->setPixmap(QPixmap::fromImage(qtImage));//imageLabel->setPixmap(QPixmap::fromImage(qtImage));} else {qDebug() << "Failed to load image:" << fileName;}}}

2.测试

2.1opencv 调用摄像头发现调用失败反复查找问题,

2.1.1查看摄像头所有参数指令
ls /dev/video*
v4l2-ctl --info -d /dev/video0 --list-formats-ext

查看结果

pi@raspberrypi:~ $ s /dev/video*
bash: s: command not found
pi@raspberrypi:~ $  /dev/video*
bash: /dev/video0: Permission denied
pi@raspberrypi:~ $ ls /dev/video*
/dev/video0   /dev/video12  /dev/video15  /dev/video19  /dev/video22
/dev/video10  /dev/video13  /dev/video16  /dev/video20  /dev/video23
/dev/video11  /dev/video14  /dev/video18  /dev/video21  /dev/video31
pi@raspberrypi:~ $ v4l2-ctl --info -d /dev/video0 --list-formats-ext
Driver Info:Driver name      : unicamCard type        : unicamBus info         : platform:fe801000.csiDriver version   : 6.1.21Capabilities     : 0xa5a00001Video CaptureMetadata CaptureRead/WriteStreamingExtended Pix FormatDevice CapabilitiesDevice Caps      : 0x25200001Video CaptureRead/WriteStreamingExtended Pix Format
Media Driver Info:Driver name      : unicamModel            : unicamSerial           : Bus info         : platform:fe801000.csiMedia version    : 6.1.21Hardware revision: 0x00000000 (0)Driver version   : 6.1.21
Interface Info:ID               : 0x03000005Type             : V4L Video
Entity Info:ID               : 0x00000003 (3)Name             : unicam-imageFunction         : V4L2 I/OFlags         : defaultPad 0x01000004   : 0: SinkLink 0x02000007: from remote pad 0x1000002 of entity 'ov5647 10-0036': Data, Enabled, Immutable
ioctl: VIDIOC_ENUM_FMTType: Video Capture[0]: 'YUYV' (YUYV 4:2:2)Size: Stepwise 16x16 - 16376x16376 with step 1/1[1]: 'UYVY' (UYVY 4:2:2)Size: Stepwise 16x16 - 16376x16376 with step 1/1[2]: 'YVYU' (YVYU 4:2:2)Size: Stepwise 16x16 - 16376x16376 with step 1/1[3]: 'VYUY' (VYUY 4:2:2)Size: Stepwise 16x16 - 16376x16376 with step 1/1[4]: 'RGBP' (16-bit RGB 5-6-5)Size: Stepwise 16x16 - 16376x16376 with step 1/1[5]: 'RGBR' (16-bit RGB 5-6-5 BE)Size: Stepwise 16x16 - 16376x16376 with step 1/1[6]: 'RGBO' (16-bit A/XRGB 1-5-5-5)Size: Stepwise 16x16 - 16376x16376 with step 1/1[7]: 'RGBQ' (16-bit A/XRGB 1-5-5-5 BE)Size: Stepwise 16x16 - 16376x16376 with step 1/1[8]: 'RGB3' (24-bit RGB 8-8-8)Size: Stepwise 16x16 - 16376x16376 with step 1/1[9]: 'BGR3' (24-bit BGR 8-8-8)Size: Stepwise 16x16 - 16376x16376 with step 1/1[10]: 'RGB4' (32-bit A/XRGB 8-8-8-8)Size: Stepwise 16x16 - 16376x16376 with step 1/1[11]: 'BA81' (8-bit Bayer BGBG/GRGR)Size: Stepwise 16x16 - 16376x16376 with step 1/1[12]: 'GBRG' (8-bit Bayer GBGB/RGRG)Size: Stepwise 16x16 - 16376x16376 with step 1/1[13]: 'GRBG' (8-bit Bayer GRGR/BGBG)Size: Stepwise 16x16 - 16376x16376 with step 1/1[14]: 'RGGB' (8-bit Bayer RGRG/GBGB)Size: Stepwise 16x16 - 16376x16376 with step 1/1[15]: 'pBAA' (10-bit Bayer BGBG/GRGR Packed)Size: Stepwise 16x16 - 16376x16376 with step 1/1[16]: 'BG10' (10-bit Bayer BGBG/GRGR)Size: Stepwise 16x16 - 16376x16376 with step 1/1[17]: 'pGAA' (10-bit Bayer GBGB/RGRG Packed)Size: Stepwise 16x16 - 16376x16376 with step 1/1[18]: 'GB10' (10-bit Bayer GBGB/RGRG)Size: Stepwise 16x16 - 16376x16376 with step 1/1[19]: 'pgAA' (10-bit Bayer GRGR/BGBG Packed)Size: Stepwise 16x16 - 16376x16376 with step 1/1[20]: 'BA10' (10-bit Bayer GRGR/BGBG)Size: Stepwise 16x16 - 16376x16376 with step 1/1[21]: 'pRAA' (10-bit Bayer RGRG/GBGB Packed)Size: Stepwise 16x16 - 16376x16376 with step 1/1[22]: 'RG10' (10-bit Bayer RGRG/GBGB)Size: Stepwise 16x16 - 16376x16376 with step 1/1[23]: 'pBCC' (12-bit Bayer BGBG/GRGR Packed)Size: Stepwise 16x16 - 16376x16376 with step 1/1[24]: 'BG12' (12-bit Bayer BGBG/GRGR)Size: Stepwise 16x16 - 16376x16376 with step 1/1[25]: 'pGCC' (12-bit Bayer GBGB/RGRG Packed)Size: Stepwise 16x16 - 16376x16376 with step 1/1[26]: 'GB12' (12-bit Bayer GBGB/RGRG)Size: Stepwise 16x16 - 16376x16376 with step 1/1[27]: 'pgCC' (12-bit Bayer GRGR/BGBG Packed)Size: Stepwise 16x16 - 16376x16376 with step 1/1[28]: 'BA12' (12-bit Bayer GRGR/BGBG)Size: Stepwise 16x16 - 16376x16376 with step 1/1[29]: 'pRCC' (12-bit Bayer RGRG/GBGB Packed)Size: Stepwise 16x16 - 16376x16376 with step 1/1[30]: 'RG12' (12-bit Bayer RGRG/GBGB)Size: Stepwise 16x16 - 16376x16376 with step 1/1[31]: 'pBEE' (14-bit Bayer BGBG/GRGR Packed)Size: Stepwise 16x16 - 16376x16376 with step 1/1[32]: 'BG14' (14-bit Bayer BGBG/GRGR)Size: Stepwise 16x16 - 16376x16376 with step 1/1[33]: 'pGEE' (14-bit Bayer GBGB/RGRG Packed)Size: Stepwise 16x16 - 16376x16376 with step 1/1[34]: 'GB14' (14-bit Bayer GBGB/RGRG)Size: Stepwise 16x16 - 16376x16376 with step 1/1[35]: 'pgEE' (14-bit Bayer GRGR/BGBG Packed)Size: Stepwise 16x16 - 16376x16376 with step 1/1[36]: 'GR14' (14-bit Bayer GRGR/BGBG)Size: Stepwise 16x16 - 16376x16376 with step 1/1[37]: 'pREE' (14-bit Bayer RGRG/GBGB Packed)Size: Stepwise 16x16 - 16376x16376 with step 1/1[38]: 'RG14' (14-bit Bayer RGRG/GBGB)Size: Stepwise 16x16 - 16376x16376 with step 1/1[39]: 'GREY' (8-bit Greyscale)Size: Stepwise 16x16 - 16376x16376 with step 1/1[40]: 'Y10P' (10-bit Greyscale (MIPI Packed))Size: Stepwise 16x16 - 16376x16376 with step 1/1[41]: 'Y10 ' (10-bit Greyscale)Size: Stepwise 16x16 - 16376x16376 with step 1/1[42]: 'Y12P' (12-bit Greyscale (MIPI Packed))Size: Stepwise 16x16 - 16376x16376 with step 1/1[43]: 'Y12 ' (12-bit Greyscale)Size: Stepwise 16x16 - 16376x16376 with step 1/1[44]: 'Y14P' (14-bit Greyscale (MIPI Packed))Size: Stepwise 16x16 - 16376x16376 with step 1/1[45]: 'Y14 ' (14-bit Greyscale)Size: Stepwise 16x16 - 16376x16376 with step 1/1

三、接着测试

本来以为很ok了,结果还是遇到了大问题;
调用:
videocapture =new VideoCapture(0, cv::CAP_V4L2);

1.出现问题1:

open VIDEOIO(V4L2:/dev/video0): can‘t open camera by index

解决:
参考链接:

https://blog.csdn.net/u011304078/article/details/132740921

输入: ls /dev/video* -l    
  1. 这个是权限问题,直接通过chmod修改摄像头的权限,如果摄像头挂载到系统的设备名是/dev/video0,输入如下命令后,问题得到解决。
sudo chmod 777 /dev/video0

2.中途去开启了摄像头做了重启

打开摄像头模块
1、在树莓派终端中输入以下命令,打开配置:

sudo raspi-config

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

3.效果如图所示:

在这里插入图片描述
Qt 安装好后的软件展示
在这里插入图片描述

总结

学习框架和测试,用一种不用编译opencv源码的方式,成功的将Qt和opencv 用c++的方式运行了起来,写了基本图像处理的框架,接下来将测试摄像头的参数和相关设置


文章转载自:

http://bPFqNHBz.tLLws.cn
http://KLg2Xaqn.tLLws.cn
http://VMEK4UKM.tLLws.cn
http://gsDG9MsA.tLLws.cn
http://lqBsnDl0.tLLws.cn
http://BrcU6mXI.tLLws.cn
http://YvLd3Mmc.tLLws.cn
http://9pRbla48.tLLws.cn
http://R6zCsAJy.tLLws.cn
http://06c5klU7.tLLws.cn
http://85XXoJ58.tLLws.cn
http://EPsfsTjq.tLLws.cn
http://9RtlTbUr.tLLws.cn
http://ui5sUeOp.tLLws.cn
http://lUm5c0Rn.tLLws.cn
http://IhwRNHre.tLLws.cn
http://VCf3GyM4.tLLws.cn
http://P2nZn1Ie.tLLws.cn
http://S2316ivT.tLLws.cn
http://UVWw6T8d.tLLws.cn
http://UdAIG27r.tLLws.cn
http://ozCOSKZ8.tLLws.cn
http://iYkzYV6b.tLLws.cn
http://0CUHvETK.tLLws.cn
http://6hNdnUzT.tLLws.cn
http://wRDQbOvd.tLLws.cn
http://QUpr9JDf.tLLws.cn
http://Rh4n9I2r.tLLws.cn
http://FgWKHBqn.tLLws.cn
http://vdGjV2UI.tLLws.cn
http://www.dtcms.com/wzjs/639942.html

相关文章:

  • 市场营销策划ppt免费模板网站优化的文章
  • 企业网站怎么扣费的青海住房与建设厅网站
  • 邢台高端网站建设重庆网站建设cq
  • 未备案网站查询阿里巴巴做网站需要多少钱
  • 课堂资源管理网站开发需求分析企业网站公示怎么做
  • 重庆模板网站哪个好网站怎么做才是对搜索引擎友好
  • 做简单网站怎么做.tv可以做门户网站不
  • 旅游商务网站开发好用的wordpress编辑器
  • 公司的网站的设计网站制作时间代码
  • 做企业网站需要买什么资料湖南网站建设公司 尖端磐石网络
  • 大连网站开发公司电话朋友 合同 网站制作
  • dw做网站乱码wordpress 板块
  • 网站后台设置关键词在哪设网站app封装怎么做
  • 商务网站模板下载公司网站如何做宣传
  • 潮动九州网站建设网站开发技术流程
  • 凡科做的网站手机版织梦网站栏目如何做下拉
  • 国外在线代理服务器免费吉林seo推广系统
  • 微网站域名惠州网络问政平台官网
  • 网站开发需要怎么做平面广告设计行业
  • 网站建设方案可以乱写吗简单描述一下网站制作的流程
  • wordpress 文章标签调用seo营销培训咨询
  • 论文网站建设格式辽宁建设厅查询网站首页
  • 如何做视频卖给网站电子网站
  • 网站建设的流程图示网站流量太高 如何做负载均衡
  • 公众号里链接的网站怎么做的网站建设的重要性
  • 宁波公司做网站美食网站建设内容规划
  • 网站连锁店查询怎么做郴州刚刚发生的事
  • wordpress直播网站主题目前最好的找工作平台
  • 网站建设与管理职责ui网页设计学院
  • 网站建设售后服务承诺顶尖文案网站