imutil

package
v0.0.0-...-a797467 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package imutil is an internal package which contains various utilities for loading, storing, and generating image files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dump

func Dump(path string, img image.Image) error

Dump dumps an image to a file.

func FromMat

func FromMat(m *mat.Dense) *image.Gray

FromMat converts a float [0, 1] matrix to a grayscale image.

func FromMatNorm

func FromMatNorm(m *mat.Dense) *image.Gray

FromMatNorm normalizes a float matrix linearly to [0, 1] and then calls FromMat() on the result.

func Load

func Load(path string) (image.Image, error)

Load loads an image from a file path.

func Rand

func Rand(seed int64, w, h int) *image.Gray

Rand generates a random grayscale image.

func Sub

func Sub(img image.Image, r image.Rectangle) (image.Image, error)

Sub selects a subregion from an image and returns a new image. Shares memory.

func ToGray

func ToGray(img image.Image) *image.Gray

ToGray converts an image to a grayscale image.

func ToMat

func ToMat(img *image.Gray) *mat.Dense

ToMat converts a grayscale image to a float matrix with values in [0, 1].

Types

This section is empty.

Jump to

Keyboard shortcuts

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