Skip to content

Instantly share code, notes, and snippets.

@dmitriy-t
dmitriy-t / simple_barcode_detection.py
Last active November 10, 2015 18:16
This is the version of "simple_barcode_detection.py" from Adrian Rosebrock, updated for use with OpenCV 3.0 (note lines 14, 15, 34, 44)
# Original files and article is here:
# http://www.pyimagesearch.com/2014/12/15/real-time-barcode-detection-video-python-opencv
# import the necessary packages
import numpy as np
import cv2
def detect(image):
# convert the image to grayscale
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)