0

简介:我正在尝试编写一个连接到 FLIR AX5(GigE Vision)相机的程序,然后定期将图像保存到我 PC 上预先指定的位置。这些图像必须是 14 位,其中包含温度信息。稍后我需要使用 openCV 处理这些图像,以从获得的温度数据中获得一些有意义的结果。

当前位置:我可以定期保存图像,但我得到的图像不包含 14 位数据,而是 8 位数据。即使在我将 PixelFormat 更改为 14 位、CMOS 和 LVDT 位深度更改为 14 位之后也是如此。我在 matlab 中检查了生成的 .bin 文件,发现最大像素值为 255,这意味着图像以 8 位格式存储。我正在使用 eBus SDK 提供的示例代码来完成这项工作。在这段代码中,我根据我的要求进行了一些更改。

请帮助以原始格式保存图像,我可以从中读取温度数据。PS 相关代码在这里。

            // If the buffer contains an image, display width and height.
            uint32_t lWidth = 0, lHeight = 0;
            lType = lBuffer->GetPayloadType();

            cout << fixed << setprecision( 1 );
            cout << lDoodle[ lDoodleIndex ];
            cout << " BlockID: " << uppercase << hex << setfill( '0' ) << setw( 16 ) << lBuffer->GetBlockID();

            if (lType == PvPayloadTypeImage)
            {

                // Get image specific buffer interface.
                PvImage *lImage = lBuffer->GetImage();
                // Read width, height.
                lWidth = lImage->GetWidth();
                lHeight = lImage->GetHeight();
                cout << "  W: " << dec << lWidth << " H: " << lHeight;
                lBuffer->GetImage()->Alloc(lWidth, lHeight, lBuffer->GetImage()->GetPixelType());
                if (lBuffer->GetBlockID()%50==0) {
                    char filename[]= IMAGE_SAVE_LOC;
                    std::string s=std::to_string(lBuffer->GetBlockID());
                    char const *schar=s.c_str();
                    strcat(filename, schar);
                    strcat(filename,".bin");
                    lBufferWriter.Store(lBuffer,filename);
                }
4

1 回答 1

0

确保流配置为 14 位流。

在创建 PvStream 之前,您必须将 PixelFormat 设置为 14 位。如果你是 PvDevice 对象,它被称为 _pvDevice:

_pvDevice->GetParameters()->SetEnumValue("PixelFormat", PvPixelMono14);
_pvDevice->GetParameters()->SetEnumValue("DigitalOutput", 3);
于 2016-05-25T13:23:31.267 回答