All Projects → hyperoslo → Barcodescanner

hyperoslo / Barcodescanner

Licence: other
🔎 A simple and beautiful barcode scanner.

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Barcodescanner

Flutter camera ml vision
A flutter widget that show the camera stream and allow ML vision recognition on it, it allow you to detect barcodes, labels, text, faces...
Stars: ✭ 175 (-88.54%)
Mutual labels:  barcode-scanner, camera
Quagga2
An advanced barcode-scanner written in Javascript and TypeScript - Continuation from https://github.com/serratus/quaggajs
Stars: ✭ 198 (-87.03%)
Mutual labels:  barcode-scanner, camera
Barcodescanner.xf
Barcode Scanner using GoogleVision API for Xamarin Form
Stars: ✭ 82 (-94.63%)
Mutual labels:  barcode-scanner, camera
Picam
Elixir library used to capture MJPEG video on a Raspberry Pi using the camera module.
Stars: ✭ 96 (-93.71%)
Mutual labels:  camera
Easy Yolo
Yolo (Real time object detection) model training tutorial with deep learning neural networks
Stars: ✭ 98 (-93.58%)
Mutual labels:  camera
React Native Barcode Scanner Google
Barcode scanner for react native, which implements barcode detection from Google's Vision API.
Stars: ✭ 105 (-93.12%)
Mutual labels:  barcode-scanner
Yoga Guru
A personalized yoga trainer app based on Flutter and TensorFlow Lite.
Stars: ✭ 110 (-92.8%)
Mutual labels:  camera
Flutter wechat camera picker
A camera picker in WeChat style.
Stars: ✭ 95 (-93.78%)
Mutual labels:  camera
Androidfacedetection
Android 平台进行人脸检测的几种方案
Stars: ✭ 106 (-93.06%)
Mutual labels:  camera
Yi Hack Allwinner V2
Custom firmware for Yi 1080p camera based on Allwinner platform
Stars: ✭ 100 (-93.45%)
Mutual labels:  camera
Videop2proxy
Proxy to enable P2P only cameras to work with standard protocols.
Stars: ✭ 102 (-93.32%)
Mutual labels:  camera
Pymba
Python wrapper for Allied Vision's Vimba C API
Stars: ✭ 98 (-93.58%)
Mutual labels:  camera
Eflinventory V2
🏬 Point-of-sale and inventory tracking for small-scale retail stores. Easily manage inventory, purchases, sales, and damaged and/or expired products.
Stars: ✭ 106 (-93.06%)
Mutual labels:  barcode-scanner
Python Arlo
Python Arlo is a library written in Python 2.7/3x that exposes the Netgear Arlo cameras as Python objects.
Stars: ✭ 97 (-93.65%)
Mutual labels:  camera
Longimagecamera
📷 A camera view to capture long image merged from small captured images as it is in Shoparoo app available on Google Play!!
Stars: ✭ 107 (-92.99%)
Mutual labels:  camera
Frigate
NVR with realtime local object detection for IP cameras
Stars: ✭ 1,329 (-12.97%)
Mutual labels:  camera
Publishcommunity Master
仿微博,QQ空间,论坛 ,九宫格图文混排发表说说,动态,帖子
Stars: ✭ 107 (-92.99%)
Mutual labels:  camera
Recordbutton
A record button in Swift
Stars: ✭ 101 (-93.39%)
Mutual labels:  camera
Hisilicon Dvr Telnet
PoC materials for article https://habr.com/en/post/486856/
Stars: ✭ 101 (-93.39%)
Mutual labels:  camera
Is Camera On
Check if the built-in Mac camera is on
Stars: ✭ 101 (-93.39%)
Mutual labels:  camera

BarcodeScanner

CI Status Version Swift Carthage Compatible License Platform

Description

BarcodeScanner is a simple and beautiful wrapper around the camera with barcode capturing functionality and a great user experience.

  • Barcode scanning.
  • State modes: scanning, processing, unauthorized, not found.
  • Handling of camera authorization status.
  • Animated focus view and custom loading indicator.
  • Torch mode switch.
  • Customizable colors, informational and error messages.
  • No external dependencies.
  • Demo project.

Table of Contents

BarcodeScanner Icon

Usage

Controller

To start capturing just instantiate BarcodeScannerViewController, set needed delegates and present it:

let viewController = BarcodeScannerViewController()
viewController.codeDelegate = self
viewController.errorDelegate = self
viewController.dismissalDelegate = self

present(viewController, animated: true, completion: nil)
BarcodeScanner scanning

You can also push BarcodeScannerViewController to your navigation stack:

let viewController = BarcodeScannerViewController()
viewController.codeDelegate = self

navigationController?.pushViewController(viewController, animated: true)

Delegates

Code delegate

Use BarcodeScannerCodeDelegate when you want to get the captured code back.

extension ViewController: BarcodeScannerCodeDelegate {
  func scanner(_ controller: BarcodeScannerViewController, didCaptureCode code: String, type: String) {
    print(code)
    controller.reset()
  }
}

Error delegate

Use BarcodeScannerErrorDelegate when you want to handle session errors.

extension ViewController: BarcodeScannerErrorDelegate {
  func scanner(_ controller: BarcodeScannerViewController, didReceiveError error: Error) {
    print(error)
  }
}

Dismissal delegate

Use BarcodeScannerDismissalDelegate to handle "Close button" tap. Please note that BarcodeScannerViewController doesn't dismiss itself if it was presented initially.

extension ViewController: BarcodeScannerDismissalDelegate {
  func scannerDidDismiss(_ controller: BarcodeScannerViewController) {
    controller.dismiss(animated: true, completion: nil)
  }
}

Actions

When the code is captured BarcodeScannerViewController switches to the processing mode:

BarcodeScanner loading

While the user sees a nice loading animation you can perform some background task, for example make a network request to fetch product info based on the code. When the task is done you have 3 options to proceed:

  1. Dismiss BarcodeScannerViewController and show your results.
func scanner(_ controller: BarcodeScannerViewController, didCaptureCode code: String, type: String) {
 // Code processing
 controller.dismiss(animated: true, completion: nil)
}
  1. Show an error message and switch back to the scanning mode (for example, when there is no product found with a given barcode in your database):
BarcodeScanner error

func scanner(_ controller: BarcodeScannerViewController, didCaptureCode code: String, type: String) {
 // Code processing
 controller.resetWithError(message: "Error message")
 // If message is not provided the default message will be used instead.
}
  1. Reset the controller to the scanning mode (with or without animation):
func scanner(_ controller: BarcodeScannerViewController, didCaptureCode code: String, type: String) {
  // Code processing
  controller.reset(animated: true)
}

If you want to do continuous barcode scanning just set the isOneTimeSearch property on your BarcodeScannerViewController instance to false.

Customization

We styled BarcodeScanner to make it look nice, but you can always use public properties or inheritance to customize its appearance.

Header

let viewController = BarcodeScannerViewController()
viewController.headerViewController.titleLabel.text = "Scan barcode"
viewController.headerViewController.closeButton.tintColor = .red

Please note that HeaderViewController is visible only when BarcodeScannerViewController is being presented.

Footer and messages

let viewController = BarcodeScannerViewController()
viewController.messageViewController.regularTintColor = .black
viewController.messageViewController.errorTintColor = .red
viewController.messageViewController.textLabel.textColor = .black

Camera

let viewController = BarcodeScannerViewController()
// Change focus view style
viewController.cameraViewController.barCodeFocusViewType = .animated
// Show camera position button
viewController.cameraViewController.showsCameraButton = true
// Set the initial camera position
viewController.cameraViewController.initialCameraPosition = .front // Default is .back
// Set settings button text
let title = NSAttributedString(
  string: "Settings",
  attributes: [.font: UIFont.boldSystemFont(ofSize: 17), .foregroundColor : UIColor.white]
)
viewController.cameraViewController.settingButton.setAttributedTitle(title, for: UIControlState())

Metadata

// Add extra metadata object type
let viewController = BarcodeScannerViewController()
viewController.metadata.append(AVMetadataObject.ObjectType.qr)

Installation

BarcodeScanner is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'BarcodeScanner'

Don't forget to set a Privacy - Camera Usage Description in your Info.plist file, else the app will crash with a SIGBART.

In order to quickly try the demo project of a BarcodeScanner just run pod try BarcodeScanner in your terminal.

BarcodeScanner is also available through Carthage. To install just write into your Cartfile:

github "hyperoslo/BarcodeScanner"

To install BarcodeScanner manually just download and drop Sources and Images folders in your project.

Author

Hyper Interaktiv AS, [email protected]

Contributing

We would love you to contribute to BarcodeScanner, check the CONTRIBUTING file for more info.

License

BarcodeScanner is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].