Documentation ¶
Index ¶
- Constants
- func EqualInt32Slice(a, b []int32) bool
- func HSLuvToLinearRGB(h, s, l float32) (r, g, b float32)
- type Header
- type Image
- func NewImage() *Image
- func NewImageBinNxN(src *Image, n int32) *Image
- func NewImageFromFile(fileName string, id int, logWriter io.Writer) (i *Image, err error)
- func NewImageFromImage(img *Image) *Image
- func NewImageFromNaxisn(naxisn []int32, data []float32) *Image
- func NewImageFromStars(src *Image, hfrMultiple float32) *Image
- func NewImageMasterDataFromFile(fileName string, id int, logWriter io.Writer) (i *Image, err error)
- func NewRGBFromChannels(chans []*Image, ref *Image, logWriter io.Writer) *Image
- func (f *Image) AdjustChroma(gamma, threshold float32)
- func (f *Image) AdjustChromaForHues(from, to, factor float32)
- func (f *Image) ApplyGamma(g float32)
- func (f *Image) ApplyGammaToChannel(chanID int, g float32)
- func (hsl *Image) ApplyLuminanceToCIExyY(lum *Image)
- func (f *Image) ApplyMidtones(mid, black float32)
- func (f *Image) ApplyMidtonesToChannel(chanID int, mid, black float32)
- func (f *Image) ApplyPartialGamma(from, to, g float32)
- func (f *Image) ApplyPartialGammaToChannel(chanID int, from, to, g float32)
- func (f *Image) ApplyPixelFunction(pf PixelFunction, args interface{})
- func (f *Image) ApplyPixelFunction1Chan(chanID int, pf PixelFunction, args interface{})
- func (f *Image) ApplyPixelFunction3Chan(pf PixelFunction3Chan, args interface{})
- func (f *Image) ApplyScaleOffset(scale, offset float32)
- func (f *Image) ApplyScaleOffsetToChannel(chanID int, scale, offset float32)
- func (f *Image) CIEHSLToRGB()
- func (f *Image) DimensionsToString() string
- func (f *Image) FillCircle(xc, yc, r, color float32)
- func (f *Image) HSLuvToRGB()
- func (f *Image) MatchHistogram(refStats *stats.Stats)
- func (f *Image) MatchLocation(refLocation float32)
- func (f *Image) MonoToHSLLum()
- func (f *Image) MonoToHSLuvLum()
- func (f *Image) NeutralizeBackground(low, high float32)
- func (f *Image) Normalize()
- func (f *Image) OffsetRGB(r, g, b float32)
- func (fits *Image) PopHeaderInt32(key string) (res int32, err error)
- func (fits *Image) PopHeaderInt32OrFloat(key string) (res float32, err error)
- func (img *Image) Project(destNaxisn []int32, trans star.Transform2D, outOfBounds float32) (res *Image, err error)
- func (f *Image) RGBToCIEHSL()
- func (f *Image) RGBToHCL()
- func (f *Image) RGBToHSLuv()
- func (fits *Image) Read(f io.Reader, readData bool, logWriter io.Writer) (err error)
- func (fits *Image) ReadFile(fileName string, readData bool, logWriter io.Writer) error
- func (f *Image) RotateColors(from, to, offset, lthres float32)
- func (f *Image) SCNR(factor float32)
- func (f *Image) ScaleOffsetClampRGB(alphaR, betaR, alphaG, betaG, alphaB, betaB float32)
- func (f *Image) ScaleRGB(r, g, b float32)
- func (f *Image) SetBlackWhite(blackPerc, whitePerc float32, logWriter io.Writer)
- func (f *Image) SetBlackWhitePoints(block int32, border, skipBright, skipDim float32, shadows, highlights RGB, ...) error
- func (f *Image) ShiftBlackToMove(before, after float32)
- func (f *Image) ShiftBlackToMoveChannel(chanID int, before, after float32)
- func (f *Image) ToXyy()
- func (fits *Image) Write(f io.Writer) error
- func (fits *Image) WriteFile(fileName string) error
- func (f *Image) WriteJPG(writer io.Writer, quality int) error
- func (f *Image) WriteJPGToFile(fileName string, quality int) error
- func (f *Image) WriteMonoJPG(writer io.Writer, quality int) error
- func (f *Image) WriteMonoJPGToFile(fileName string, quality int) error
- func (f *Image) XyyToRGB()
- type LinearsRGB
- type OkHcl
- type OkLab
- type PixelFunction
- type PixelFunction3Chan
- type RGB
Constants ¶
const HeaderLineSize int = 80 // Line size of a FITS header
Variables ¶
This section is empty.
Functions ¶
func EqualInt32Slice ¶
Equal tells whether a and b contain the same elements. A nil argument is equivalent to an empty slice.
func HSLuvToLinearRGB ¶
convert HSLuv to linear RGB; faster; with color-preserving clamping
Types ¶
type Header ¶
type Header struct { Bools map[string]bool Ints map[string]int32 Floats map[string]float32 Strings map[string]string Dates map[string]string Comments []string History []string End bool Length int32 }
FITS header data
type Image ¶
type Image struct { ID int // Sequential ID number, for log output. Counted upwards from 0 for light frames. By convention, dark is -1 and flat is -2 FileName string // Original file name, if any, for log output. Header Header // The header with all keys, values, comments, history entries etc. Bitpix int32 // Bits per pixel value from the header. Positive values are integral, negative floating. Bzero float32 // Zero offset. True pixel value is Bzero + Bscale * Data[i]. Bscale float32 // Value scaler. True pixel value is Bzero + Bscale * Data[i]. // Helps implement unsigned values with signed data types. Naxisn []int32 // Axis dimensions. Most quickly varying dimension first (i.e. X,Y) Pixels int32 // Number of pixels in the image. Product of Naxisn[] Data []float32 // The image data Exposure float32 // Image exposure in seconds Stats *stats.Stats // Basic image statistics: min, mean, max MedianDiffStats *stats.Stats // Local median difference stats, for bad pixel detection, star detection Stars []star.Star // Star detections HFR float32 // Half-flux radius of the star detections Trans star.Transform2D // Transformation to reference frame Residual float32 // Residual error from the above transformation }
A FITS image. Spec here: https://fits.gsfc.nasa.gov/standard40/fits_standard40aa-le.pdf Primer here: https://fits.gsfc.nasa.gov/fits_primer.html
func NewImageBinNxN ¶
Apply NxN binning to source image and return new resulting image
func NewImageFromFile ¶
func NewImageFromImage ¶
Creates a FITS image from given image. New data array will be allocated
func NewImageFromNaxisn ¶
Creates a FITS image from given naxisn. Data is not copied, allocated if nil. naxisn is deep copied
func NewImageFromStars ¶
Show stars detected on the source image as circles in a new resulting image
func NewRGBFromChannels ¶
Combine single color images into one multi-channel image. All images must have the same dimensions, or undefined results occur.
func (*Image) AdjustChroma ¶
Apply given gamma correction to color saturation (CIE HCL chroma), for luminances above the given threshold. Data must be normalized to [0,1]. Operates in-place.
func (*Image) AdjustChromaForHues ¶
Selectively adjusts CIE HCL chroma for hues in given range by multiplying with given factor. Data must be HCL. Useful for desaturating purple stars
func (*Image) ApplyGamma ¶
Apply gamma correction to image. Image must be normalized to [0,1] before. Operates in-place.
func (*Image) ApplyGammaToChannel ¶
Apply gamma correction to image. Image must be normalized to [0,1] before. Operates in-place.
func (*Image) ApplyLuminanceToCIExyY ¶
Applies luminance to existing 3-channel image with luminance in 3rd channel, all channels in [0,1]. All images must have the same dimensions, or undefined results occur.
func (*Image) ApplyMidtones ¶
Apply midtones correction to given image. Data must be normalized to [0,1]. Operates in-place.
func (*Image) ApplyMidtonesToChannel ¶
Apply midtones correction to given channel of given image. Data must be normalized to [0,1]. Operates in-place.
func (*Image) ApplyPartialGamma ¶
Apply gamma correction to image in given range. Image must be normalized to [0,1] before. Operates in-place.
func (*Image) ApplyPartialGammaToChannel ¶
Apply gamma correction to given channel of the image. Image must be normalized to [0,1] before. Operates in-place.
func (*Image) ApplyPixelFunction ¶
func (f *Image) ApplyPixelFunction(pf PixelFunction, args interface{})
Apply given pixel function to the image. Uses thead parallelism across all available CPUs. Operates in-place.
func (*Image) ApplyPixelFunction1Chan ¶
func (f *Image) ApplyPixelFunction1Chan(chanID int, pf PixelFunction, args interface{})
Apply given pixel function to given channel of the image. Uses thead parallelism across all available CPUs. Operates in-place.
func (*Image) ApplyPixelFunction3Chan ¶
func (f *Image) ApplyPixelFunction3Chan(pf PixelFunction3Chan, args interface{})
Apply given pixel function to all channels of the image. Uses thead parallelism across all available CPUs. Data must be normalized to [0,1]. Operates in-place.
func (*Image) ApplyScaleOffset ¶
Applies given scale factor and offset to image. Operates in-place.
func (*Image) ApplyScaleOffsetToChannel ¶
Applies given scale factor and offset to image. Operates in-place.
func (*Image) CIEHSLToRGB ¶
func (f *Image) CIEHSLToRGB()
Convert CIE HSL to RGB pixels. Operates in-place. https://en.wikipedia.org/wiki/Colorfulness#Saturation
func (*Image) DimensionsToString ¶
func (*Image) FillCircle ¶
Fill a circle of given radius on the FITS image
func (*Image) HSLuvToRGB ¶
func (f *Image) HSLuvToRGB()
Convert HSLuv to RGB pixels. Operates in-place. https://www.hsluv.org/
func (*Image) MatchHistogram ¶
Adjust image data to match the histogram shape of refStats. Assumes f.Stats are current; and updates them afterwards.
func (*Image) MatchLocation ¶
Adjust image data to match the histogram peak of refStats. Assumes f.Stats are current; and updates them afterwards.
func (*Image) MonoToHSLLum ¶
func (f *Image) MonoToHSLLum()
Converts a monochromic image to HSL Luminance. Data must be normalized to [0,1]. Operates in-place.
func (*Image) MonoToHSLuvLum ¶
func (f *Image) MonoToHSLuvLum()
Converts a monochromic image to HSLuv Luminance. Data must be normalized to [0,1]. Operates in-place.
func (*Image) NeutralizeBackground ¶
Adjust CIE HCL chroma by multiplying with 0 for values below low, with 1 above high, and interpolating linearly in between. Data must be HCL. Operates in-place.
func (*Image) Normalize ¶
func (f *Image) Normalize()
Normalize image to [0..1] based on basic stats. Operates in-place.
func (*Image) OffsetRGB ¶
Offsets each color channel by a factor, clamping to Operates in-place on image data normalized to [0,1].
func (*Image) PopHeaderInt32OrFloat ¶
func (*Image) Project ¶
func (img *Image) Project(destNaxisn []int32, trans star.Transform2D, outOfBounds float32) (res *Image, err error)
Projects an image into a new coordinate system with the given transformation. Fills in missing pixels with the given out of bounds value. Uses bilinear interpolation for now.
func (*Image) RGBToCIEHSL ¶
func (f *Image) RGBToCIEHSL()
Convert RGB to CIE HSL pixels. Operates in-place. https://en.wikipedia.org/wiki/Colorfulness#Saturation
func (*Image) RGBToHCL ¶
func (f *Image) RGBToHCL()
Convert RGB to CIE HCL pixels. Operates in-place.
func (*Image) RGBToHSLuv ¶
func (f *Image) RGBToHSLuv()
Convert RGB to HSLuv pixels. Operates in-place. https://www.hsluv.org/
func (*Image) ReadFile ¶
Read FITS data from the file with the given name. Decompresses gzip if .gz or gzip suffix is present. Reads metadata only (fast) if readData is false.
func (*Image) RotateColors ¶
Selectively rotate hues in a given range. Data must be HSLuv. Useful to create Hubble palette images from narrowband data, by turning greens to yellows, before applying SCNR
func (*Image) SCNR ¶
Apply subtractive chroma noise reduction to the green channel. Data must be normalized to [0,1]. Uses average neutral masking method with luminance protection. Typically used to reduce green cast in narrowband immages when creating Hubble palette images
func (*Image) ScaleOffsetClampRGB ¶
Linearly transforms each color channel with multiplier alpha and offset beta, then clamps result to [0,1]
func (*Image) ScaleRGB ¶
Scales each color channel by a factor, clamping to Operates in-place on image data normalized to [0,1].
func (*Image) SetBlackWhite ¶
Sets black point and white point of the image to clip the given percentage of pixels.
func (*Image) SetBlackWhitePoints ¶
func (f *Image) SetBlackWhitePoints(block int32, border, skipBright, skipDim float32, shadows, highlights RGB, logWriter io.Writer) error
Set image black point iteratively. First match histogram scale and location among the channels. Then find the darkest block, and set it to the desired color; and find the average star color, and set it to the desired color
func (*Image) ShiftBlackToMove ¶
Shift black point so a defined before value becomes the given after value. Operates in-place on image data normalized to [0,1].
func (*Image) ShiftBlackToMoveChannel ¶
Shift black point so a defined before value becomes the given after value. Operates in-place on image data normalized to [0,1].
func (*Image) WriteFile ¶
Writes an in-memory FITS image to a file with given filename. Creates/overwrites the file if necessary. Compresses with gzip if .gz or gzip suffix is present.
func (*Image) WriteJPGToFile ¶
Write a FITS image to JPG. Image must be normalized to [0,1]
func (*Image) WriteMonoJPG ¶
Write a grayscale FITS image to JPG. Image must be normalized to [0,1]
func (*Image) WriteMonoJPGToFile ¶
Write a grayscale FITS image to JPG. Image must be normalized to [0,1]
type LinearsRGB ¶
func (LinearsRGB) ToOkHcl ¶
func (c LinearsRGB) ToOkHcl() OkHcl
func (LinearsRGB) ToOkLab ¶
func (c LinearsRGB) ToOkLab() OkLab
type OkHcl ¶
func (OkHcl) ToLinearsRGB ¶
func (c OkHcl) ToLinearsRGB() LinearsRGB
type OkLab ¶
func (OkLab) ToLinearsRGB ¶
func (c OkLab) ToLinearsRGB() LinearsRGB
type PixelFunction ¶
type PixelFunction func(data []float32, params interface{})
A pixel function. Operates in-place. For parallelization across CPUs.
type PixelFunction3Chan ¶
type PixelFunction3Chan func(c0, c1, c2 []float32, params interface{})
A three-channel pixel function. Data must be normalized to [0,1]. Operates in-place. For parallelization across CPUs.