Documentation
¶
Index ¶
- Variables
- func ApplyCameraToPCS(rgb hdrcolor.RGB, cameraToPCS emath.Mat3) hdrcolor.XYZ
- func ApplyCameraWhite(cn CameraNative, cameraWhite emath.Vec3) hdrcolor.RGB
- func HDRRGBFloorAt(c1 hdrcolor.RGB, min float64) hdrcolor.RGB
- func MakeCameraToPCS(asShotNeutral emath.Vec3, forwardMatrix emath.Mat3) emath.Mat3
- func XYZToSRGB(xyz hdrcolor.XYZ) hdrcolor.RGB
- type CameraNative
Constants ¶
This section is empty.
Variables ¶
var ( // Translates XYZ(D50) to sRGB(D65) // // https://sites.google.com/site/crossstereo/raw-converting/dng // http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html // // We use the second table on Bruce Lindblooms's site; it bundles in // the chromatic adaptation transform that we need to move from D50 // to D65 reference whites without seeing the image's white balance // shift. (Most XYZ->sRGB matrices on the web ignore the change to // reference white, so come out looking wrong) XYZD50_to_linear_sRGBD65 = emath.Mat3{ 3.1338561, -1.6168667, -0.4906146, -0.9787684, 1.9161415, 0.0334540, 0.0719453, -0.2289914, 1.4052427, } )
Functions ¶
func ApplyCameraToPCS ¶
ApplyCameraToPCS does all the color correction, mapping a camera native RGB into Process Connection Space (PCS), CIE XYZ(D50).
func ApplyCameraWhite ¶
func ApplyCameraWhite(cn CameraNative, cameraWhite emath.Vec3) hdrcolor.RGB
ApplyCameraWhite performs white balancing. After this operation, the color is no longer CameraNative, it is camera-neutral (i.e. white balanced), so return as arbitrary RGB.
func MakeCameraToPCS ¶
MakeCameraToPCS creates the CameraToPCS matrix, a single transform from camera native space to CIE XYZ (D50). `asShotNeutral` and `forwardMatrix` are Adobe DNG terms.
Types ¶
type CameraNative ¶
type CameraNative struct { // The sensor photosites give values in the range [0, 0xFFFF]; we map those to [0.0, 1.0] hdrcolor.RGB // This field implements color.Color and hdrcolor.Color interfaces // How much Illuminance (in lux) is needed to generate a photosite value of 0xFFFF IllumAtMax float64 }
A CameraNative color is a sensor reading, combined with an exposure value, that has not yet been color corrected or white balanced. It exists in an RGB space specific to the camera.
func AverageBalancedCameraNativeRGBs ¶
func AverageBalancedCameraNativeRGBs(in []CameraNative) CameraNative
AverageBalancedCameraNativeRGBs accounts for the different exposures that each CameraNative may have
func NewCameraNative ¶
func NewCameraNative(col color.Color, illumAtMax float64) CameraNative
Treats the input RGB channels as [0, 0xFFFF]
func (*CameraNative) AdjustIllumAtMax ¶
func (cn *CameraNative) AdjustIllumAtMax(newIllumAtMax float64)
AdjustIllumAtMax rescales the RGB values.
func (CameraNative) String ¶
func (cn CameraNative) String() string
func (CameraNative) ToPCS ¶
func (cn CameraNative) ToPCS(cameraToPCS emath.Mat3) hdrcolor.XYZ
ToPCS uses the matrix to transform the color into PCS (Profile Connection Space), CIEXYZ(D50). You want to use the CameraToPCS matrix generated by the DNG SDK, it includes any needed white balance transforms. You prob want to then convert this XYZ color back down to an sRGB(D65) color with `ecolor.XYZToSRGB()`