カメラから映像を取得します。このような:
初期化:
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 を使用) が、動作していません。アイデアを聞いてください。