ImageGear for C and C++ on Windows v20.0 - Updated
IG_IP_DCRaw_camera_to_sRGB_matrix_calculate
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Image Processing Functions > IG_IP_DCRaw_camera_to_sRGB_matrix_calculate

Calculates matrix for conversion from camera color space to linear sRGB colorspace, based on two known color matrices corresponding to different light conditions, and a white point.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_IP_DCRaw_camera_to_sRGB_matrix_calculate(
        AT_INT SrcChannelCount,
        HIGDoubleMatrix XYZToCam1,      
        enumIGIlluminant Illuminant1,   
        HIGDoubleMatrix XYZToCam2,  
        enumIGIlluminant Illuminant2,   
        AT_DPOINT WhiteXY,
        HIGDoubleMatrix* lpCamToRGB
);

Arguments:

Name Type Description
SrcChannelCount AT_INT Number of channels in the camera color space.
XYZToCam1 HIGDoubleMatrix XYZ to camera matrix under Illuminant 1.
Illuminant1 enumIGIlluminant Illuminant 1.
XYZToCam HIGDoubleMatrix XYZ to camera matrix under Illuminant 2.
Illuminant2 enumIGIlluminant Illuminant 2.
WhiteXY AT_DPOINT XY coordinates of camera white point.
lpCamToRGB HIGDoubleMatrix* Returns conversion matrix.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

This function does not process image pixels.

Remarks:

By "linear sRGB colorspace" we assume a linear (Gamma = 1.0) RGBcolor space that uses sRGB primaries and reference white. This color space can be converted to sRGB by applying sRGB gamma correction function.

If only one color matrix is known, pass null to XYZToCam2.

Dimensions of XYZToCam1 and XYZToCam2 must be equal to (n, 3), where n is channel count of native camera color space (3 or 4). Result matrix dimensions are (3, n).

SrcChannelCount is the image channel count before conversion. The rest of the info comes from metadata, or from the end user.

Parameter Name DCRaw Metadata Tag DNG Metadata Tag
HIGDoubleMatrix XYZToCam1 ColorMatrix1 IGMDTAG_ID_DCRAW_COLORMATRIX1 IGMDTAG_ID_TIF_COLOR_MATRIX1
enumIGIlluminant Illuminant1 CalibrationIlluminant1 IGMDTAG_ID_DCRAW_CALIBRATIONILLUMINANT1 IGMDTAG_ID_TIF_CALIBRATION_ILLUMINANT1
HIGDoubleMatrix XYZToCam2 ColorMatrix2 IGMDTAG_ID_DCRAW_COLORMATRIX2 IGMDTAG_ID_TIF_COLOR_MATRIX2
enumIGIlluminant Illuminant2 CalibrationIlluminant2 IGMDTAG_ID_DCRAW_CALIBRATIONILLUMINANT2 IGMDTAG_ID_TIF_CALIBRATION_ILLUMINANT2
AT_DPOINT WhiteXY AsShotWhiteXY AsShotNeutral N/A IGMDTAG_ID_DCRAW_ASSHOTNEUTRAL IGMDTAG_ID_TIF_AS_SHOT_WHITEXY IGMDTAG_ID_TIF_AS_SHOT_NEUTRAL

The WhiteXY parameter can be calculated from AsShotNeutral by using IG_IP_DCRaw_white_point_calculate. Its parameters are the same as those of IG_IP_DCRaw_camera_to_sRGB_matrix_calculate, except that it takes a lpNeutralColor parameter (AsShotNeutral) and returns WhiteXY.

It can also be calculated from a user-specified color temperature by using IG_color_temperature_convert_to_XY. There are well known color temperature presets for different shooting conditions, such as Daylight, Cloudy, Tungsten, etc.

See also IG_IP_DCRaw_RGB_gamma_LUT_build.
Is this page helpful?
Yes No
Thanks for your feedback.