Documentation ¶
Overview ¶
Package img contains routines for manipulating sets of images.
Index ¶
- Constants
- Variables
- func GetStats(imgList ...[]*Image) (mean, std []float32)
- type Color
- type ConvMode
- type Convolution
- type Data
- func (d *Data) ClassSize() int
- func (d *Data) Classes() []string
- func (d *Data) Decode(r io.Reader) error
- func (d *Data) Encode(w io.Writer) error
- func (d *Data) Image(ix int, channel string) *Image
- func (d *Data) Input(index []int, buf []float32, t *Transformer)
- func (d *Data) Label(index []int, label []int32)
- func (d *Data) Len() int
- func (d *Data) Shape() []int
- func (d *Data) Slice(start, end int) *Data
- type DataHead
- type Image
- func (m *Image) At(x, y int) color.Color
- func (m *Image) Bounds() image.Rectangle
- func (m *Image) ColorModel() color.Model
- func (m *Image) GrayAt(x, y int) float32
- func (m *Image) MarshalBinary() ([]byte, error)
- func (m *Image) Pixels(ch int) []float32
- func (m *Image) Set(x, y int, c color.Color)
- func (m *Image) SetColor(x, y int, c Color)
- func (m *Image) TransformType(normalise, distort bool) TransType
- func (m *Image) UnmarshalBinary(data []byte) error
- type TransType
- type Transformer
Constants ¶
const ( ConvDefault = iota ConvAccel ConvBoxBlur )
Variables ¶
var ( RGBModel = color.ModelFunc(rgbModel) GrayModel = color.ModelFunc(grayModel) )
var ( MaxScale = 0.15 MaxRotate = 15.0 ElasticScale = 0.5 KernelSize = 9 KernelSigma = 4.0 PanPixels = 4 )
var ErrDecodeImage = errors.New("error decoding image")
Functions ¶
Types ¶
type Color ¶
type Color []float32
color is stored as a float for each channel with values in range 0-1
type Convolution ¶
type Convolution interface {
Apply(in, out []float32)
}
Convolution to apply kernel to image
func NewConv ¶
func NewConv(kernel []float32, ksize, width, height int) Convolution
Convolution implemented in go assuming 1d seperable kernel
func NewConvBox ¶
func NewConvBox(sigma float64, width, height int) Convolution
Gaussian convolution using box blur
func NewConvMkl ¶
func NewConvMkl(kernel []float32, ksize, width, height int) Convolution
Accelerated convolution using Intel MKL libraries
type Data ¶
Image data set which implements the nnet.Data interface
func NewDataLike ¶
func (*Data) Image ¶
Image returns given image number, if channel is set then just show this colour channel
func (*Data) Input ¶
func (d *Data) Input(index []int, buf []float32, t *Transformer)
Input returns scaled input data in buf array
type Image ¶
Image type stores the image data as float32 values in column major order with r, g and b color planes stored separately.
func NewImageLike ¶
func (*Image) ColorModel ¶
func (*Image) MarshalBinary ¶
func (*Image) TransformType ¶
func (*Image) UnmarshalBinary ¶
type Transformer ¶
type Transformer struct { Amount float64 Trans TransType // contains filtered or unexported fields }
func NewTransformer ¶
Create a new transformer object which applies a sequency of image transformations
func (*Transformer) Transform ¶
func (t *Transformer) Transform(img *Image, thread int) (*Image, error)
Perform one or more image transforms
func (*Transformer) TransformBatch ¶
func (t *Transformer) TransformBatch(index []int, dst []*Image) []*Image
Transform a batch of images in parallel