ar8t

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

README

English

أرقط

قارئ لرموز الاستجابة السريعة(QR Code) مكتوب بـ Go.

حاليا، هذا المشروع نقل حرفي لحزمة Rust أدناه https://github.com/piderman314/bardecoder

ar8t

A QR Decoder in Go.

Currently it's a port of piderman314/bardecoder

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSymbolsFound = errors.New("no symbols found")

Functions

func Blocks

func Blocks(data QRData, level ECLevel, mask QRMask) ([][]byte, error)

func Correct

func Correct(block []byte, blockInfo BlockInfo) ([]byte, error)

func CorrectWithErrorCount

func CorrectWithErrorCount(block []byte, blockInfo BlockInfo) ([]byte, int, error)

func Data

func Data(input []byte, version uint32) ([]byte, error)

func Format

func Format(data QRData) (ECLevel, QRMask, error)

Types

type BlockCoord

type BlockCoord uint32

type BlockInfo

type BlockInfo struct {
	BlockCount        byte
	TotalPer, DataPer byte
	EC_Cap            byte
}

func GetBlockInfo

func GetBlockInfo(version uint32, level ECLevel) ([]BlockInfo, error)

type BlockSize

type BlockSize uint32

type BlockedMean

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

func NewBlockedMean

func NewBlockedMean(blockSize, blockMeanSize uint32) BlockedMean

func (BlockedMean) Prepare

func (b BlockedMean) Prepare(img image.Image) *image.Gray

type Chomp

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

func NewChomp

func NewChomp(b []byte) *Chomp

NewChomp creates a chomper dependant on bytes

func (*Chomp) Chomp

func (ch *Chomp) Chomp(nBits uint8) (result byte, ok bool)

func (*Chomp) ChompUint16

func (ch *Chomp) ChompUint16(nBits uint8) (uint16, bool)

type DefaultDecoder

type DefaultDecoder struct{}

func (DefaultDecoder) Decode

func (DefaultDecoder) Decode(src image.Image) ([][]byte, error)

type Detector

type Detector interface {
	Detect(prepared *image.Gray) []QRLocation
}

type ECLevel

type ECLevel int
const (
	ECLevelLow ECLevel = iota
	ECLevelMedium
	ECLevelQuartile
	ECLevelHigh
)

type LineScan

type LineScan struct{}

func (LineScan) Detect

func (s LineScan) Detect(prepared *image.Gray) []QRLocation

type Point

type Point struct {
	X, Y float64
}

func (Point) Add

func (p Point) Add(q Point) Point

func (Point) Div

func (p Point) Div(k float64) Point

Div returns the vector p/k.

func (Point) Mul

func (p Point) Mul(k float64) Point

Mul returns the vector p*k.

func (Point) Sub

func (p Point) Sub(q Point) Point

Sub returns the vector p-q.

type QRData

type QRData struct {
	/// QR Pixel Data in side x side pixels, stored in row major order. Using the provided index will convert into 1's and 0's.
	Data []byte

	/// Version of the QR Code, 1 being the smallest, 40 the largest
	Version uint32

	/// Side in pixels of the QR square
	Side uint32
}

func (QRData) Index

func (d QRData) Index(x, y uint32) byte

type QRDecoder

type QRDecoder struct{}

QRDecoder is ready to use as is

func (QRDecoder) Decode

func (QRDecoder) Decode(qrData QRData) ([]byte, error)

type QRExtract

type QRExtract struct{}

func (QRExtract) Extract

func (QRExtract) Extract(prepared *image.Gray, loc QRLocation) (QRData, error)

type QRExtractor

type QRExtractor interface {
	Extract(*image.Gray, QRLocation)
}

type QRFinderPattern

type QRFinderPattern [7]uint

func (*QRFinderPattern) EstimateModuleSize

func (p *QRFinderPattern) EstimateModuleSize() float64

func (*QRFinderPattern) LooksLikeFinder

func (p *QRFinderPattern) LooksLikeFinder() bool

func (*QRFinderPattern) Slide

func (p *QRFinderPattern) Slide()

type QRFinderPosition

type QRFinderPosition struct {
	Location                   Point
	ModuleSize, LastModuleSize float64
}

type QRLocation

type QRLocation struct {
	TopLeft, TopRight, BottomLeft Point
	ModuleSize                    float64 //in pixels
	Version                       uint32  //1 .. 40
}

type QRMask

type QRMask = func(QRData, uint32, uint32) byte

Jump to

Keyboard shortcuts

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