#include "gui.h"
#include "ui_gui.h"
Gui::Gui(QWidget *parent) :
QWidget(parent),
ui(new Ui::Gui)
{
ui->setupUi(this);
V.open(0);
timer.start(FPS);
// frame = new QFrame();
//connect(&timer,SIGNAL(timeout()),this,SLOT(showImage()));
//connect(&showVideo,SIGNAL(clicked),this,SLOT(showImage()));
}
Gui::~Gui()
{
delete ui;
}
void Gui::showImage()
{
V>>im;
cvtColor(im,im,CV_BGR2RGB);
update();
}
void Gui::paintEvent(QPaintEvent *)
{
QImage img((unsigned char*)im.data,im.cols,im.rows,QImage::Format_RGB888);
// QFrame *frame = new QFrame();
QPainter painter(this);
painter.drawImage(-1,-1,img);
}
void Gui::on_showVideo_clicked()
{
showImage();
}