oned

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2020 License: Apache-2.0, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// These two values are critical for determining how permissive the decoding will be.
	// We've arrived at these values through a lot of trial and error. Setting them any higher
	// lets false positives creep in quickly.
	UPCEANReader_MAX_AVG_VARIANCE        = 0.48
	UPCEANReader_MAX_INDIVIDUAL_VARIANCE = 0.7
)

Variables

View Source
var (
	// Start/end guard pattern.
	UPCEANReader_START_END_PATTERN = []int{1, 1, 1}

	// Pattern marking the middle of a UPC/EAN pattern, separating the two halves.
	UPCEANReader_MIDDLE_PATTERN = []int{1, 1, 1, 1, 1}

	// end guard pattern.
	UPCEANReader_END_PATTERN = []int{1, 1, 1, 1, 1, 1}

	// "Odd", or "L" patterns used to encode UPC/EAN digits.
	UPCEANReader_L_PATTERNS = [][]int{
		{3, 2, 1, 1},
		{2, 2, 2, 1},
		{2, 1, 2, 2},
		{1, 4, 1, 1},
		{1, 1, 3, 2},
		{1, 2, 3, 1},
		{1, 1, 1, 4},
		{1, 3, 1, 2},
		{1, 2, 1, 3},
		{3, 1, 1, 2},
	}

	// As above but also including the "even", or "G" patterns used to encode UPC/EAN digits.
	UPCEANReader_L_AND_G_PATTERNS [][]int
)

Functions

func NewCodaBarReader

func NewCodaBarReader() gozxing.Reader

func NewCodaBarWriter

func NewCodaBarWriter() gozxing.Writer

func NewCode128Reader

func NewCode128Reader() gozxing.Reader

func NewCode128Writer

func NewCode128Writer() gozxing.Writer

func NewCode39Reader

func NewCode39Reader() gozxing.Reader

NewCode39Reader Creates a reader that assumes all encoded data is data, and does not treat the final character as a check digit. It will not decoded "extended Code 39" sequences.

func NewCode39ReaderWithCheckDigitFlag

func NewCode39ReaderWithCheckDigitFlag(usingCheckDigit bool) gozxing.Reader

NewCode39ReaderWithCheckDigitFlag Creates a reader that can be configured to check the last character as a check digit. It will not decoded "extended Code 39" sequences.

@param usingCheckDigit if true, treat the last data character as a check digit, not data, and verify that the checksum passes.

func NewCode39ReaderWithFlags

func NewCode39ReaderWithFlags(usingCheckDigit, extendedMode bool) gozxing.Reader

NewCode39ReaderWithFlags Creates a reader that can be configured to check the last character as a check digit, or optionally attempt to decode "extended Code 39" sequences that are used to encode the full ASCII character set.

@param usingCheckDigit if true, treat the last data character as a check digit, not data, and verify that the checksum passes. @param extendedMode if true, will attempt to decode extended Code 39 sequences in the text.

func NewCode39Writer

func NewCode39Writer() gozxing.Writer

func NewCode93Reader

func NewCode93Reader() gozxing.Reader

func NewCode93Writer

func NewCode93Writer() gozxing.Writer

func NewEAN13Reader

func NewEAN13Reader() gozxing.Reader

func NewEAN13Writer

func NewEAN13Writer() gozxing.Writer

func NewEAN8Reader

func NewEAN8Reader() gozxing.Reader

func NewEAN8Writer

func NewEAN8Writer() gozxing.Writer

func NewITFReader

func NewITFReader() gozxing.Reader

func NewITFWriter

func NewITFWriter() gozxing.Writer

func NewMultiFormatUPCEANReader

func NewMultiFormatUPCEANReader(hints map[gozxing.DecodeHintType]interface{}) gozxing.Reader

func NewUPCAReader

func NewUPCAReader() gozxing.Reader

func NewUPCAWriter

func NewUPCAWriter() gozxing.Writer

func NewUPCEReader

func NewUPCEReader() gozxing.Reader

func NewUPCEWriter

func NewUPCEWriter() gozxing.Writer

func PatternMatchVariance

func PatternMatchVariance(counters, pattern []int, maxIndividualVariance float64) float64

PatternMatchVariance Determines how closely a set of observed counts of runs of black/white values matches a given target pattern. This is reported as the ratio of the total variance from the expected pattern proportions across all pattern elements, to the length of the pattern.

@param counters observed counters @param pattern expected pattern @param maxIndividualVariance The most any counter can differ before we give up @return ratio of total variance between counters and pattern compared to total pattern size

func RecordPattern

func RecordPattern(row *gozxing.BitArray, start int, counters []int) error

RecordPattern Records the size of successive runs of white and black pixels in a row, starting at a given point. The values are recorded in the given array, and the number of runs recorded is equal to the size of the array. If the row starts on a white pixel at the given start point, then the first count recorded is the run of white pixels starting from that point; likewise it is the count of a run of black pixels if the row begin on a black pixels at that point.

@param row row to count from @param start offset into row to start at @param counters array into which to record counts @throws NotFoundException if counters cannot be filled entirely from row before running out

of pixels

func RecordPatternInReverse

func RecordPatternInReverse(row *gozxing.BitArray, start int, counters []int) error

Types

type OneDReader

type OneDReader struct {
	RowDecoder
}

OneDReader Encapsulates functionality and implementation that is common to all families of one-dimensional barcodes.

func NewOneDReader

func NewOneDReader(rowDecoder RowDecoder) *OneDReader

func (*OneDReader) Decode

func (this *OneDReader) Decode(
	image *gozxing.BinaryBitmap, hints map[gozxing.DecodeHintType]interface{}) (*gozxing.Result, error)

Decode Note that we don't try rotation without the try harder flag, even if rotation was supported.

func (*OneDReader) DecodeWithoutHints

func (this *OneDReader) DecodeWithoutHints(image *gozxing.BinaryBitmap) (*gozxing.Result, error)

func (*OneDReader) Reset

func (this *OneDReader) Reset()

type OneDimensionalCodeWriter

type OneDimensionalCodeWriter struct {
	// contains filtered or unexported fields
}

func NewOneDimensionalCodeWriter

func NewOneDimensionalCodeWriter(enc encoder) *OneDimensionalCodeWriter

func NewUPCEANWriter

func NewUPCEANWriter(enc encoder) *OneDimensionalCodeWriter

func (*OneDimensionalCodeWriter) Encode

func (this *OneDimensionalCodeWriter) Encode(
	contents string, format gozxing.BarcodeFormat, width, height int,
	hints map[gozxing.EncodeHintType]interface{}) (*gozxing.BitMatrix, error)

Encode the contents following specified format. {@code width} and {@code height} are required size. This method may return bigger size {@code BitMatrix} when specified size is too small. The user can set both {@code width} and {@code height} to zero to get minimum size barcode. If negative value is set to {@code width} or {@code height}, {@code IllegalArgumentException} is thrown.

func (*OneDimensionalCodeWriter) EncodeWithoutHint

func (this *OneDimensionalCodeWriter) EncodeWithoutHint(
	contents string, format gozxing.BarcodeFormat, width, height int) (*gozxing.BitMatrix, error)

type RowDecoder

type RowDecoder interface {
	// decodeRow Attempts to decode a one-dimensional barcode format given a single row of an image
	// @param rowNumber row number from top of the row
	// @param row the black/white pixel data of the row
	// @param hints decode hints
	// @return {@link Result} containing encoded string and start/end of barcode
	// @throws NotFoundException if no potential barcode is found
	// @throws ChecksumException if a potential barcode is found but does not pass its checksum
	// @throws FormatException if a potential barcode is found but format is invalid
	DecodeRow(rowNumber int, row *gozxing.BitArray, hints map[gozxing.DecodeHintType]interface{}) (*gozxing.Result, error)
}

type UPCEANExtension2Support

type UPCEANExtension2Support struct {
	// contains filtered or unexported fields
}

func NewUPCEANExtension2Support

func NewUPCEANExtension2Support() *UPCEANExtension2Support

type UPCEANExtension5Support

type UPCEANExtension5Support struct {
	// contains filtered or unexported fields
}

func NewUPCEANExtension5Support

func NewUPCEANExtension5Support() *UPCEANExtension5Support

type UPCEANExtensionSupport

type UPCEANExtensionSupport struct {
	// contains filtered or unexported fields
}

func NewUPCEANExtensionSupport

func NewUPCEANExtensionSupport() *UPCEANExtensionSupport

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL