什么是DAPP智能合约系统开发技术方案丨智能合约区块链DAPP项目系统开发流程

简介: 什么是DAPP智能合约系统开发技术方案丨智能合约区块链DAPP项目系统开发流程

具体实现
qtcameratest01.h修改如下:

pragma once

include <QtWidgets/QMainWindow>

include "ui_qtcameratest01.h"

include <opencv2/core.hpp>

include <opencv2/highgui.hpp>

include <opencv2/videoio.hpp> // for camera

using namespace cv;

class qtcameratest01 : public QMainWindow
{

Q_OBJECT

public:

qtcameratest01(QWidget *parent = Q_NULLPTR);

private:

Ui::qtcameratest01Class ui;
QTimer *timer;
Mat frame;
QImage image;
VideoCapture cap1;
private slots:
void opencam();
void nextFrame();
void closeCamara();
void camshot();

};
static QImage Mat2QImage(Mat& image);
qtcameratest01.cpp文件修改如下:

include "qtcameratest01.h"

include

include

include <opencv2/core.hpp>

include <opencv2/highgui.hpp>

include <opencv2/videoio.hpp> // for camera

include <opencv.hpp>

using namespace cv;

qtcameratest01::qtcameratest01(QWidget *parent)

: QMainWindow(parent)

{

// 初始化
timer = new QTimer(this);
timer->stop();
ui.setupUi(this);
connect(ui.OpenCamBtn, SIGNAL(clicked()), this, SLOT(opencam()));
connect(timer, SIGNAL(timeout()), this, SLOT(nextFrame()));
connect(ui.CloseCamBtn, SIGNAL(clicked()), this, SLOT(closeCamara()));
connect(ui.CamshotBtn, SIGNAL(clicked()), this, SLOT(camshot()));

}
void qtcameratest01::opencam()
{

if (cap1.isOpened())
    cap1.release();
double rate = cap1.get(CV_CAP_PROP_FPS);
try
{
    cap1.open(0);
    
    cap1 >> frame;
    if (!frame.empty())
    {
        timer->setInterval(rate);
        timer->start();
    }
    
}
catch (const std::exception&)
{
    QMessageBox::critical(NULL, "ERROR", "打开失败",QMessageBox::Close);
}

}
static QImage Mat2QImage(Mat& image)
{

QImage img;

if (image.channels() == 3) {
    cvtColor(image, image, CV_BGR2RGB);
    img = QImage((const unsigned char *)(image.data), image.cols, image.rows,
        image.cols*image.channels(), QImage::Format_RGB888);
}
else if (image.channels() == 1) {
    img = QImage((const unsigned char *)(image.data), image.cols, image.rows,
        image.cols*image.channels(), QImage::Format_ARGB32);
}
else {
    img = QImage((const unsigned char *)(image.data), image.cols, image.rows,
        image.cols*image.channels(), QImage::Format_RGB888);
}

return img;

}

void qtcameratest01::nextFrame()
{

cap1 >> frame;
if (!frame.empty())
{
    image = Mat2QImage(frame);
    QImage* imgScaled = new QImage;
    QImage* imgc = &image;
    *imgScaled = imgc->scaled(ui.campicreal->width(), ui.campicreal->height(), Qt::KeepAspectRatio);

    ui.campicreal->setPixmap(QPixmap::fromImage(*imgScaled));
}

}
void qtcameratest01::closeCamara()
{

timer->stop();//停止读取数据。
cap1.release();//释放内存;  

}
void qtcameratest01::camshot()
{

QImage* imgScaled = new QImage;
QImage* imgc = &image;
*imgScaled = imgc->scaled(ui.campicreal->width(), ui.campicreal->height(), Qt::KeepAspectRatio);

ui.campicshot->setPixmap(QPixmap::fromImage(*imgScaled));

}

相关文章
|
5天前
|
安全 区块链
区块链积分商城系统开发详细指南//需求功能/指南教程/源码流程
Developing a blockchain points mall system involves multiple aspects such as blockchain technology, smart contracts, front-end development, and business logic design. The following is the general process for developing a blockchain points mall system
|
5天前
|
安全 区块链
区块链农场游戏系统开发运营版/玩法详情/规则方案/案例设计/项目源码
Developing a blockchain farm game system is an interesting and challenging task. Here is a design solution that can help you get started developing such a system
|
6月前
|
测试技术 区块链 Android开发
区块链项目开发的合作服务流程指南
区块链项目开发的合作服务流程指南
|
6月前
|
供应链 监控 安全
企业如何搭建自己的联盟链 | 区块链落地项目运用开发
企业如何搭建自己的联盟链 | 区块链落地项目运用开发
|
5天前
|
供应链 区块链
区块链DAPP质押合约代币系统开发|模式方案
智能合约是一种数字化的合约,它将合约内容写入区块链中,保证了合约的公开透明
|
5天前
|
安全 AndFix 区块链
区块链3D元宇宙游戏系统开发规则玩法/步骤指南/源码项目
Developing a blockchain metaverse 3D game system is a complex and innovative process that requires comprehensive consideration of blockchain technology, game design and development, and virtual reality (VR). The following is the general process for developing the system:
|
5天前
|
存储 供应链 安全
新一代数据库技术——基于区块链的分布式存储系统
传统数据库系统通常采用集中式存储结构,容易受到单点故障和数据篡改的影响。本文将介绍基于区块链技术的分布式存储系统,探讨其在数据库领域的应用和优势,以及面临的挑战和未来发展趋势。
|
5天前
|
算法 区块链 Python
区块链代币DAPP逻辑系统开发技术方案丨单边上扬模式开发逻辑
区块链代币DAPP逻辑系统开发技术方案丨单边上扬模式开发逻辑
|
5月前
|
存储 安全 分布式数据库
区块链NFT合成代币质押分红系统开发模式
智能合约的运行记录会被保存在区块链上,这种去中心化的特性确保了交易的透明性和安全性
|
5月前
|
算法 数据管理 区块链
区块链合约代币质押项目系统开发模式详情
多链是一种新兴的区块链技术,其分片技术被称为“多链分片”

热门文章

最新文章