使用 OpenCV 从 FLIR 相机中检索帧 [英] Retrive frames from FLIR cameras using OpenCV

查看:121
本文介绍了使用 OpenCV 从 FLIR 相机中检索帧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试连接 FLIR 相机并使用 OpenCV 处理帧.我用网线连接了摄像头,但 VideoCapture 对象未成功关联到摄像头;

I am trying to connect a FLIR cammera and process the frames using OpenCV. I connect the cammera with an internet cable but the VideoCapture object was not associated to cam successfully;


cv::VideoCapture cam(0);            

    if (cam.isOpened() == false) {                               
        std::cout << "error: capWebcam not accessed successfully\n\n";      
        _getch();                                                          
        return(0);                                                          
    }

OpenCv 好像找不到.互联网电缆用作相机的电源,只是提及是否相关.我可以使用 Spinnaker SDK 来检索帧,但有没有办法不使用 sdk 并直接使用 OpenCV

It looks like OpenCv can´t find it. The internet cable serves and as a power supply for the cammera just mentioning if maybe that's relavant. I can use the Spinnaker SDK to retrive the frames but is there someway not to use the sdk and use direcly OpenCV

推荐答案

对于未来对如何使用从 PointGray 相机获取的图像在 OpenCv 中工作感兴趣的任何人:

Ok for anyone that would be interested in the future on how to work in OpenCv with imagies acquired from PointGray cameras:

工业相机有其专有的驱动程序,它们不使用操作系统的标准视频接口.这是正常现象,因为这些摄像头非常复杂,通常用于更复杂的情况,您需要完全控制摄像头.

The industrial cameras have their proprietary drivers, they don't use the standard video interfaces of the OS. This is normal, as these cameras are quite complex and they are generally used in more complex situations, where you need a full control over the camera.

您必须从 Point Grey 站点 (https://www.ptgrey.com/support/downloads) 并自己实现捕获.

You have to download the camera's SDK from the Point Grey site (https://www.ptgrey.com/support/downloads) and implement the capturing yourself.

然后您可以将捕获的缓冲区转换为 OpenCV Mat.

Then you can transform the captured buffer into an OpenCV Mat.

int ConvertToCVmat(ImagePtr pImage)
{
    int result = 0;
    ImagePtr convertedImage = pImage->Convert(PixelFormat_BGR8, NEAREST_NEIGHBOR);

    unsigned int XPadding = convertedImage->GetXPadding();
    unsigned int YPadding = convertedImage->GetYPadding();
    unsigned int rowsize = convertedImage->GetWidth();
    unsigned int colsize = convertedImage->GetHeight();

    //image data contains padding. When allocating Mat container size, you need to account for the X,Y image data padding. 
    Mat cvimg = cv::Mat(colsize + YPadding, rowsize + XPadding, CV_8UC3, convertedImage->GetData(), convertedImage->GetStride());
    namedWindow("current Image", CV_WINDOW_AUTOSIZE);
    imshow("current Image", cvimg);
    resizeWindow("current Image", rowsize / 2, colsize / 2);
    waitKey(1);//otherwise the image will not display...
    
    return result;
}

这也很有帮助 https://www.flir.ca/support-center/iis/machine-vision/application-note/getting-started-with-opencv/

这篇关于使用 OpenCV 从 FLIR 相机中检索帧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆