How to use opencv VideoCapture to read frames from a Firewire (precisely Fire-i 630c) camera

188 views Asked by At

I am using opencv3.4.5, and my camera is a Fire-I 630c. I am not sure if cv::VideoCapture is able to read frames from the camera. I have tried put different arguments, e.g., 0, cv::CAP_FIREWIRE, cv::CAP_IEEE1394, which all don't work for video capturing. Here below are my codes.

It seems that camera is not recognized since a debug message is not shown.

//This run function is to capture images from the camera and display them in two label Qt widgets. 
void videoProcessorThread::run()
{
    using namespace cv;

    VideoCapture camera(cv::CAP_FIREWIRE);  

    Mat inFrame, outFrame;
    while(camera.isOpened() /*&& !isInterruptionRequested()*/)
    {
        qDebug() << "Camera is opened ....";
        camera >> inFrame;
        if(inFrame.empty())
            continue;

        bitwise_not(inFrame, outFrame); //cv::bitwise_not

        emit inDisplay(
                    QPixmap::fromImage(
                        QImage(
                            inFrame.data,
                            inFrame.cols,
                            inFrame.rows,
                            inFrame.step,
                            QImage::Format_RGB888).rgbSwapped()));

        emit outDisplay(
                    QPixmap::fromImage(
                        QImage(
                            outFrame.data,
                            outFrame.cols,
                            outFrame.rows,
                            outFrame.step,
                            QImage::Format_RGB888).rgbSwapped()));
    }
}

The codes in mainwindow.cpp:

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    connect(&processor, SIGNAL(inDisplay(QPixmap)),
            ui->inVideo, SLOT(setPixmap(QPixmap)));
    connect(&processor, SIGNAL(outDisplay(QPixmap)),
            ui->outVideo, SLOT(setPixmap(QPixmap)));
    processor.start();

}
1

There are 1 answers

0
VideoProcessingResearcher On

As far as I understand, you work with very expensive industrial IEEE-1394-based camera. This model doesn't have a MS DirectShow-compatible driver, so it's hard to connect from OpenCV, but it has a native API from manufacturer. I'd suggest you to wrap some functions from this API with DLL, load this DLL from your OpenCV-based application and load data from your camera frame-by-frame.