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