OpenCVImageListRenderer::OpenCVImageListRenderer(QWidget* parent) :
    DataRenderer(parent),
    m_busy(false)

{
    m_layout      = new QHBoxLayout(this);
    ImageWidget* imageWidget = new ImageWidget;

    m_imageWidgets.append(imageWidget);
    m_layout->addWidget( imageWidget );

    QImage image = QImage(320,240,QImage::Format_RGB32);
    image.fill( qRgb(0,0,0) );

    // TODO make minimum configurable somewhere
    imageWidget->setMinimumSize( 160, 120 );
    imageWidget->setImage( image );

    this->setLayout( m_layout );

    m_converter = new ImageConverter(this);

    qRegisterMetaType< QList<QImage> >("QList<QImage>");

    connect( m_converter, SIGNAL( convertedList( QList<QImage>, int ) ),
             this,        SLOT( updateImages( QList<QImage>, int ) ),
             Qt::UniqueConnection);
}
Exemple #2
0
int main(int argc, char** argv)
{
    QApplication app(argc, argv);
    MainWindow mw;
    mw.show();
#if 0
    try {
        ImageSource * src;

        src = new ImageSource("test.jpg");


        Image img = src->getImage();
        FilterManager<CpuGrayFilter> filterCPU;
        filterCPU.process(img);
        std::cout<< "filter CPU time:" << filterCPU.getTime().total_microseconds() <<"us"<< std::endl;
        ImageWidget foo;
        foo.setImage(img);
        foo.setWindowTitle("Vis - CPU");
        foo.show();

#ifdef USE_CUDA
        Image img2 = src->getImage();
        FilterManager<GpuGrayFilter> filterGPU;
        filterGPU.process(img2);
        std::cout<< "filter GPU time:" << filterGPU.getTime().total_microseconds()<<"us" << std::endl;
        ImageWidget foo2;
        foo2.setImage(img2);
        foo2.setWindowTitle("Vis - GPU");
        foo2.show();
#endif

    } catch(IException & ex) {
        std::cout <<ex.getMessage().toStdString() << std::endl;
        return 1;
    }
#endif
    return app.exec();
}