目前,我正在尝试开发一种从PGR(Ladybug流文件,*。pgr)文件中提取帧图像并对其进行处理的软件。
要处理每个帧图像(色彩校正等),需要将每个帧图像转换为 .Net位图对象。
目前,我已通过以下步骤成功获取了 Bitmap 对象:
1)要渲染图像,请使用以下方法:
public static extern LadybugError RenderOffScreenImage(
IntPtr context,
LadybugOutputImage imageType,
LadybugPixelFormat pixelFormat,
out LadybugProcessedImage pImage);
2)要将 LadybugProcessedImage 保存到磁盘,请使用以下方法:
public static extern LadybugError SaveImage(IntPtr conte
ref LadybugProcessedImage processedImage,
string path,
LadybugSaveFileFormat format,
bool async);
3)获取位图对象:
Bitmap img = new Bitmap(path);
现在,这是我的问题:
是否可以直接获取Bitmap对象,而无需将图像保存到磁盘临时中?
就我对sdk帮助的了解而言,我找不到将帧图像直接(在内存中)直接转换为Bitmap的方法。
我之所以想在内存上获取位图,是为了加速。
PGR文件和框架很多,因此处理速度非常重要。
顺便说一下,** LadybugProcessedImage”结构的结构如下:
/** The Ladybug processed image structure. */
unsafe public struct LadybugProcessedImage
{
// Columns, in pixels, of the stitched image
public uint uiCols;
// Rows, in pixels, of the stitched image
public uint uiRows;
// Pointer to the image data
// If it is possible to convert the pData to Bitmap, it is great!
// (But I could not find a way...)
public byte* pData;
// The pixel format of this image
public LadybugPixelFormat pixelFormat;
// Metadata of the image.
public LadybugImageMetaData metaData;
// Reserved
public uint ulReserved;
};
谢谢您的帮助!