我想将指纹图像的位深度从初始的32位深度设置为8位。这就是我尝试过的
public override void OnComplete(object Capture, string ReaderSerialNumber, DPFP.Sample Sample)
{
Bitmap picture = new Bitmap(500,500,PixelFormat.Format8bppIndexed);
var bitmapData = picture.LockBits(new Rectangle(Point.Empty, picture.Size),ImageLockMode.ReadWrite, picture.PixelFormat);
Random random = new Random();
byte[] buffer = new byte[picture.Width * picture.Height];
random.NextBytes(buffer);
Marshal.Copy(buffer, 0, bitmapData.Scan0, buffer.Length);
picture.UnlockBits(bitmapData);
MakeReport("The fingerprint was captured.");
SetPrompt("Scan the same fingerprint again.");
MemoryStream ms = new MemoryStream();
picture.SetResolution(500, 500);
picture.Save(ms, ImageFormat.Bmp);
fingerImage = ms.ToArray();
Capturer.StopCapture();
((Func<object, Task<object>>)_input.event_handler)(fingerImage).Start();
}
使用上面的代码可以根据需要将图像设置为8位,但是我无法按预期再次获得原始指纹图像。请指导