Documentation
¶
Index ¶
- Constants
- func ScanSingleSymbol(device string) (result, symbol_type string, err error)
- type Image
- func (i *Image) Convert(format uint64) *Image
- func (i *Image) ConvertResize(format uint64, width, height uint) *Image
- func (i *Image) Destroy()
- func (i *Image) FirstSymbol() *Symbol
- func (i *Image) FreeData()
- func (i *Image) GetData() interface{}
- func (i *Image) GetDataLength() uint64
- func (i *Image) GetFormat() uint64
- func (i *Image) GetHeight() uint
- func (i *Image) GetSequence() uint
- func (i *Image) GetSymbols() *SymbolSet
- func (i *Image) GetWidth() uint
- func (i *Image) Ref(refs int)
- func (i *Image) SetFormat(format uint64)
- func (i *Image) SetSequence(sequenceNum uint)
- func (i *Image) SetSize(width, height uint)
- func (i *Image) SetSymbols(symbols *SymbolSet)
- func (i *Image) Write(filebase string) int
- type Processor
- func (p *Processor) Destroy()
- func (p *Processor) ErrorString(verbosity int) string
- func (p *Processor) ForceFormat(inputFormat, outputFormat uint64) int
- func (p *Processor) GetErrorCode() int
- func (p *Processor) GetResults() *SymbolSet
- func (p *Processor) GetUserData() unsafe.Pointer
- func (p *Processor) Init(device string, enableDisplay int) int
- func (p *Processor) ProcessOne(timeout int) int
- func (p *Processor) RequestIOMode(iomode int) int
- func (p *Processor) RequestInterface(version int) int
- func (p *Processor) RequestSize(width, height uint) int
- func (p *Processor) SetActive(active int) int
- func (p *Processor) SetConfig(symbology int, config int, value int) int
- func (p *Processor) SetDataHandler(fn func(img *Image))
- func (p *Processor) SetUserData(userdata unsafe.Pointer)
- func (p *Processor) SetVisible(visible int) int
- func (p *Processor) UserWait(timeout int) int
- type Symbol
- func (s *Symbol) FirstComponent() *Symbol
- func (s *Symbol) GetAddonName() string
- func (s *Symbol) GetComponents() *SymbolSet
- func (s *Symbol) GetCount() int
- func (s *Symbol) GetData() string
- func (s *Symbol) GetDataLength() uint
- func (s *Symbol) GetLocSize() uint
- func (s *Symbol) GetLocX(index uint) int
- func (s *Symbol) GetLocY(index uint) int
- func (s *Symbol) GetName() string
- func (s *Symbol) GetQuality() int
- func (s *Symbol) GetType() int
- func (s *Symbol) Next() *Symbol
- func (s *Symbol) Ref(refs int)
- type SymbolSet
Constants ¶
const ( ZBAR_SPACE = iota // light area or space between bars ZBAR_BAR // dark area or colored bar segment )
"color" of element: bar or space.
const ( ZBAR_NONE = 0 /**< no symbol decoded */ ZBAR_PARTIAL = 1 /**< intermediate status */ ZBAR_EAN2 = 2 /**< GS1 2-digit add-on */ ZBAR_EAN5 = 5 /**< GS1 5-digit add-on */ ZBAR_EAN8 = 8 /**< EAN-8 */ ZBAR_UPCE = 9 /**< UPC-E */ ZBAR_ISBN10 = 10 /**< ISBN-10 (from EAN-13). @since 0.4 */ ZBAR_UPCA = 12 /**< UPC-A */ ZBAR_EAN13 = 13 /**< EAN-13 */ ZBAR_ISBN13 = 14 /**< ISBN-13 (from EAN-13). @since 0.4 */ ZBAR_COMPOSITE = 15 /**< EAN/UPC composite */ ZBAR_I25 = 25 /**< Interleaved 2 of 5. @since 0.4 */ ZBAR_DATABAR = 34 /**< GS1 DataBar (RSS). @since 0.11 */ ZBAR_DATABAR_EXP = 35 /**< GS1 DataBar Expanded. @since 0.11 */ ZBAR_CODABAR = 38 /**< Codabar. @since 0.11 */ ZBAR_CODE39 = 39 /**< Code 39. @since 0.4 */ ZBAR_PDF417 = 57 /**< PDF417. @since 0.6 */ ZBAR_QRCODE = 64 /**< QR Code. @since 0.10 */ ZBAR_CODE93 = 93 /**< Code 93. @since 0.11 */ ZBAR_CODE128 = 128 /**< Code 128 */ )
zbar_symbol_type_t decoded symbol type.
const ( ZBAR_ORIENT_UNKNOWN = -1 + iota /**< unable to determine orientation */ ZBAR_ORIENT_UP /**< upright, read left to right */ ZBAR_ORIENT_RIGHT /**< sideways, read top to bottom */ ZBAR_ORIENT_DOWN /**< upside-down, read right to left */ ZBAR_ORIENT_LEFT /**< sideways, read bottom to top */ )
ZBar orientation
const ( ZBAR_CFG_ENABLE = iota // enable symbology/feature ZBAR_CFG_ADD_CHECK // enable check digit when optional ZBAR_CFG_EMIT_CHECK // return check digit when present ZBAR_CFG_ASCII // enable full ASCII character set ZBAR_CFG_NUM // number of boolean decoder configs ZBAR_CFG_MIN_LEN // minimum data length for valid decode ZBAR_CFG_MAX_LEN // maximum data length for valid decode ZBAR_CFG_POSITION // enable scanner to collect position data ZBAR_CFG_X_DENSITY // image scanner vertical scan density ZBAR_CFG_Y_DENSITY // image scanner horizontal scan density )
zbar_config_t decoder configuration options
const ( ZBAR_OK = iota // no error ZBAR_ERR_NOMEM // out of memory ZBAR_ERR_INTERNAL // internal library error ZBAR_ERR_UNSUPPORTED // unsupported request ZBAR_ERR_INVALID // invalid request ZBAR_ERR_SYSTEM // system error ZBAR_ERR_LOCKING // locking error ZBAR_ERR_BUSY // all resources busy ZBAR_ERR_XDISPLAY // X11 display error. ZBAR_ERR_XPROTO // X11 protocol error. ZBAR_ERR_CLOSED // output window is closed ZBAR_ERR_WINAPI // windows system error ZBAR_ERR_NUM // number of error codes )
error codes
const ( ZBAR_MOD_GS1 = iota // barcode tagged as GS1 (EAN.UCC) reserved (eg, FNC1 before first data character).data may be parsed as a sequence of GS1 AIs ZBAR_MOD_AIM // barcode tagged as AIM reserved (eg, FNC1 after first character or digit pair) ZBAR_MOD_NUM // number of modifiers )
Decoder symbology modifier flags
Variables ¶
This section is empty.
Functions ¶
func ScanSingleSymbol ¶
Recognize single code from webcam
Types ¶
type Image ¶
type Image struct {
// contains filtered or unexported fields
}
func (*Image) ConvertResize ¶
ConvertResize image format conversion with crop/pad.
func (*Image) FirstSymbol ¶
Image_scanner decode result iterator.
func (*Image) GetSequence ¶
Retrieve a "sequence" (page/frame) number associated with this image.
func (*Image) SetSequence ¶
Associate a "sequence" (page/frame) number with this image.
func (*Image) SetSymbols ¶
Associate the specified symbol set with the image, replacing any existing results.
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
func NewProcessor ¶
NewProcessor creates new Processor instance. If threaded is set and threading is available the processor will spawn threads where appropriate to avoid blocking and improve responsiveness
func (*Processor) Destroy ¶
func (p *Processor) Destroy()
Destroy cleans up all resources associated with the processor
func (*Processor) ErrorString ¶
Retrieve the detail string for the last processor error
func (*Processor) ForceFormat ¶
ForceFormat forces specific input and output formats for debug/testing.
func (*Processor) GetErrorCode ¶
Retrieve the type code for the last processor error.
func (*Processor) GetResults ¶
Retrieve decode results for last scanned image/frame.
func (*Processor) GetUserData ¶
Return user specified data value associated with the processor.
func (*Processor) Init ¶
Init - device (re)initialization. Opens a video input device and/or prepares to display output
func (*Processor) ProcessOne ¶
Process from the video stream until a result is available, or the timeout (in milliseconds) expires.
func (*Processor) RequestIOMode ¶
RequestIOMode requests a preferred video I/O mode for debug/testing.
func (*Processor) RequestInterface ¶
RequestInterface requests a preferred video driver interface version for debug/testing.
func (*Processor) RequestSize ¶
RequestSize requests a preferred size for the video image from the device
func (*Processor) SetConfig ¶
SetConfig sets config for indicated symbology (0 for all) to specified value. Returns 0 for success, non-0 for failure (config does not apply to specified symbology, or value out of range)
func (*Processor) SetDataHandler ¶
Setup result handler callback. The specified function will be called by the processor whenever new results are available from the video stream or a static image.
func (*Processor) SetUserData ¶
Associate user specified data value with the processor.
func (*Processor) SetVisible ¶
Show or hide the display window owned by the library.
type Symbol ¶
type Symbol struct {
// contains filtered or unexported fields
}
func (*Symbol) FirstComponent ¶
FirstComponent iterates components of a composite result. Returns:
the first physical component symbol of a composite result nil if the symbol is already a physical symbol
func (*Symbol) GetAddonName ¶
GetAddonName retrieves string name for addon encoding
func (*Symbol) GetComponents ¶
GetComponents retrieves components of a composite result. Returns:
the symbol set containing the components nil if the symbol is already a physical symbol
func (*Symbol) GetCount ¶
GetCount retrieves current cache count. When the cache is enabled for the image_scanner this provides inter-frame reliability and redundancy information for video streams. Returns:
< 0 if symbol is still uncertain. 0 if symbol is newly verified. > 0 for duplicate symbols
func (*Symbol) GetDataLength ¶
GetDataLength retrieves length of binary data.
func (*Symbol) GetLocSize ¶
Retrieve the number of points in the location polygon. The location polygon defines the image area that the symbol was extracted from. Returns the number of points in the location polygon Note:
this is currently not a polygon, but the scan locations where the symbol was decoded
func (*Symbol) GetLocX ¶
GetLocX retrieves location polygon x-coordinates. Points are specified by 0-based index. Returns:
the x-coordinate for a point in the location polygon. -1 if index is out of range
func (*Symbol) GetLocY ¶
GetLocY retrieves location polygon y-coordinates. Points are specified by 0-based index. Returns:
the y-coordinate for a point in the location polygon. -1 if index is out of range
func (*Symbol) GetQuality ¶
GetQuality retrieves a symbol confidence metric. Returns an unscaled, relative quantity: larger values are better than smaller values, where "large" and "small" are application dependent. Note:
expect the exact definition of this quantity to change as the metric is refined. Currently, only the ordered relationship between two values is defined and will remain stable in the future
func (*Symbol) Next ¶
Next iterates the set to which this symbol belongs (there can be only one). Returns:
the next symbol in the set, or nil when no more results are available
func (*Symbol) Ref ¶
Ref is symbol reference count manipulation. Increment the reference count when you store a new reference to the symbol. Decrement when the reference is no longer used. Do not refer to the symbol once the count is decremented and the containing image has been recycled or destroyed. Note:
the containing image holds a reference to the symbol, so you only need to use this if you keep a symbol after the image has been destroyed or reused.
type SymbolSet ¶
type SymbolSet struct {
// contains filtered or unexported fields
}
func (*SymbolSet) SetFirstSymbol ¶
SetFirstSymbol is a set iterator. Returns first decoded symbol result in a set. Nil if the set is empty