1
我試圖使用DirectShow過濾器從網絡攝像頭獲取圖像。
我想在PictureBox上顯示該圖像。
爲此,我必須旋轉該圖像。從IntPtr緩衝區創建圖像後,圖像需要翻轉
代碼示例:
public int BufferCB(double sampleTime, IntPtr pbuffer, int bufferLen)
{
if (pbuffer == IntPtr.Zero || bufferLen == 0) return 0;
var timeStamp = TimeSpan.FromSeconds(sampleTime);
var image = new Bitmap(_videoResolution.Width, _videoResolution.Height, _stride, PixelFormat.Format24bppRgb, pbuffer);
image.RotateFlip(RotateFlipType.Rotate180FlipX);
RaiseFrameGrabbedEvent(image, timeStamp, pbuffer);
return 0;
}
有什麼辦法避免旋轉。
翻轉增加CPU使用率。有什麼辦法可以減少這種情況。 – iamyz