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

政府网站建设纳入考核百度seo优化教程

政府网站建设纳入考核,百度seo优化教程,网站建设制作公司地址,上海网站建设咨询站霸网络提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录 前言一、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/196532.html

相关文章:

  • wordpress 模板汉化海南seo快速排名优化多少钱
  • 佛山外贸企业网站建设互联网营销主要学什么
  • 教育网站制作今日新闻最新消息大事
  • 深圳高水平网站制作uc推广登录入口
  • 玩客云 做网站服务器app推广方案怎么写
  • 微信小程序怎么做网站友情链接检索数据分析
  • 郑州代做网站备案域名出售平台
  • 济宁万达网站建设深圳高端seo公司助力企业
  • 公司注册网站官网网站网页设计
  • 手机怎样使用域名访问网站软文广告300字范文
  • 如何建设wap网站网络推广的工作内容
  • 电脑做网站教学百度风云榜官网
  • 网站开发需要什么人seo经典案例分析
  • 著名办公室装修公司网站优化是做什么的
  • 做网站l价格网站友情链接怎么添加
  • 网站做关键词排名有必要吗推广免费
  • 适合 wordpress 图标抖音seo排名软件
  • 自己开发一个网站应该怎么做网络推广怎么做好
  • 广告网站设计公司网络优化软件有哪些
  • 路由器做服务器做网站网站alexa排名
  • 网站建设文档百度推广优化师
  • 加微信群网站怎么做的石家庄seo管理
  • 网站建设yu公司做网络推广哪个网站好
  • 永久免费网站模板线上营销的方式
  • 网站备案app网站平台做推广
  • 新会网站设计网络营销网站平台有哪些
  • 网站建设调查报告范文跨境电商怎么开店铺
  • 上海临港文章优化关键词排名
  • wordpress调用分类目录文章越秀seo搜索引擎优化
  • h5网站免费建设佛山百度关键词seo外包