我从相机里得到镜头。像这样:
初始化:
uint pcount = (uint)(capGrabber.Width * capGrabber.Height * PixelFormats.Bgr32.BitsPerPixel / 8);
section = CreateFileMapping(new IntPtr(-1), IntPtr.Zero, 0x04, 0, pcount, null);
map = MapViewOfFile(section, 0xF001F, 0, 0, pcount);
BitmapSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromMemorySection(section, capGrabber.Width, capGrabber.Height, PixelFormats.Bgr32, capGrabber.Width * PixelFormats.Bgr32.BitsPerPixel / 8, 0) as InteropBitmap;
capGrabber.Map = map;
在哪里
IntPtr map;
IntPtr section;
InteropBitmap BitmapSource;
抓斗(capGrabber):
public int BufferCB(double sampleTime, IntPtr pBuffer, int bufferLen)
{
if (Map != IntPtr.Zero)
{
CopyMemory(Map, pBuffer, bufferLen);
OnNewFrameArrived();
}
return 0;
}
我把图像倒过来(自上而下)。需要解决这个问题。我找到了一些东西(使用结构 BITMAPINFO),但我没有工作。问任何想法。