Documentation ¶
Index ¶
- Constants
- func Blocking(initialPlanes [3]ImagePlane) ([][]ImagePlane, int, int)
- type ChannelImage
- func ChannelCompose(r, g, b, a ChannelImage) ChannelImage
- func ChannelDecompose(img ChannelImage) (r, g, b, a ChannelImage)
- func NewChannelImage(img image.Image) (ChannelImage, bool, error)
- func NewChannelImageWidthHeight(width, height int) ChannelImage
- func NewDenormalizedChannelImage(p ImagePlane) ChannelImage
- type ImagePlane
- type Mode
- type Model
- type ModelSet
- type Option
- type Param
- type Waifu2x
Constants ¶
const ( // BlockSize is the size of a block when splitting the image plane. BlockSize = 128 // Overlap is the size of the pixels that the image overlaps. Overlap = 14 )
Variables ¶
This section is empty.
Functions ¶
func Blocking ¶
func Blocking(initialPlanes [3]ImagePlane) ([][]ImagePlane, int, int)
Blocking divides a given image into blocks.
Types ¶
type ChannelImage ¶
ChannelImage represents a discrete image.
func ChannelCompose ¶
func ChannelCompose(r, g, b, a ChannelImage) ChannelImage
ChannelCompose composes R, G, B and Alpha channels to the one channel image.
func ChannelDecompose ¶
func ChannelDecompose(img ChannelImage) (r, g, b, a ChannelImage)
ChannelDecompose decomposes a channel image to R, G, B and Alpha channels.
func NewChannelImage ¶
func NewChannelImage(img image.Image) (ChannelImage, bool, error)
NewChannelImage returns a channel image corresponding to the specified image.
func NewChannelImageWidthHeight ¶
func NewChannelImageWidthHeight(width, height int) ChannelImage
NewChannelImageWidthHeight returns a channel image of specific width and height.
func NewDenormalizedChannelImage ¶
func NewDenormalizedChannelImage(p ImagePlane) ChannelImage
NewDenormalizedChannelImage returns a channel image corresponding to the image plane.
func (ChannelImage) Extrapolation ¶
func (c ChannelImage) Extrapolation(px int) ChannelImage
Extrapolation calculates an extrapolation algorithm.
func (ChannelImage) ImageRGBA ¶
func (c ChannelImage) ImageRGBA() image.RGBA
ImageRGBA converts the channel image to an image.RGBA and return it.
func (ChannelImage) Resize ¶
func (c ChannelImage) Resize(scale float64) ChannelImage
Resize returns a resized image.
type ImagePlane ¶
ImagePlane represents an image in which each pixel has a continuous value.
func Deblocking ¶
func Deblocking(outputBlocks [][]ImagePlane, blocksW, blocksH int) [3]ImagePlane
Deblocking combines blocks for each of the R, G, and B channels.
func NewImagePlaneWidthHeight ¶
func NewImagePlaneWidthHeight(width, height int) ImagePlane
NewImagePlaneWidthHeight returns an image plane of specific width and height.
func NewNormalizedImagePlane ¶
func NewNormalizedImagePlane(img ChannelImage) (ImagePlane, error)
NewNormalizedImagePlane create a normalized image plane from a channel image.
func (ImagePlane) Index ¶
func (p ImagePlane) Index(width, height int) int
Index returns the buffer position corresponding to the specified width and height of the image.
func (ImagePlane) SegmentAt ¶
func (p ImagePlane) SegmentAt(x, y int) (a0, a1, a2, b0, b1, b2, c0, c1, c2 float64)
SegmentAt returns the 3x3 pixels at the specified position. [a0][a1][a2] [b0][b1][b2] [c0][c1][c2] where (x, y) is b1.
func (*ImagePlane) SetAt ¶
func (p *ImagePlane) SetAt(width, height int, v float64)
SetAt sets the value to the buffer corresponding to the specified width and height of the image.
func (ImagePlane) Value ¶
func (p ImagePlane) Value(width, height int) float64
Value returns the value corresponding to the specified width and height of the image.
type Model ¶
type Model []Param
Model represents a trained model.
func LoadModelAssets ¶
LoadModelAssets loads a trained model from assets.
func LoadModelFile ¶
LoadModelFile loads a trained model from the specified file.
type Option ¶
Option represents an option of waifu2x.
type Param ¶
type Param struct { Bias []float64 `json:"bias"` // バイアス KW int `json:"kW"` // フィルタの幅 KH int `json:"kH"` // フィルタの高さ Weight [][][][]float64 `json:"weight"` // 重み NInputPlane int `json:"nInputPlane"` // 入力平面数 NOutputPlane int `json:"nOutputPlane"` // 出力平面数 WeightVec []float64 }
Param represents a parameter of the model.
type Waifu2x ¶
type Waifu2x struct {
// contains filtered or unexported fields
}
Waifu2x is the main structure for executing the waifu2x algorithm.
func NewWaifu2x ¶
NewWaifu2x creates a Waifu2x structure.