Bücher mit einem C#-Barcodescanner scannen

Blog-Kategorie: Barcode.NET

09.06.2025

Das Scannen von Büchern mit Barcodescannern wird zu einem integralen Bestandteil der Automatisierung von Bibliotheken, Buchhandlungen, Archiven und Bildungseinrichtungen. Dieser Ansatz beschleunigt die Bearbeitung großer Sammlungen, minimiert Buchhaltungsfehler und ermöglicht neue Interaktionsmöglichkeiten mit dem Buch und dem Leser.



Funktionsprinzipien eines Software-Barcodescanners im Kontext von Büchern

Ein Softwarescanner ist eine spezialisierte Softwarelösung, die mithilfe von Kameras, Scannern oder Mobilgeräten automatisch auf Bücher aufgebrachte Barcodes erkennt und dekodiert. Durch die Implementierung wird eine schnelle und präzise elektronische Buchhaltung ermöglicht.Fondsverwaltung und Transaktionsverarbeitung ohne manuelle Dateneingabe.

Die Funktionsweise eines Software-Scanners basiert auf folgendem Prinzip: Ein Gerät (z. B. eine Kamera oder ein Scanner) liest das Bild eines Barcodes vom Buchumschlag oder einer Buchseite. Die Software entschlüsselt die darin kodierten Informationen (z. B. ISBN) und überträgt diese Daten zur Weiterverarbeitung an ein Bibliotheks- oder Handelssystem.

Barcodes auf Büchern

Die meisten in den letzten Jahrzehnten erschienenen Bücher haben einen Barcode - in der Regel eine ISBN (International Standard Book Number) im EAN-13-Format oder einen QR-Code (bei Publikationen der neuen Generation). Er enthält eine eindeutige Kennung für das Buch, oft mit zusätzlichen Informationen zur Ausgabe.

Nutzung von Kameras und Scannern

Ein Software-Barcodescanner ist eine Anwendung oder Bibliothek, die Barcodes sowohl mit Spezialgeräten (Scannern, Terminals) als auch mit Webcams oder Mobilgeräten erkennen kann und den Prozess so mobil und zugänglich wie möglich gestaltet.

Erkennung und Datenverarbeitung

Bildverarbeitungsalgorithmen finden den Barcode auf dem Buch, dekodieren die darin enthaltenen Informationen und integrieren sie in Kataloge, Datenbanken und Bibliothekssysteme, um eine schnelle und genaue Erfassung zu gewährleisten.



Schritte des Buchscannens

Das Scannen von Büchern mit einem Software-Barcodescanner umfasst mehrere aufeinanderfolgende Schritte, von denen jeder entscheidend für die Genauigkeit und Effizienz der Prozesse der Erfassung, Ausleihe und Rückgabe von Büchern ist. Ein gut organisierter Arbeitsablauf kann die Inventurzeit deutlich reduzieren, die Datenqualität verbessern und den Service in Bibliotheken und Buchhandlungen optimieren.

Vorbereitung von Ausrüstung und Software

Vor dem Scannen müssen Sie sicherstellen, dass das verwendete Gerät die ausgewählte Software und die Barcode-Standards unterstützt. Anschließend:

Scannen und Erkennen des Barcodes

In diesem Schritt erfolgt das eigentliche Einlesen des Barcodes aus dem Buch:
Positionieren Sie das Buch so, dass der Barcode für die Kamera oder den Scanner gut sichtbar ist.

Integration mit einem Bibliotheks- oder Handelssystem

Nach erfolgreicher Erkennung,Der Software-Scanner überträgt die empfangenen Daten automatisch an das Informationssystem:

Speicherung, Analyse und Weiterverarbeitung der Daten

Sobald die Informationen in der Datenbank vorhanden sind, eröffnen sich Möglichkeiten zur Automatisierung von Buchhaltungs- und Analyseprozessen:



Technologische Merkmale und Vorteile eines modernen Software-Scanners

Ein moderner Software-Barcode-Scanner bietet folgende technologische Lösungen:

Eine moderne Barcode-Scanner-Software ist ein unverzichtbares Werkzeug für jede Bibliothek oder Buchhandlung, die Automatisierung, transparente Abrechnung und schnellere Serviceabläufe anstrebt. Dank solcher Software,Die Bearbeitung von Papierbeständen wird mit minimalen Kosten und maximalem Nutzen auf ein modernes, digitales Niveau gebracht.

Auswahl einer Softwarelösung

Bei der Auswahl eines Software-Barcodescanners für die Arbeit mit Büchern sollten Sie Folgendes berücksichtigen:

Universelle Lösungen sollten sich einfach in die IT-Infrastruktur integrieren lassen und die Nutzung auf verschiedenen Geräten unterstützen: von Desktop-PCs bis hin zu Mobiltelefonen. Es empfiehlt sich, Produkte mit einer einfachen Benutzeroberfläche, Update-Möglichkeiten und technischem Support zu wählen.

Entwicklungsperspektiven

Buchscanning-Technologien mit Software-Barcodescannern entwickeln sich weiterhin rasant. In naher Zukunft wird mit einer breiteren Anwendung von 2D-Barcodes (wie DataMatrix und QR) gerechnet, da diese mehr Informationen enthalten können - Links zu elektronischen Buchversionen, Anmerkungen und sichere Kennungen.

Die Integration von Scannern mit Cloud-Diensten und digitalen Bibliotheken nimmt zu und ermöglicht den automatisierten Zugriff auf Online-Ressourcen sowie erweiterte Serviceleistungen für die Nutzer. Zukünftig wird auch die Einführung intelligenter Funktionen erwartet: automatische Analyse des Buchzustands, Generierung von Empfehlungen sowie die Entwicklung von End-to-End-Analysen und die Überwachung der Bestände der Bibliothek.

Fazit

Die Auswahl einer Barcode-Scanning-Softwarelösung erfordert die sorgfältige Abwägung vieler Faktoren, darunter unterstützte Formate, Geschwindigkeit, Integrationsmöglichkeiten und Benutzerfreundlichkeit. Die Aussichten für die technologische Entwicklung eröffnen neue Horizonte für die Automatisierung, steigern die Effizienz von Bibliothekssystemen und verbessern den Service für die Benutzer.

VintaSoft, der Entwickler des VintaSoft Barcode .NET SDK, kann die Erstellung eines Bibliotheks-Barcodesystems erheblich vereinfachen. Dieses leistungsstarke Tool unterstützt eine Vielzahl formatierter Barcodes, bietet hohe Scangeschwindigkeit und -genauigkeit und lässt sich problemlos in bestehende Bibliothekssysteme integrieren. Mit dem VintaSoft Barcode .NET SDK können Bibliotheken alle Prozesse rund um die Buchhaltung und den Service von Büchern schnell und effizient automatisieren, die Servicequalität verbessern und erhebliche Ressourcen einsparen.


Hier ist ein C#-Code, der zeigt, wie man einen ISBN-Barcode in einem mit einer Kamera aufgenommenen Bild erkennt:
/// <summary>
/// Reads barcode from a <see cref="System.Drawing.Bitmap"/>.
/// </summary>
/// <param name="bitmap">A bitmap with barcodes.</param>
public static void ReadIsbnBarcodesFromBitmap(System.Drawing.Bitmap bitmap)
{
    // create barcode reader
    using (Vintasoft.Barcode.BarcodeReader reader = new Vintasoft.Barcode.BarcodeReader())
    {
        // specify that reader must search for ISBN barcodes
        reader.Settings.ScanBarcodeTypes = Vintasoft.Barcode.BarcodeType.ISBN;

        // read barcodes from image
        Vintasoft.Barcode.IBarcodeInfo[] infos = Vintasoft.Barcode.GdiExtensions.ReadBarcodes(reader, bitmap);

        // if barcodes are not detected
        if (infos.Length == 0)
        {
            System.Console.WriteLine("No barcodes found.");
        }
        // if barcodes are detected
        else
        {
            // get information about extracted barcodes

            System.Console.WriteLine(string.Format("{0} barcodes found:", infos.Length));
            System.Console.WriteLine();
            for (int i = 0; i < infos.Length; i++)
            {
                Vintasoft.Barcode.IBarcodeInfo info = infos[i];
                System.Console.WriteLine(string.Format("[{0}:{1}]", i + 1, info.BarcodeType));
                System.Console.WriteLine(string.Format("Value:      {0}", info.Value));
                System.Console.WriteLine(string.Format("Region:     {0}", info.Region));
                System.Console.WriteLine();
            }
        }
    }
}



Hier ist C#-Code, der zeigt, wie man Bilder mit einer DirectShow-Kamera (VintaSoft Imaging .NET SDK) aufnimmt und ISBN-Barcodes in den aufgenommenen Bildern (VintaSoft Barcode .NET SDK) in einer WinForms-Anwendung erkennt:
public partial class IsbnBarcodeScannerForm : Form
{
    /// <summary>
    /// The camera barcode scanner.
    /// </summary>
    ImagingCameraBarcodeScanner _cameraBarcodeScanner;

    /// <summary>
    /// Initializes a new instance of the <see cref="IsbnBarcodeScannerForm"/> class.
    /// </summary>
    public IsbnBarcodeScannerForm()
    {
        InitializeComponent();

        _cameraBarcodeScanner = new ImagingCameraBarcodeScanner();
        _cameraBarcodeScanner.BarcodeScanner.FrameScanFinished += BarcodeScanner_FrameScanFinished;
        _cameraBarcodeScanner.ScanningException += CameraBarcodeScanner_ScanningException;

        _cameraBarcodeScanner.BarcodeScanner.ScannerSettings.ScanBarcodeTypes = Vintasoft.Barcode.BarcodeType.QR;
    }

    /// <summary>
    /// Starts the capturing of images from seleced device and recognition of barcodes in captured images.
    /// </summary>
    private void startButton_Click(object sender, EventArgs e)
    {
        textBox1.Text = "Scan Barcodes Types: " + _cameraBarcodeScanner.BarcodeScanner.ScannerSettings.ScanBarcodeTypes.ToString();

        _cameraBarcodeScanner.CaptureDevice = _cameraBarcodeScanner.CaptureDevices[0];
        _cameraBarcodeScanner.StartScanning();
    }

    /// <summary>
    /// Stops the capturing of images from seleced device and recognition of barcodes in captured images.
    /// </summary>
    private void stopButton_Click(object sender, EventArgs e)
    {
        textBox1.Text = "";

        _cameraBarcodeScanner.StopScanning();
    }

    /// <summary>
    /// Shows an error.
    /// </summary>
    private void CameraBarcodeScanner_ScanningException(object sender, Vintasoft.Imaging.ExceptionEventArgs e)
    {
        MessageBox.Show(e.Exception.ToString());
    }

    /// <summary>
    /// Handles the FrameScanFinished event of the BarcodeScanner.
    /// </summary>
    private void BarcodeScanner_FrameScanFinished(object sender, Vintasoft.Barcode.FrameScanFinishedEventArgs e)
    {
        if (e.FoundBarcodes.Length > 0)
            Invoke(new ShowRecognitionResultsDelegate(ShowRecognitionResults), new object[] { e.FoundBarcodes });
    }

    /// <summary>
    /// Shows barcode recognition results.
    /// </summary>
    private void ShowRecognitionResults(Vintasoft.Barcode.IBarcodeInfo[] barcodes)
    {
        StringBuilder result = new StringBuilder();

        foreach (Vintasoft.Barcode.IBarcodeInfo barcode in barcodes)
            result.AppendLine(string.Format("{0}: {1}", barcode.BarcodeType, barcode.Value));

        // show barcode recognition in text box
        textBox1.Text = result.ToString();
    }

    delegate void ShowRecognitionResultsDelegate(Vintasoft.Barcode.IBarcodeInfo[] barcodeInfo);
}


/// <summary>
/// Allows to capture images from DirectShow camera (VintaSoft Imaging .NET SDK) and recognize barcodes in captured images (VintaSoft Barcode .NET SDK).
/// </summary>
public class ImagingCameraBarcodeScanner : IDisposable
{

    #region Fields

    /// <summary>
    /// Monitor for capture devices.
    /// </summary>
    Vintasoft.Imaging.Media.ImageCaptureDevicesMonitor _captureDevicesMonitor;

    /// <summary>
    /// Image capture source for barcode recognition.
    /// </summary>
    Vintasoft.Imaging.Media.ImageCaptureSource _imageCaptureSource;

    #endregion



    #region Constructors

    /// <summary>
    /// Initializes a new instance of the <see cref="ImagingCameraBarcodeScanner"/> class.
    /// </summary>
    public ImagingCameraBarcodeScanner()
    {
        _barcodeScanner = new Vintasoft.Barcode.CameraBarcodeScanner();
        _barcodeScanner.FrameScanException += BarcodeScanner_FrameScanException;
        _barcodeScanner.ScannerSettings.ScanBarcodeTypes = Vintasoft.Barcode.BarcodeType.ISBN;

        _captureDevicesMonitor = new Vintasoft.Imaging.Media.ImageCaptureDevicesMonitor();
        _captureDevicesMonitor.CaptureDevicesChanged += CaptureDevicesMonitor_CaptureDevicesChanged;

        if (!Vintasoft.Imaging.ImagingEnvironment.IsInDesignMode)
            _captureDevicesMonitor.Start();

        _imageCaptureSource = new Vintasoft.Imaging.Media.ImageCaptureSource();
        _imageCaptureSource.CaptureCompleted += ImageCaptureSource_CaptureCompleted;

    }

    #endregion



    #region Properties

    Vintasoft.Imaging.Media.ImageCaptureDevice _captureDevice;
    /// <summary>
    /// Gets or sets current capture device.
    /// </summary>
    public Vintasoft.Imaging.Media.ImageCaptureDevice CaptureDevice
    {
        get
        {
            return _captureDevice;
        }
        set
        {
            if (_captureDevice != value)
            {
                _captureDevice = value;

                UpdateCapureFormats();
            }
        }
    }

    ReadOnlyCollection<Vintasoft.Imaging.Media.ImageCaptureFormat> _captureFormats = null;
    /// <summary>
    /// Gets the available capture formats of current capture device.
    /// </summary>
    /// <seealso cref="CaptureDevice"/>
    public ReadOnlyCollection<Vintasoft.Imaging.Media.ImageCaptureFormat> CaptureFormats
    {
        get
        {
            return _captureFormats;
        }
    }

    /// <summary>
    /// Gets available capture devices.
    /// </summary>
    public ReadOnlyCollection<Vintasoft.Imaging.Media.ImageCaptureDevice> CaptureDevices
    {
        get
        {
            return Vintasoft.Imaging.Media.ImageCaptureDeviceConfiguration.GetCaptureDevices();
        }
    }

    Vintasoft.Barcode.CameraBarcodeScanner _barcodeScanner;
    /// <summary>
    /// Gets the barcode scanner.
    /// </summary>
    public Vintasoft.Barcode.CameraBarcodeScanner BarcodeScanner
    {
        get
        {
            return _barcodeScanner;
        }
    }

    /// <summary>
    /// Gets a value indicating whether barcode scanning is started.
    /// </summary>
    public bool IsStarted
    {
        get
        {
            return _imageCaptureSource.State == Vintasoft.Imaging.Media.ImageCaptureState.Started;
        }
    }

    #endregion



    #region Methods

    #region PUBLIC

    /// <summary>
    /// Starts the capturing of images from seleced device and recognition of barcodes in captured images.
    /// </summary>
    public void StartScanning()
    {
        try
        {
            if (CaptureDevice == null)
                throw new ArgumentNullException("CaptureDevice");

            if (CaptureFormats == null || CaptureFormats.Count == 0)
                throw new ArgumentNullException("CaptureFormats");

            if (_imageCaptureSource.State != Vintasoft.Imaging.Media.ImageCaptureState.Started)
            {
                if (CaptureDevice.DesiredFormat == null)
                    CaptureDevice.DesiredFormat = CaptureFormats[0];

                _barcodeScanner.StartScanning();

                _imageCaptureSource.CaptureDevice = _captureDevice;
                _imageCaptureSource.Start();
                _imageCaptureSource.CaptureAsync();

                OnScanningStart(EventArgs.Empty);
            }
        }
        catch (Exception ex)
        {
            OnScanningException(new Vintasoft.Imaging.ExceptionEventArgs(ex));
        }
    }

    /// <summary>
    /// Stops the capturing of images from seleced device and recognition of barcodes in captured images.
    /// </summary>
    public void StopScanning()
    {
        try
        {
            if (_imageCaptureSource.State != Vintasoft.Imaging.Media.ImageCaptureState.Stopped)
            {
                _barcodeScanner.StopScanning();
                _imageCaptureSource.Stop();

                OnScanningStop(EventArgs.Empty);
            }
        }
        catch (Exception ex)
        {
            OnScanningException(new Vintasoft.Imaging.ExceptionEventArgs(ex));
        }
    }

    /// <summary>
    /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
    /// </summary>
    public void Dispose()
    {
        _captureDevicesMonitor.CaptureDevicesChanged -= CaptureDevicesMonitor_CaptureDevicesChanged;
        _barcodeScanner.BarcodeReader.Dispose();
    }

    #endregion


    #region PROTECTED

    /// <summary>
    /// Raises the <see cref="CaptureDevicesChanged" /> event.
    /// </summary>
    /// <param name="args">The <see cref="ImageCaptureDevicesChangedEventArgs"/> instance containing the event data.</param>
    protected virtual void OnCaptureDevicesChanged(Vintasoft.Imaging.Media.ImageCaptureDevicesChangedEventArgs args)
    {
        if (CaptureDevicesChanged != null)
            CaptureDevicesChanged(this, args);
    }

    /// <summary>
    /// Raises the <see cref="ScanningException" /> event.
    /// </summary>
    /// <param name="args">The <see cref="ExceptionEventArgs"/> instance containing the event data.</param>
    protected virtual void OnScanningException(Vintasoft.Imaging.ExceptionEventArgs args)
    {
        if (ScanningException != null)
            ScanningException(this, args);
    }

    /// <summary>
    /// Raises the <see cref="ScanningStart" /> event.
    /// </summary>
    /// <param name="args">The <see cref="EventArgs"/> instance containing the event data.</param>
    protected virtual void OnScanningStart(EventArgs args)
    {
        if (ScanningStart != null)
            ScanningStart(this, args);
    }

    /// <summary>
    /// Raises the <see cref="ScanningStop" /> event.
    /// </summary>
    /// <param name="args">The <see cref="EventArgs"/> instance containing the event data.</param>
    protected virtual void OnScanningStop(EventArgs args)
    {
        if (ScanningStop != null)
            ScanningStop(this, args);
    }

    #endregion


    #region PRIVATE

    /// <summary>
    /// Handles the FrameScanException event of the BarcodeScanner control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="Vintasoft.Barcode.FrameScanExceptionEventArgs"/> instance containing the event data.</param>
    private void BarcodeScanner_FrameScanException(object sender, Vintasoft.Barcode.FrameScanExceptionEventArgs e)
    {
        OnScanningException(new Vintasoft.Imaging.ExceptionEventArgs(e.Exception));
    }

    /// <summary>
    /// Handles the CaptureCompleted event of the ImageCaptureSource.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="ImageCaptureCompletedEventArgs"/> instance containing the event data.</param>
    private void ImageCaptureSource_CaptureCompleted(object sender, Vintasoft.Imaging.Media.ImageCaptureCompletedEventArgs e)
    {
        try
        {
            // get captured image
            Vintasoft.Imaging.VintasoftImage image = e.GetCapturedImage();

            // recognize barcodes from captured image
            using (Vintasoft.Imaging.VintasoftBitmap bitmap = image.GetAsVintasoftBitmap())
                _barcodeScanner.ScanFrame(bitmap);

            // if image capturing is started
            if (_imageCaptureSource.State == Vintasoft.Imaging.Media.ImageCaptureState.Started)
            {
                // capture next image
                _imageCaptureSource.CaptureAsync();
            }
        }
        catch (Exception ex)
        {
            OnScanningException(new Vintasoft.Imaging.ExceptionEventArgs(ex));
        }
    }

    /// <summary>
    /// Handles the CaptureDevicesChanged event of the CaptureDevicesMonitor.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="ImageCaptureDevicesChangedEventArgs"/> instance containing the event data.</param>
    private void CaptureDevicesMonitor_CaptureDevicesChanged(object sender, Vintasoft.Imaging.Media.ImageCaptureDevicesChangedEventArgs e)
    {
        if (Array.IndexOf(e.RemovedDevices, CaptureDevice) >= 0)
        {
            StopScanning();
        }

        OnCaptureDevicesChanged(e);
    }

    /// <summary>
    /// Updates the capture formats.
    /// </summary>
    private void UpdateCapureFormats()
    {
        Vintasoft.Imaging.Media.ImageCaptureDevice device = CaptureDevice;
        if (device == null || device.SupportedFormats == null)
        {
            _captureFormats = null;
        }
        else
        {
            List<Vintasoft.Imaging.Media.ImageCaptureFormat> captureFormats = new List<Vintasoft.Imaging.Media.ImageCaptureFormat>();

            List<uint> imageCaptureFormatSizes = new List<uint>();
            for (int i = 0; i < device.SupportedFormats.Count; i++)
            {
                // if format has bit depth less or equal than 12 bit
                if (device.SupportedFormats[i].BitsPerPixel <= 12)
                {
                    // ignore formats with bit depth less or equal than 12 bit because they may cause issues on Windows 8
                    continue;
                }

                uint imageCaptureFormatSize = (uint)(device.SupportedFormats[i].Width | (device.SupportedFormats[i].Height << 16));
                if (!imageCaptureFormatSizes.Contains(imageCaptureFormatSize))
                {
                    imageCaptureFormatSizes.Add(imageCaptureFormatSize);

                    captureFormats.Add(device.SupportedFormats[i]);
                }
            }
            _captureFormats = captureFormats.AsReadOnly();
        }
    }

    #endregion

    #endregion



    #region Events

    /// <summary>
    /// Occurs when barcode scanning is started.
    /// </summary>
    public event EventHandler ScanningStart;

    /// <summary>
    /// Occurs when barcode scanning is stopped.
    /// </summary>
    public event EventHandler ScanningStop;

    /// <summary>
    /// Occurs when barcode scanning error occurs.
    /// </summary>
    public event EventHandler<Vintasoft.Imaging.ExceptionEventArgs> ScanningException;

    /// <summary>
    /// Occurs when <see cref="CaptureDevices"/> property is changed.
    /// </summary>
    public event EventHandler<Vintasoft.Imaging.Media.ImageCaptureDevicesChangedEventArgs> CaptureDevicesChanged;

    #endregion

}