简体   繁体   English

使用 Pylon 的 C++(MFC):如何绘制数组中的图像

[英]C++(MFC) using Pylon :How to draw image which is in array

Hello I am working on a Pylon Application, and I want to know how to draw image which is in array.您好,我正在开发 Pylon 应用程序,我想知道如何绘制数组中的图像。

Basler's Pylon SDK, on memory Image saving In this link, it shows I can save image data in array(I guess) Pylon::CImageFormatConverter::Convert(Pylon::CPylonImage[i],Pylon::CGrabResultPtr) But the thing is I can not figure out how to draw that images which is in array. Basler 的 Pylon SDK, on Pylon::CImageFormatConverter::Convert(Pylon::CPylonImage[i],Pylon::CGrabResultPtr)我不知道如何绘制数组中的图像。 I Think it would be easy problem, but I'd appreciate it if you understand because it's my first time doing this.我认为这将是一个简单的问题,但如果您能理解,我将不胜感激,因为这是我第一次这样做。

For quick'n dirty displaying of Pylon buffers, you have a helper class available in Pylon SDK to put somewhere in buffer grabbing loop:对于 Pylon 缓冲区的快速脏显示,您可以在 Pylon SDK 中提供一个帮助程序 class 以放置在缓冲区抓取循环中的某个位置:

//initialization
CPylonImage img;
CPylonImageWindow wnd;

//somewhere in grabbing loop
wnd.SetImage(img);
wnd.Show();

If you want to utilize in your own display procedures (via either GDI or 3rd party libraries like OpenCV etc.), you can get image buffer with GetBuffer() method:如果您想在自己的显示程序中使用(通过 GDI 或 OpenCV 等第三方库),您可以使用GetBuffer()方法获取图像缓冲区:

CGrabResultPtr ptrGrabResult;
camera.RetrieveResult( 5000, ptrGrabResult, TimeoutHandling_ThrowException);
const uint8_t *pImageBuffer = (uint8_t *) ptrGrabResult->GetBuffer();

Of course, you have to be aware of your target pixel alignment and optionally use CImageFormatConverter for proper output pixel format of your choice.当然,您必须了解您的目标像素 alignment 并可选择使用CImageFormatConverter来获得您选择的正确 output 像素格式。

CImageFormatConverter documentation CImageFormatConverter 文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM