WPF调用摄像头扫描二维码
在WPF平台
用WPFMediaKit控件调用摄像头扫描二维码,用ZXing的类库去解析,但是一直解析不出来,请高手帮忙!
private RenderTargetBitmap bmp;
private BitmapEncoder encoder;
private MultiFormatReader reader;
if (bmp == null)
{
bmp = new RenderTargetBitmap( (int)m_VideoCaptureElement.ActualWidth,
(int)m_VideoCaptureElement.ActualHeight, 96, 96, PixelFormats.Pbgra32);
bmp.Render(m_VideoCaptureElement);
}
if (encoder == null)
{
encoder = new JpegBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(bmp));
}
MemoryStream stream = new MemoryStream();
stream.Seek(0, SeekOrigin.Begin);
encoder.Save(stream);
if (source == null)
{
source = new RGBLuminanceSource(stream.ToArray(), 15, 15, RGBLuminanceSource.BitmapFormat.BGR24);
}
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
reader = new MultiFormatReader();
if (bitmap.BlackMatrix != null)
{
Result result = reader.decode(bitmap);
MessageBox.Show(result.Text);
}
用WPFMediaKit控件调用摄像头扫描二维码,用ZXing的类库去解析,但是一直解析不出来,请高手帮忙!
private RenderTargetBitmap bmp;
private BitmapEncoder encoder;
private MultiFormatReader reader;
if (bmp == null)
{
bmp = new RenderTargetBitmap( (int)m_VideoCaptureElement.ActualWidth,
(int)m_VideoCaptureElement.ActualHeight, 96, 96, PixelFormats.Pbgra32);
bmp.Render(m_VideoCaptureElement);
}
if (encoder == null)
{
encoder = new JpegBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(bmp));
}
MemoryStream stream = new MemoryStream();
stream.Seek(0, SeekOrigin.Begin);
encoder.Save(stream);
if (source == null)
{
source = new RGBLuminanceSource(stream.ToArray(), 15, 15, RGBLuminanceSource.BitmapFormat.BGR24);
}
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
reader = new MultiFormatReader();
if (bitmap.BlackMatrix != null)
{
Result result = reader.decode(bitmap);
MessageBox.Show(result.Text);
}
...全文
相关推荐
WPF调用摄像头识别二维码Demo
在本文中,我们将深入探讨如何在WPF(Windows Presentation Foundation)应用中利用摄像头识别二维码,主要基于提供的"WPF调用摄像头识别二维码Demo"。
WPF 二维码扫描识别和生成
在实现二维码扫描时,我们可能需要从摄像头实时获取视频流,这时就需要用到WPFMediaKit提供的摄像头访问功能。
WPF条形码扫描代码样例
**条形码/二维码扫描**:对于扫描功能,可能使用了`AForge.NET`或`Emgu CV`这样的图像处理库,它们可以捕获来自摄像头的实时视频流并识别条形码或二维码。
.net生成和解析二维码及调用摄像头识别二维码源码-GR.rar
这为创建各种应用提供了强大的工具,例如,你可以开发一个桌面应用,让用户直接通过摄像头扫描二维码,获取其中的信息。
.net生成和解析二维码及调用摄像头识别二维码源码.rar
**调用摄像头识别二维码** 要实时地通过摄像头识别二维码,我们可以结合`ZXing.Net`库与Windows Forms或WPF的摄像头访问API。


