mpo

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2018 License: MIT Imports: 8 Imported by: 1

README

MPO Decoder Library

Go Report Card GoDoc

Simple Go JPEG MPO (Multi Picture Object) Decoder

Install/Update Command Line Tool

go get -u github.com/donatj/mpo/cmd/mpo2img

Usage

mpo2img
usage: mpo2img <mpofile>
  -format string
    	Output format [stereo|red-cyan|cyan-red|red-green|green-red] (default "stereo")
  -help
    	Displays this text
  -outfile string
    	Output filename (default "output.jpg")

WIP

Todo:

  • Optimization
  • Add Writer
  • Add more control over stereo/anaglyph

Documentation

Overview

Package mpo implements an MPO image decoder.

MPO is defined in CIPA DC-007: http://www.cipa.jp/std/documents/e/DC-007_E.pdf.

Index

Constants

View Source
const (
	// RedCyan is Red on left eye, cyan on right
	RedCyan colorType = iota

	// CyanRed is Cyan on left eye, red on right
	CyanRed

	// RedGreen is Red on left eye, green on right
	RedGreen

	// GreenRed is Green on left eye, red on right
	GreenRed
)

Variables

View Source
var ErrInconsistentBounds = errors.New("anaglyph images must be the same size")

ErrInconsistentBounds indicates that not all images within the MPO file were found to be the same size, which is a requirement for the anaglyph conversion.

View Source
var ErrInvalidImageCount = errors.New("anaglph conversion only supports 2 image")

ErrInvalidImageCount indicates that incorrect number of images were found during the anaglyph conversion process.

View Source
var ErrNoImages = errors.New("no images found in mpo image")

ErrNoImages indicates that no images were found in the specified file.

Functions

func Decode

func Decode(r io.Reader) (image.Image, error)

Decode reads a MPO image from r and returns it as an image.Image.

func DecodeConfig

func DecodeConfig(r io.Reader) (image.Config, error)

DecodeConfig returns the color model and dimensions of an MPO image without decoding the entire image.

TODO Optimize this - possibly just faling back to jpeg.DecodeConfig

Types

type MPO

type MPO struct {
	Image []image.Image
}

MPO represents the likely multiple images stored in a MPO file.

func DecodeAll

func DecodeAll(rr io.Reader) (*MPO, error)

DecodeAll reads an MPO image from r and returns the sequential frames

func (*MPO) ConvertToAnaglyph

func (m *MPO) ConvertToAnaglyph(ct colorType) (image.Image, error)

ConvertToAnaglyph converts an MPO to the anaglyph format specified by ct colorType constant

func (*MPO) ConvertToStereo

func (m *MPO) ConvertToStereo() image.Image

ConvertToStereo converts an MPO to a StereoScopic image

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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