bitmap

package
v3.0.0-...-55e877b Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2023 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Blit

func Blit(src *Bitmap, dst *Bitmap, x, y int, op CombinationOperator) error

func ClipBoxToRectangle

func ClipBoxToRectangle(box *_bg.Rectangle, wi, hi int) (_fcff *_bg.Rectangle, _fagf error)

func CombineBytes

func CombineBytes(oldByte, newByte byte, op CombinationOperator) byte

func CorrelationScore

func CorrelationScore(bm1, bm2 *Bitmap, area1, area2 int, delX, delY float32, maxDiffW, maxDiffH int, tab []int) (_bef float64, _efbg error)

func CorrelationScoreSimple

func CorrelationScoreSimple(bm1, bm2 *Bitmap, area1, area2 int, delX, delY float32, maxDiffW, maxDiffH int, tab []int) (_gefb float64, _bcgf error)

func CorrelationScoreThresholded

func CorrelationScoreThresholded(bm1, bm2 *Bitmap, area1, area2 int, delX, delY float32, maxDiffW, maxDiffH int, tab, downcount []int, scoreThreshold float32) (bool, error)

func HausTest

func HausTest(p1, p2, p3, p4 *Bitmap, delX, delY float32, maxDiffW, maxDiffH int) (bool, error)

func MakePixelCentroidTab8

func MakePixelCentroidTab8() []int

func MakePixelSumTab8

func MakePixelSumTab8() []int

func RankHausTest

func RankHausTest(p1, p2, p3, p4 *Bitmap, delX, delY float32, maxDiffW, maxDiffH, area1, area3 int, rank float32, tab8 []int) (_fgcf bool, _gbdb error)

func RasterOperation

func RasterOperation(dest *Bitmap, dx, dy, dw, dh int, op RasterOperator, src *Bitmap, sx, sy int) error

func Rect

func Rect(x, y, w, h int) (*_bg.Rectangle, error)

func TstAddSymbol

func TstAddSymbol(t *_bd.T, bms *Bitmaps, sym *Bitmap, x *int, y int, space int)

func TstFrameBitmapData

func TstFrameBitmapData() []byte

func TstImageBitmapData

func TstImageBitmapData() []byte

func TstImageBitmapInverseData

func TstImageBitmapInverseData() []byte

func TstWriteSymbols

func TstWriteSymbols(t *_bd.T, bms *Bitmaps, src *Bitmap)

Types

type Bitmap

type Bitmap struct {
	Width, Height            int
	BitmapNumber             int
	RowStride                int
	Data                     []byte
	Color                    Color
	Special                  int
	Text                     string
	XResolution, YResolution int
}

func Copy

func Copy(d, s *Bitmap) (*Bitmap, error)

func Dilate

func Dilate(d *Bitmap, s *Bitmap, sel *Selection) (*Bitmap, error)

func DilateBrick

func DilateBrick(d, s *Bitmap, hSize, vSize int) (*Bitmap, error)

func Extract

func Extract(roi _bg.Rectangle, src *Bitmap) (*Bitmap, error)

func MorphSequence

func MorphSequence(src *Bitmap, sequence ...MorphProcess) (*Bitmap, error)

func New

func New(width, height int) *Bitmap

func NewWithData

func NewWithData(width, height int, data []byte) (*Bitmap, error)

func NewWithUnpaddedData

func NewWithUnpaddedData(width, height int, data []byte) (*Bitmap, error)

func TstASymbol

func TstASymbol(t *_bd.T) *Bitmap

func TstCSymbol

func TstCSymbol(t *_bd.T) *Bitmap

func TstDSymbol

func TstDSymbol(t *_bd.T, scale ...int) *Bitmap

func TstESymbol

func TstESymbol(t *_bd.T, scale ...int) *Bitmap

func TstFrameBitmap

func TstFrameBitmap() *Bitmap

func TstGetScaledSymbol

func TstGetScaledSymbol(t *_bd.T, sm *Bitmap, scale ...int) *Bitmap

func TstISymbol

func TstISymbol(t *_bd.T, scale ...int) *Bitmap

func TstImageBitmap

func TstImageBitmap() *Bitmap

func TstNSymbol

func TstNSymbol(t *_bd.T, scale ...int) *Bitmap

func TstOSymbol

func TstOSymbol(t *_bd.T, scale ...int) *Bitmap

func TstPSymbol

func TstPSymbol(t *_bd.T) *Bitmap

func TstRSymbol

func TstRSymbol(t *_bd.T, scale ...int) *Bitmap

func TstTSymbol

func TstTSymbol(t *_bd.T, scale ...int) *Bitmap

func TstVSymbol

func TstVSymbol(t *_bd.T, scale ...int) *Bitmap

func TstWSymbol

func TstWSymbol(t *_bd.T, scale ...int) *Bitmap

func TstWordBitmap

func TstWordBitmap(t *_bd.T, scale ...int) *Bitmap

func TstWordBitmapWithSpaces

func TstWordBitmapWithSpaces(t *_bd.T, scale ...int) *Bitmap

func (*Bitmap) AddBorder

func (_ecd *Bitmap) AddBorder(borderSize, val int) (*Bitmap, error)

func (*Bitmap) AddBorderGeneral

func (_bddg *Bitmap) AddBorderGeneral(left, right, top, bot int, val int) (*Bitmap, error)

func (*Bitmap) And

func (_bda *Bitmap) And(s *Bitmap) (_bec *Bitmap, _bbf error)

func (*Bitmap) ClipRectangle

func (_gdgf *Bitmap) ClipRectangle(box *_bg.Rectangle) (_adb *Bitmap, _ecc *_bg.Rectangle, _edfa error)

func (*Bitmap) ConnComponents

func (_eega *Bitmap) ConnComponents(bms *Bitmaps, connectivity int) (_bbebg *Boxes, _fce error)

func (*Bitmap) Copy

func (_eff *Bitmap) Copy() *Bitmap

func (*Bitmap) CountPixels

func (_fbb *Bitmap) CountPixels() int

func (*Bitmap) CreateTemplate

func (_cbd *Bitmap) CreateTemplate() *Bitmap

func (*Bitmap) Equals

func (_ebec *Bitmap) Equals(s *Bitmap) bool

func (*Bitmap) Equivalent

func (_feeb *Bitmap) Equivalent(s *Bitmap) bool

func (*Bitmap) GetBitOffset

func (_bbe *Bitmap) GetBitOffset(x int) int

func (*Bitmap) GetByte

func (_eeg *Bitmap) GetByte(index int) (byte, error)

func (*Bitmap) GetByteIndex

func (_edff *Bitmap) GetByteIndex(x, y int) int

func (*Bitmap) GetChocolateData

func (_acf *Bitmap) GetChocolateData() []byte

func (*Bitmap) GetComponents

func (_gdab *Bitmap) GetComponents(components Component, maxWidth, maxHeight int) (_agbb *Bitmaps, _agf *Boxes, _dgc error)

func (*Bitmap) GetPixel

func (_bca *Bitmap) GetPixel(x, y int) bool

func (*Bitmap) GetUnpaddedData

func (_dccd *Bitmap) GetUnpaddedData() ([]byte, error)

func (*Bitmap) GetVanillaData

func (_ggb *Bitmap) GetVanillaData() []byte

func (*Bitmap) InverseData

func (_ebgb *Bitmap) InverseData()

func (*Bitmap) RasterOperation

func (_cffc *Bitmap) RasterOperation(dx, dy, dw, dh int, op RasterOperator, src *Bitmap, sx, sy int) error

func (*Bitmap) RemoveBorder

func (_gdgg *Bitmap) RemoveBorder(borderSize int) (*Bitmap, error)

func (*Bitmap) RemoveBorderGeneral

func (_ffba *Bitmap) RemoveBorderGeneral(left, right, top, bot int) (*Bitmap, error)

func (*Bitmap) SetByte

func (_ggab *Bitmap) SetByte(index int, v byte) error

func (*Bitmap) SetDefaultPixel

func (_effd *Bitmap) SetDefaultPixel()

func (*Bitmap) SetPadBits

func (_cdd *Bitmap) SetPadBits(value int)

func (*Bitmap) SetPixel

func (_cfd *Bitmap) SetPixel(x, y int, pixel byte) error

func (*Bitmap) SizesEqual

func (_cab *Bitmap) SizesEqual(s *Bitmap) bool

func (*Bitmap) String

func (_cbea *Bitmap) String() string

func (*Bitmap) ThresholdPixelSum

func (_dada *Bitmap) ThresholdPixelSum(thresh int, tab8 []int) (_ggbb bool, _ggda error)

func (*Bitmap) ToImage

func (_egae *Bitmap) ToImage() _bg.Image

func (*Bitmap) Zero

func (_cc *Bitmap) Zero() bool

type Bitmaps

type Bitmaps struct {
	Values []*Bitmap
	Boxes  []*_bg.Rectangle
}

func (*Bitmaps) AddBitmap

func (_daaf *Bitmaps) AddBitmap(bm *Bitmap)

func (*Bitmaps) AddBox

func (_cffce *Bitmaps) AddBox(box *_bg.Rectangle)

func (*Bitmaps) ClipToBitmap

func (_eaeg *Bitmaps) ClipToBitmap(s *Bitmap) (*Bitmaps, error)

func (*Bitmaps) CountPixels

func (_cbcf *Bitmaps) CountPixels() *_e.NumSlice

func (*Bitmaps) GetBitmap

func (_gbcdc *Bitmaps) GetBitmap(i int) (*Bitmap, error)

func (*Bitmaps) GetBox

func (_ddeaa *Bitmaps) GetBox(i int) (*_bg.Rectangle, error)

func (*Bitmaps) GroupByHeight

func (_cbcfe *Bitmaps) GroupByHeight() (*BitmapsArray, error)

func (*Bitmaps) GroupByWidth

func (_cgggcgg *Bitmaps) GroupByWidth() (*BitmapsArray, error)

func (*Bitmaps) HeightSorter

func (_debc *Bitmaps) HeightSorter() func(_ebda, _fceec int) bool

func (*Bitmaps) SelectByIndexes

func (_ecdda *Bitmaps) SelectByIndexes(idx []int) (*Bitmaps, error)

func (*Bitmaps) SelectBySize

func (_ceff *Bitmaps) SelectBySize(width, height int, tp LocationFilter, relation SizeComparison) (_gfgg *Bitmaps, _befeg error)

func (*Bitmaps) Size

func (_ddae *Bitmaps) Size() int

func (*Bitmaps) SortByHeight

func (_efef *Bitmaps) SortByHeight()

func (*Bitmaps) SortByWidth

func (_bged *Bitmaps) SortByWidth()

func (*Bitmaps) String

func (_acgd *Bitmaps) String() string

func (*Bitmaps) WidthSorter

func (_fdcff *Bitmaps) WidthSorter() func(_gbcb, _gded int) bool

type BitmapsArray

type BitmapsArray struct {
	Values []*Bitmaps
	Boxes  []*_bg.Rectangle
}

func (*BitmapsArray) AddBitmaps

func (_edbd *BitmapsArray) AddBitmaps(bm *Bitmaps)

func (*BitmapsArray) AddBox

func (_acdg *BitmapsArray) AddBox(box *_bg.Rectangle)

func (*BitmapsArray) GetBitmaps

func (_acbgb *BitmapsArray) GetBitmaps(i int) (*Bitmaps, error)

func (*BitmapsArray) GetBox

func (_acabc *BitmapsArray) GetBox(i int) (*_bg.Rectangle, error)

type BoundaryCondition

type BoundaryCondition int
const (
	AsymmetricMorphBC BoundaryCondition = iota
	SymmetricMorphBC
)
var MorphBC BoundaryCondition

type Boxes

type Boxes []*_bg.Rectangle

func (*Boxes) Add

func (_gcdb *Boxes) Add(box *_bg.Rectangle) error

func (*Boxes) Get

func (_bfab *Boxes) Get(i int) (*_bg.Rectangle, error)

func (*Boxes) SelectBySize

func (_bccc *Boxes) SelectBySize(width, height int, tp LocationFilter, relation SizeComparison) (_abba *Boxes, _afeb error)

type ClassedPoints

type ClassedPoints struct {
	*Points
	_e.IntSlice
	// contains filtered or unexported fields
}

func NewClassedPoints

func NewClassedPoints(points *Points, classes _e.IntSlice) (*ClassedPoints, error)

func (*ClassedPoints) GetIntXByClass

func (_cggge *ClassedPoints) GetIntXByClass(i int) (int, error)

func (*ClassedPoints) GetIntYByClass

func (_bgfb *ClassedPoints) GetIntYByClass(i int) (int, error)

func (*ClassedPoints) GroupByY

func (_cace *ClassedPoints) GroupByY() ([]*ClassedPoints, error)

func (*ClassedPoints) Len

func (_eabb *ClassedPoints) Len() int

func (*ClassedPoints) Less

func (_caefd *ClassedPoints) Less(i, j int) bool

func (*ClassedPoints) SortByX

func (_fcgf *ClassedPoints) SortByX()

func (*ClassedPoints) SortByY

func (_dccb *ClassedPoints) SortByY()

func (*ClassedPoints) Swap

func (_eccc *ClassedPoints) Swap(i, j int)

func (*ClassedPoints) XAtIndex

func (_geaf *ClassedPoints) XAtIndex(i int) float32

func (*ClassedPoints) YAtIndex

func (_bbcd *ClassedPoints) YAtIndex(i int) float32

type Color

type Color int
const (
	Vanilla Color = iota
	Chocolate
)

type CombinationOperator

type CombinationOperator int
const (
	CmbOpOr CombinationOperator = iota
	CmbOpAnd
	CmbOpXor
	CmbOpXNor
	CmbOpReplace
	CmbOpNot
)

func (CombinationOperator) String

func (_bbfed CombinationOperator) String() string

type Component

type Component int
const (
	ComponentConn Component = iota
	ComponentCharacters
	ComponentWords
)

type Getter

type Getter interface{ GetBitmap() *Bitmap }

type LocationFilter

type LocationFilter int
const (
	LocSelectWidth LocationFilter
	LocSelectHeight
	LocSelectXVal
	LocSelectYVal
	LocSelectIfEither
	LocSelectIfBoth
)

type MorphOperation

type MorphOperation int
const (
	MopDilation MorphOperation = iota
	MopErosion
	MopOpening
	MopClosing
	MopRankBinaryReduction
	MopReplicativeBinaryExpansion
	MopAddBorder
)

type MorphProcess

type MorphProcess struct {
	Operation MorphOperation
	Arguments []int
}

type Point

type Point struct{ X, Y float32 }

func Centroid

func Centroid(bm *Bitmap, centTab, sumTab []int) (Point, error)

type Points

type Points []Point

func Centroids

func Centroids(bms []*Bitmap) (*Points, error)

func (*Points) Add

func (_dffgb *Points) Add(pt *Points) error

func (*Points) AddPoint

func (_befe *Points) AddPoint(x, y float32)

func (Points) Get

func (_dgaa Points) Get(i int) (Point, error)

func (Points) GetGeometry

func (_baf Points) GetGeometry(i int) (_ceaa, _gcef float32, _gfda error)

func (Points) GetIntX

func (_aefb Points) GetIntX(i int) (int, error)

func (Points) GetIntY

func (_dbeb Points) GetIntY(i int) (int, error)

func (Points) Size

func (_acee Points) Size() int

func (Points) XSorter

func (_faaf Points) XSorter() func(_bgbe, _dgff int) bool

func (Points) YSorter

func (_bfeb Points) YSorter() func(_fbfbf, _cbgf int) bool

type RasterOperator

type RasterOperator int
const (
	PixSrc             RasterOperator = 0xc
	PixDst             RasterOperator = 0xa
	PixNotSrc          RasterOperator = 0x3
	PixNotDst          RasterOperator = 0x5
	PixClr             RasterOperator = 0x0
	PixSet             RasterOperator = 0xf
	PixSrcOrDst        RasterOperator = 0xe
	PixSrcAndDst       RasterOperator = 0x8
	PixSrcXorDst       RasterOperator = 0x6
	PixNotSrcOrDst     RasterOperator = 0xb
	PixNotSrcAndDst    RasterOperator = 0x2
	PixSrcOrNotDst     RasterOperator = 0xd
	PixSrcAndNotDst    RasterOperator = 0x4
	PixNotPixSrcOrDst  RasterOperator = 0x1
	PixNotPixSrcAndDst RasterOperator = 0x7
	PixNotPixSrcXorDst RasterOperator = 0x9
	PixPaint                          = PixSrcOrDst
	PixSubtract                       = PixNotSrcAndDst
	PixMask                           = PixSrcAndDst
)

type Selection

type Selection struct {
	Height, Width int
	Cx, Cy        int
	Name          string
	Data          [][]SelectionValue
}

func SelCreateBrick

func SelCreateBrick(h, w int, cy, cx int, tp SelectionValue) *Selection

type SelectionValue

type SelectionValue int
const (
	SelDontCare SelectionValue = iota
	SelHit
	SelMiss
)

type SizeComparison

type SizeComparison int
const (
	SizeSelectIfLT SizeComparison
	SizeSelectIfGT
	SizeSelectIfLTE
	SizeSelectIfGTE
	SizeSelectIfEQ
)

type SizeSelection

type SizeSelection int
const (
	SizeSelectByWidth SizeSelection
	SizeSelectByHeight
	SizeSelectByMaxDimension
	SizeSelectByArea
	SizeSelectByPerimeter
)

Jump to

Keyboard shortcuts

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