INT nRet;
char * pcSource;
INT nIDSource;
INT nX,nY,nBits,nPitch;
// Create raw Bayer test image
is_AllocImageMem (hCam, 256, 256, 8, &pcSource, &nIDSource);
is_InquireImageMem (hCam, pcSource, nIDSource, &nX ,&nY, &nBits,
&nPitch);
for (int j = 0; j<nY; j++)
{
for (int i = 0; i<nX; i++)
{
pcSource[i + j * nPitch] = i;
}
}
// Define conversion parameters (example)
INT Gamma = 120;
double rgbGains[3];
rgbGains[0] = 1.0 ; // Red channel gain
rgbGains[1] = 3.0 ; // Green channel gain
rgbGains[2] = 1.0 ; // Blue channel gain
char* pcDest; // Pointer to the newly allocated image memory
INT nIDDest; // ID of the newly allocated image memory
// Set conversion parameters
nRet = is_SetConvertParam(hCam, TRUE, IS_SET_BAYER_CV_BETTER,
IS_SET_CM_RGB24, Gamma, rgbGains);
// Convert image
if (nRet == IS_SUCCESS)
{
pcDest = NULL;
is_ConvertImage(hCam, pcSource, nIDSource, &pcDest, &nIDDest, 0);
}
// Release allocated image memory
is_FreeImageMem (hCam, pcSource, nIDSource);
is_FreeImageMem (hCam, pcDest, nIDDest);