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

东莞贸易公司寮步网站建设价格怎么自己弄一个平台

东莞贸易公司寮步网站建设价格,怎么自己弄一个平台,免费网站建站下载,南昌盗网站少优化公司提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录 前言一、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://www.dtcms.com/wzjs/452216.html

相关文章:

  • 个人网站链接怎么做济南网站建设老威
  • 哪里有做图片的网站培训机构排名一览表
  • 深圳网站建设迅美百度精准搜索
  • 可以做网站啦啦啦资源视频在线观看8
  • 网站新功能演示用什么技术做的域名注册查询阿里云
  • 网站建设可行性seo范畴有哪些
  • 求免费网站能看的2021叶涛网站推广优化
  • 海东高端网站建设价格百度网址安全中心怎么关闭
  • 搭建影视网站违法幽默广告软文案例
  • 怎样做自己的网站和发布网站企业网站注册域名的步骤
  • windows7PHP网站建设百度seo快速排名优化
  • 手机网页免费制作app衡阳百度seo
  • 李沧做网站公司搜索引擎排名优化技术
  • 网站建设自建的优点网络营销pdf
  • 用div css做网站首页阿里域名注册网站
  • 做网站需要成立公司吗地推app
  • 灵感网站网络推广常见的方法
  • 武汉建筑工程有限公司网站关键词排名优化软件
  • 如何免费做网站优化网络营销方式与工具有哪些
  • 怎么设置网站字体漯河网络推广哪家好
  • 金华网站建设行业女排联赛最新排行榜
  • pc网站如何做sp企业建站流程
  • 网页广告太多怎么办深圳的seo网站排名优化
  • 网页站点什么意思网络客服
  • 网站建设工作有底薪吗网店如何推广自己的产品
  • 做网站公司好开吗网站功能优化的方法
  • 蛋糕设计网站买外链网站
  • 自动化毕设题目网站开发百度认证
  • 成都注册公司核名网站技能培训有哪些
  • 4s店网站建设方案seo关键词优化系统