pixbuilder

package module
v0.0.0-...-ec08d02 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2020 License: MIT Imports: 8 Imported by: 0

README

pixbuilder

PkgGoDev

Pixel by pixel image construction

Autostereogram

AutoStereoGram(ASG) are images that can be viewed as stereo image without resorting to any external device, see Wikipedia

ASG are computed using both a Pattern and a Depth-Map as input. Utilities are provided to generate these from standard png images.

See documentation and examples for more details.

To do

Provide easily adjustable ways to maximize depth of stereo effect and adjust to screen/eye distance ?

Other image generation ideas : images using subimages as pixels ?

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadFrom

func LoadFrom(name string) image.Image

LoadFrom image from file name. File name extension is expected.

func LoadGrayFrom

func LoadGrayFrom(name string) *image.Gray

LoadGrayFrom loads ANY image, and convert it to a Gray image. File name extension is expected.

func NewASG

func NewASG(pat *Pattern, dmap *image.Gray) image.Image

NewASG constructs a new AutoStereoGram from the provided pattern and the provided depth map. The size of the resulting image is the size of the depth map image.

Example
// Create a random pattern
pat := NewPatternRandom2(200, 100)
// Load a depth map from an existing png
dmap := LoadGrayFrom("Symbol.png")
// comput ethe result image
asg := NewASG(pat, dmap)
// save result as png file
SaveAs(asg, "example")
Output:

func SaveAs

func SaveAs(im image.Image, name string)

SaveAs image to file. Do not provide extension, a ".png" is added.

Types

type Pattern

type Pattern struct {
	image.Image // The image that is repeated
	// contains filtered or unexported fields
}

Pattern provide a color for each point, and repeats itself horizontally and vertically. A Pattern is also an image.Image.

func NewPatternImage

func NewPatternImage(im image.Image) *Pattern

NewPatternImage generate a Pattern from the provided image.

func NewPatternRandom1

func NewPatternRandom1(x, y int) *Pattern

NewPatternRandom1 generates a random Pattern of given period.

func NewPatternRandom2

func NewPatternRandom2(x, y int) *Pattern

NewPatternRandom2 generate another random pattern of given period.

func (*Pattern) At

func (p *Pattern) At(x, y int) color.Color

At provides color pixel for any coordinates, extending underlying At, and using provided period.

Jump to

Keyboard shortcuts

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