Please, how can I scan barcode using webcam of my PC? I used ZXing Nugget and could only generate (write) QR Code but not read. These are my C# code
XAML
<Page
x:Class="Bembem_Samples.FrontScan"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Bembem_Samples"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background ="CadetBlue">
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center">
<Button x:Name="testZxing" Click="testZxing_Click"/>
<TextBlock
FontSize="18"
x:Name="txtStatus"/>
<TextBlock
FontSize="18"
x:Name="txtResult"
Margin="0,4,0,0" />
</StackPanel>
</Grid>
</Page>
C# Code
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Media;
using Windows.Media.Capture;
using Windows.Storage;
using Windows.Storage.Streams;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Imaging;
using Windows.UI.Xaml.Navigation;
using ZXing;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace tinoTestField
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class CamElement : Page
{
public FrontScan()
{
this.InitializeComponent();
}
private void testZxing_Click(){
IBarcodeReader reader = new BarcodeReader();
// load a bitmap - *Bitmap* is not recognised by the library
var barcodeBitmap = (Bitmap)Image.LoadFrom("C:\\sample-barcode-image.png");
// detect and decode the barcode inside the bitmap
var result = reader.Decode(barcodeBitmap);
// do something with the result
if (result != null)
{
txtDecoderType.Text = result.BarcodeFormat.ToString();
txtDecoderContent.Text = result.Text;
}
}
}
}
Please, how can I scan barcode using webcam of my PC? I used ZXing Nugget and could only generate (write) QR Code but not read.
Also if anyone knows how I can resolve this or suggestion on how to open webcam using captureElement.
Thanks in advance.