实现效果
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <zbar.h>
#include <time.h>
#include <iostream>
using namespace std;
using namespace zbar;
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
cam = NULL;
timer = new QTimer(this);
imag = new QImage();
connect(timer, SIGNAL(timeout()), this, SLOT(readFrame()));
connect(timer, SIGNAL(timeout()), this, SLOT(scancode()));
connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(on_pushButton_cliked()));
connect(ui->pushButton_2, SIGNAL(clicked()), this, SLOT(on_pushButton_2_clicked()));
}
MainWindow::~MainWindow()
{