Documentation ¶
Index ¶
- Constants
- Variables
- func GetColorFromPixel(px Pixel, imageType ImageType) (color.Color, error)
- type Gray16ImageHandler
- func (handler *Gray16ImageHandler) At(row, column int) (Pixel, error)
- func (handler *Gray16ImageHandler) GetDimensions() image.Rectangle
- func (handler *Gray16ImageHandler) Mode() ImageType
- func (handler *Gray16ImageHandler) SaveImage(filePath string) error
- func (handler *Gray16ImageHandler) Set(row, column int, px Pixel) error
- type GrayImageHandler
- func (handler *GrayImageHandler) At(row, column int) (Pixel, error)
- func (handler *GrayImageHandler) GetDimensions() image.Rectangle
- func (handler *GrayImageHandler) Mode() ImageType
- func (handler *GrayImageHandler) SaveImage(filePath string) error
- func (handler *GrayImageHandler) Set(row, column int, px Pixel) error
- type ImageHandler
- type ImageType
- type Kernel
- type NRGBA64ImageHandler
- func (handler *NRGBA64ImageHandler) At(row, column int) (Pixel, error)
- func (handler *NRGBA64ImageHandler) GetDimensions() image.Rectangle
- func (handler *NRGBA64ImageHandler) Mode() ImageType
- func (handler *NRGBA64ImageHandler) SaveImage(filePath string) error
- func (handler *NRGBA64ImageHandler) Set(row, column int, px Pixel) error
- type NRGBAImageHandler
- func (handler *NRGBAImageHandler) At(row, column int) (Pixel, error)
- func (handler *NRGBAImageHandler) GetDimensions() image.Rectangle
- func (handler *NRGBAImageHandler) Mode() ImageType
- func (handler *NRGBAImageHandler) SaveImage(filePath string) error
- func (handler *NRGBAImageHandler) Set(row, column int, px Pixel) error
- type PalettedImageHandler
- func (handler *PalettedImageHandler) At(row, column int) (Pixel, error)
- func (handler *PalettedImageHandler) GetDimensions() image.Rectangle
- func (handler *PalettedImageHandler) Mode() ImageType
- func (handler *PalettedImageHandler) SaveImage(filePath string) error
- func (handler *PalettedImageHandler) Set(row, column int, px Pixel) error
- type Pixel
- type RGBA64ImageHandler
- func (handler *RGBA64ImageHandler) At(row, column int) (Pixel, error)
- func (handler *RGBA64ImageHandler) GetDimensions() image.Rectangle
- func (handler *RGBA64ImageHandler) Mode() ImageType
- func (handler *RGBA64ImageHandler) SaveImage(filePath string) error
- func (handler *RGBA64ImageHandler) Set(row, column int, px Pixel) error
- type RGBAImageHandler
- func (handler *RGBAImageHandler) At(row, column int) (Pixel, error)
- func (handler *RGBAImageHandler) GetDimensions() image.Rectangle
- func (handler *RGBAImageHandler) Mode() ImageType
- func (handler *RGBAImageHandler) SaveImage(filePath string) error
- func (handler *RGBAImageHandler) Set(row, column int, px Pixel) error
Constants ¶
const ( ImageTypeNRGBA = ImageType(iota) ImageTypeNRGBA64 ImageTypeRGBA ImageTypeRGBA64 ImageTypeGray ImageTypeGray16 ImageTypePaletted )
Enumeration of image types
Variables ¶
var ( // ErrRowColumnCannotBeZero thrown when either row or columns or both is zero ErrRowColumnCannotBeZero = errors.New("Row and Column cannot be zero") // ErrRowColumnOutOfBounds is thrown when row and/or column is out of bounds for the defined kernel ErrRowColumnOutOfBounds = errors.New("Row and/or Column is out of bounds") // ErrUnsupportedImageFormat is thrown when the image is of unsupported format ErrUnsupportedImageFormat = errors.New("The image format is unsupported") )
Functions ¶
Types ¶
type Gray16ImageHandler ¶
Gray16ImageHandler struct to handle the Gray16 Image
func (*Gray16ImageHandler) At ¶
func (handler *Gray16ImageHandler) At(row, column int) (Pixel, error)
At returns the Pixel at row and column of the image
func (*Gray16ImageHandler) GetDimensions ¶
func (handler *Gray16ImageHandler) GetDimensions() image.Rectangle
GetDimensions returns the dimensions as a Rectangle for the image
func (*Gray16ImageHandler) Mode ¶
func (handler *Gray16ImageHandler) Mode() ImageType
Mode returns the ImageType of the images
func (*Gray16ImageHandler) SaveImage ¶
func (handler *Gray16ImageHandler) SaveImage(filePath string) error
SaveImage saves the image to the filepath specified
type GrayImageHandler ¶
GrayImageHandler struct to handle the Gray Image
func (*GrayImageHandler) At ¶
func (handler *GrayImageHandler) At(row, column int) (Pixel, error)
At returns the Pixel at row and column of the image
func (*GrayImageHandler) GetDimensions ¶
func (handler *GrayImageHandler) GetDimensions() image.Rectangle
GetDimensions returns the dimensions as a Rectangle for the image
func (*GrayImageHandler) Mode ¶
func (handler *GrayImageHandler) Mode() ImageType
Mode returns the ImageType of the images
func (*GrayImageHandler) SaveImage ¶
func (handler *GrayImageHandler) SaveImage(filePath string) error
SaveImage saves the image to the filepath specified
type ImageHandler ¶
type ImageHandler interface { At(row, column int) (Pixel, error) Set(row, column int, px Pixel) error Mode() ImageType GetDimensions() image.Rectangle SaveImage(filePath string) error }
ImageHandler interface for polymorphism
func Apply ¶
func Apply(filter *Kernel, src ImageHandler) (ImageHandler, error)
Apply is the convolution function used to apply the provided filter on the given image. It makes a copy and returns the filtered image without modifying the src image.
func New ¶
func New(imgT ImageType, dimensions image.Rectangle) (ImageHandler, error)
New returns an ImageHandler with a new Image This handler will be used for the result
func ReadImage ¶
func ReadImage(path string) (ImageHandler, error)
ReadImage reads the image from the specified path it will return the interface ImageHandler of the correct type specified in the image
type Kernel ¶
Kernel struct handles data for the filter kernel
func CreateKernel ¶
CreateKernel creates a kernel object from the params
func (*Kernel) CalculateShift ¶
CalculateShift returns the amount the original image must be shifted
type NRGBA64ImageHandler ¶
NRGBA64ImageHandler struct to handle NRGBA64 Image
func (*NRGBA64ImageHandler) At ¶
func (handler *NRGBA64ImageHandler) At(row, column int) (Pixel, error)
At retuns the Pixel at row and column of the image
func (*NRGBA64ImageHandler) GetDimensions ¶
func (handler *NRGBA64ImageHandler) GetDimensions() image.Rectangle
GetDimensions returns the dimensions as a Rectangle for the image
func (*NRGBA64ImageHandler) Mode ¶
func (handler *NRGBA64ImageHandler) Mode() ImageType
Mode returns the ImageType of the images
func (*NRGBA64ImageHandler) SaveImage ¶
func (handler *NRGBA64ImageHandler) SaveImage(filePath string) error
SaveImage saves the image to the filepath specified
type NRGBAImageHandler ¶
NRGBAImageHandler struct to handle NRGBA Image
func (*NRGBAImageHandler) At ¶
func (handler *NRGBAImageHandler) At(row, column int) (Pixel, error)
At returns the Pixel at row and column of the image
func (*NRGBAImageHandler) GetDimensions ¶
func (handler *NRGBAImageHandler) GetDimensions() image.Rectangle
GetDimensions returns the dimensions as a Rectangle for the image
func (*NRGBAImageHandler) Mode ¶
func (handler *NRGBAImageHandler) Mode() ImageType
Mode returns the ImageType for the image
func (*NRGBAImageHandler) SaveImage ¶
func (handler *NRGBAImageHandler) SaveImage(filePath string) error
SaveImage saves the image to the filepath specified
type PalettedImageHandler ¶
Gray16ImageHandler struct to handle the Gray16 Image
func (*PalettedImageHandler) At ¶
func (handler *PalettedImageHandler) At(row, column int) (Pixel, error)
At returns the Pixel at row and column of the image
func (*PalettedImageHandler) GetDimensions ¶
func (handler *PalettedImageHandler) GetDimensions() image.Rectangle
GetDimensions returns the dimensions as a Rectangle for the image
func (*PalettedImageHandler) Mode ¶
func (handler *PalettedImageHandler) Mode() ImageType
Mode returns the ImageType of the images
func (*PalettedImageHandler) SaveImage ¶
func (handler *PalettedImageHandler) SaveImage(filePath string) error
SaveImage saves the image to the filepath specified
type Pixel ¶
type Pixel struct {
// contains filtered or unexported fields
}
Pixel struct to contain RGBA components for images
func ConvertColor ¶
ConvertColor converts color.Color to Pixel
type RGBA64ImageHandler ¶
RGBA64ImageHandler struct to handle the RGBA64 Image
func (*RGBA64ImageHandler) At ¶
func (handler *RGBA64ImageHandler) At(row, column int) (Pixel, error)
At returns the Pixel at row and column of the image
func (*RGBA64ImageHandler) GetDimensions ¶
func (handler *RGBA64ImageHandler) GetDimensions() image.Rectangle
GetDimensions returns the dimensions as a Rectangle for the image
func (*RGBA64ImageHandler) Mode ¶
func (handler *RGBA64ImageHandler) Mode() ImageType
Mode returns the ImageType of the images
func (*RGBA64ImageHandler) SaveImage ¶
func (handler *RGBA64ImageHandler) SaveImage(filePath string) error
SaveImage saves the image to the filepath specified
type RGBAImageHandler ¶
RGBAImageHandler struct to handle RGBA Image
func (*RGBAImageHandler) At ¶
func (handler *RGBAImageHandler) At(row, column int) (Pixel, error)
At returns the Pixel at row and column of the image
func (*RGBAImageHandler) GetDimensions ¶
func (handler *RGBAImageHandler) GetDimensions() image.Rectangle
GetDimensions returns the dimensions as a Rectangle for the image
func (*RGBAImageHandler) Mode ¶
func (handler *RGBAImageHandler) Mode() ImageType
Mode returns the ImageType of the images
func (*RGBAImageHandler) SaveImage ¶
func (handler *RGBAImageHandler) SaveImage(filePath string) error
SaveImage saves the image to the filepath specified