Exemplo n.º 1
0
Capture::Capture(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Capture)
{
    ui->setupUi(this);

    //initialize
    ///111
    take_photo_flag = 0;
    ///111
    num = 0;
    send_frame_flag = 0;
    //capture = NULL;
    //timer = new QTimer(this);
    photos = new Photos();

    this->first_open_cam_flag = 0;
    this->open_cam_flag=0;
    timer=new QTimer(this);
    connect(timer,SIGNAL(timeout()),this,SLOT(update()));
    //initialize socketbind port 63636
    send_socket = new QUdpSocket(this);
    send_socket->bind(63636, QUdpSocket::ShareAddress);

    //enable button
    ui->close_pushButton->setDisabled(true);
    //ui->image_close_pushButton->setDisabled(false);
    ui->take_photo_pushButton->setDisabled(true);

    //this->setWindowFlags(Qt::Tool | Qt::X11BypassWindowManagerHint);
    this->setWindowFlags(Qt::FramelessWindowHint);
    ui->video_label->setStyleSheet ("background-color: #000000;color: #ffffff;");

    //C_translateLanguage();//set the content of button

    this->picNum = 0;

    //serial_port
    this->serial_open_flag = 0;
    struct PortSettings myComSetting = {BAUD4800,DATA_8,PAR_NONE,STOP_1,FLOW_OFF,10};
    myCom = new Posix_QextSerialPort("/dev/ttyUSB0",myComSetting,QextSerialBase::Polling);
    //myCom->open(QIODevice::ReadWrite);

    readTimer = new QTimer(this);
    readTimer->start(10);

    connect(readTimer,SIGNAL(timeout()),this,SLOT(readMyCom()));

    connect(send_socket, SIGNAL(readyRead()), this, SLOT(readData()));
    connect(ui->open_pushButton,SIGNAL(clicked()),this,SLOT(openCapture()));
    connect(ui->close_pushButton,SIGNAL(clicked()),this,SLOT(closeCapture()));
    connect(timer,SIGNAL(timeout()),this,SLOT(readFrame()));
    connect(ui->image_open_pushButton, SIGNAL(clicked()), this, SLOT(openPhotos()));
    connect(ui->image_close_pushButton, SIGNAL(clicked()), this, SLOT(closePhotos()));
    connect(photos, SIGNAL(closeImage()), this, SLOT(closePhotos()));
    connect(ui->take_photo_pushButton, SIGNAL(clicked()), this, SLOT(takePhotos()));
}
Exemplo n.º 2
0
//////////////////////////////////
// exitProgram()
//
void exitProgram(int code)
{
	// Release resources allocated in this file
	cvDestroyWindow( DISPLAY_WINDOW );
	cvReleaseImage( &pfd_pVideoFrameCopy );

	// Release resources allocated in other project files
	closeCapture();
	closeFaceDet();
	releaseTracker();

	exit(code);
}
Exemplo n.º 3
0
int Capture::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: openCapture(); break;
        case 1: closeCapture(); break;
        case 2: readFrame(); break;
        case 3: openPhotos(); break;
        case 4: closePhotos(); break;
        case 5: takePhotos(); break;
        case 6: readData(); break;
        case 7: on_serial_btn_clicked(); break;
        case 8: on_image_close_pushButton_clicked(); break;
        case 9: paintEvent((*reinterpret_cast< QPaintEvent*(*)>(_a[1]))); break;
        case 10: readMyCom(); break;
        default: ;
        }
        _id -= 11;
    }
    return _id;
}