lib

package
v0.0.0-...-0ec6d47 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2021 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultCachePathname = "./image_cache"
View Source
const DefaultDBPathname = "./mars_perseverance_image_info.db"

NewImageDB creates/accesses a database at this location.

Variables

This section is empty.

Functions

func Demosaic

func Demosaic(bayerImage *image.Gray) (image.Image, error)

Demosaic an RGGB bayer image.

func DemosaicRGBGray

func DemosaicRGBGray(bayerImage image.Image) (image.Image, error)

Demosaic a grayscale image that was stored as RGBA.

func FileExists

func FileExists(pathname string) bool

func GetRequestParams

func GetRequestParams(cameras []string, numPerPage int, page int, minSol int, maxSol int) url.Values

func MatchExposure

func MatchExposure(ref image.Image, target image.Image) image.Image

Get a copy of a ref image whose exposure is matched to that of a target image.

func SavePNG

func SavePNG(image image.Image, filename string) error

func ValidCameras

func ValidCameras() []string

Types

type AdjustmentMap

type AdjustmentMap struct {
	L, A, B chanAdjustmentMap
	// contains filtered or unexported fields
}

func NewAdjustmentMap

func NewAdjustmentMap() *AdjustmentMap

func (*AdjustmentMap) AddSample

func (am *AdjustmentMap) AddSample(srcPix, targetPix lib_color.CIELab)

func (*AdjustmentMap) Complete

func (am *AdjustmentMap) Complete()

type CameraInfo

type CameraInfo struct {
	CameraModelComponentList interface{} `json:"camera_model_component_list"`
	CameraModelType          string      `json:"camera_model_type"`
	CameraPosition           FloatTuple  `json:"camera_position"`
	CameraVector             FloatTuple  `json:"camera_vector"`
	FilterName               string      `json:"filter_name"`
	Instrument               string      `json:"instrument"`
}

type CompositeImageInfo

type CompositeImageInfo struct {
	ImageID string
	Site    int
	Drive   int
	Sclk    float64

	SubframeRect image.Rectangle

	Camera    string
	ColorType string
}

func GetCompositeImageInfoRecords

func GetCompositeImageInfoRecords(idb ImageDB, camera string) ([]CompositeImageInfo, error)

type CompositeImageSet

type CompositeImageSet []CompositeImageInfo

func GetCompositeImageSets

func GetCompositeImageSets(idb ImageDB, camera string) ([]CompositeImageSet, error)

func (CompositeImageSet) Len

func (cid CompositeImageSet) Len() int

Implement sort.Interface to order composite images by their subframe rectangles

func (CompositeImageSet) Less

func (cid CompositeImageSet) Less(i, j int) bool

func (CompositeImageSet) Name

func (imageSet CompositeImageSet) Name() string

func (CompositeImageSet) Swap

func (cid CompositeImageSet) Swap(i, j int)

type Compositor

type Compositor struct {
	Bounds image.Rectangle

	Result *lib_image.CIELab
	// contains filtered or unexported fields
}

Compositor builds a composite image from constituent tile images.

func NewCompositor

func NewCompositor(rect image.Rectangle) Compositor

func (*Compositor) AddImage

func (comp *Compositor) AddImage(image image.Image, subframeRect image.Rectangle)

Add a new image. Adjust its colors as necessary to match any overlapping image data that has already been composited.

func (*Compositor) CompressDynamicRange

func (comp *Compositor) CompressDynamicRange()

type ExtendedInfo

type ExtendedInfo struct {
	// These are all either a float or "UNK"
	MastAzimuth   optFloat `json:"mastAz"`
	MastElevation optFloat `json:"mastEl"`
	Sclk          optFloat `json:"sclk"`
	// "UNK" or a positive real, typically 1.0 or 4.0.
	ScaleFactor optFloat `json:"scaleFactor"`

	XYZ FloatTuple `json:"xyz"`
	// How to convince JSON to parse an array of 4 floats as a struct?
	SubframeRect Rect `json:"subframeRect"`
	Dimension    Size `json:"dimension"`
}

type Float64Interpolator

type Float64Interpolator struct {
	// contains filtered or unexported fields
}

func NewFloat64Interpolator

func NewFloat64Interpolator(yVals map[float64]float64) *Float64Interpolator

func (*Float64Interpolator) Interp

func (interp *Float64Interpolator) Interp(x float64) float64

type FloatTuple

type FloatTuple []float64

func (*FloatTuple) UnmarshalJSON

func (v *FloatTuple) UnmarshalJSON(data []byte) error

type ImageCache

type ImageCache struct {
	// contains filtered or unexported fields
}

func NewImageCache

func NewImageCache(idb ImageDB) (ImageCache, error)

func NewImageCacheAtPath

func NewImageCacheAtPath(idb ImageDB, cacheDir string) (ImageCache, error)

func (*ImageCache) FullSize

func (cache *ImageCache) FullSize(imageID string) (image.Image, error)

func (*ImageCache) FullSizeDir

func (cache *ImageCache) FullSizeDir() string

func (*ImageCache) FullSizePath

func (cache *ImageCache) FullSizePath(imageID string) string

func (*ImageCache) ThumbDir

func (cache *ImageCache) ThumbDir() string

func (*ImageCache) ThumbNail

func (cache *ImageCache) ThumbNail(imageID string) (image.Image, error)

func (*ImageCache) ThumbPath

func (cache *ImageCache) ThumbPath(imageID string) string

type ImageDB

type ImageDB struct {
	DB     *sql.DB
	DBName string
}

func NewImageDB

func NewImageDB() (ImageDB, error)

Create/access an image database at the DefaultDBPathname.

func NewImageDBAtPath

func NewImageDBAtPath(pathname string) (ImageDB, error)

Create/access an image database.

func (*ImageDB) AddOrUpdate

func (idb *ImageDB) AddOrUpdate(records []ImageInfo) error

Add or update Images from provided records.

func (*ImageDB) Cameras

func (idb *ImageDB) Cameras() []string

Get the names of all cameras in the database.

func (*ImageDB) FullSizeURL

func (idb *ImageDB) FullSizeURL(imageID string) (string, error)

Get the full-resolution URL for an image.

func (*ImageDB) ThumbnailURL

func (idb *ImageDB) ThumbnailURL(imageID string) (string, error)

Get the thumbnail URL for an image.

type ImageExposure

type ImageExposure struct {
	BinMinVal float64   // The L value corresponding to the first bin.
	BinScale  float64   // Multiplier maps Lab L range to bucket index range
	Histogram []int     // Histogram of L values.
	CDF       []float64 // Cumulative density function
}

func NewImageExposure

func NewImageExposure(image *lib_image.CIELab) *ImageExposure

type ImageFileUrls

type ImageFileUrls struct {
	Medium  string `json:"medium"`
	Small   string `json:"small"`
	FullRes string `json:"full_res"`
	Large   string `json:"large"`
}

type ImageInfo

type ImageInfo struct {
	ImageID string `json:"imageid"`
	Credit  string `json:"credit"`
	Caption string `json:"caption"`
	Title   string `json:"title"`

	JsonLink string `json:"json_link"`
	WebLink  string `json:"link"`

	Attitude FloatTuple `json:"attitude"`
	Sol      optInt     `json:"sol"`

	// How to parse date strings in Go?
	DateTakenMars string `json:"date_taken_mars"`
	DateTakenUtc  string `json:"date_taken_utc"`
	DateReceived  string `json:"date_received"`

	Drive optInt `json:"drive"`
	Site  optInt `json:"site"`

	SampleType string `json:"sample_type"`

	Camera     CameraInfo    `json:"camera"`
	ImageFiles ImageFileUrls `json:"image_files"`

	Extended ExtendedInfo `json:"extended"`
}

func GetImageMetadata

func GetImageMetadata(params url.Values) ([]ImageInfo, error)

func ParseImageMetadata

func ParseImageMetadata(rawJson []byte) ([]ImageInfo, error)

type LabBounds

type LabBounds struct {
	Min lib_color.CIELab
	Max lib_color.CIELab
}

type Origin

type Origin struct {
	X int
	Y int
}

type Rect

type Rect struct {
	Origin Origin
	Size   Size
}

func (*Rect) UnmarshalJSON

func (rect *Rect) UnmarshalJSON(data []byte) error

type Size

type Size struct {
	Width  int
	Height int
}

func (*Size) UnmarshalJSON

func (size *Size) UnmarshalJSON(data []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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