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

    exusb = new ExUSB();
    exusb->start();
    exusbthread = new ExUSBThread(exusb);
    jl = new JLOpenCV();
    //img = new QImage(640,480,QImage::Format_RGB32);

    //connect(exusbthread,SIGNAL(exusbthread->GetFrameOK()),this,SLOT(flush_image));
    connect(exusbthread,SIGNAL(GetFrameOK(int)),this,SLOT(flush_image()),Qt::QueuedConnection);
    //connect(exusbthread,SIGNAL(exusbthread->GetFrameOK(int)),exusbthread,SLOT(test_recv()));
    //,Qt::QueuedConnection);
    //connect(this,SIGNAL(flush_image()),exusbthread,SLOT(GetFrameOK()),Qt::DirectConnection);
    //mVideoWidget.setParent(this);
    /*
    mVideoWidget = new QVideoWidget();
    mMediaPlayer = new QMediaPlayer;
    QMediaContent mp = QUrl::fromLocalFile("E:\\zlj_bd.mp4");
    mMediaPlayer->setMedia(mp);

    mMediaPlayer->setVideoOutput(mVideoWidget);
    //mVideoWidget->setBaseSize(1024,576);
    mVideoWidget->setGeometry(0,0,1024,576);
    mVideoWidget->show();
    mMediaPlayer->play();
    */
    // image
    img = new QImage(640,480,QImage::Format_RGB32);
    scence = new QGraphicsScene;

    QPainter mPainter(ui->histwidget);
    mPainter.setPen(Qt::blue);
    mPainter.drawText(rect(),Qt::AlignCenter,"Hello WOrld");



    // serialport
    QSerialPort *mPort = new QSerialPort();
    mPort->setPortName("COM4");
    mPort->setBaudRate(mPort->Baud115200);
    if (mPort->open(QIODevice::ReadWrite))
    {
        mPort->write("hello");
    }
}
Esempio n. 2
0
void B9Projector::drawCBM()
{
    if(mpCPJ==NULL) return;
    if(m_iLevel<0)  // Only inflate and normalize the slice if we've not started clearing it
    {
        // Here we inflate the slice

        mCurSliceImage = QImage(width(),height(),QImage::Format_ARGB32_Premultiplied);
        mCurSliceImage.fill(qRgba(0,0,0,0));
        mpCPJ->inflateCurrentSlice(&mCurSliceImage, m_xOffset, m_yOffset);
        createToverMap(3);  //calculate effect of pixels up to a radius of 3 pixel's away.

        // Here we copy the gray scale over using the slice as a mask
        QPainter mPainter(&mCurSliceImage);
        mPainter.setCompositionMode(QPainter::CompositionMode_SourceIn);
        mPainter.drawImage(0,0,m_NormalizedMask);
    }

    // Here we copy the resulting normalized slice to the mImage
    QPainter mPainter2(&mImage);
    mPainter2.setCompositionMode(QPainter::CompositionMode_SourceOver);
    mPainter2.drawImage(0,0,mCurSliceImage);
}