eLynx SDK
v3.3.0 C++ image processing API reference |
You can convert image to the CIE Lab color space, then split the planes, work with the planes independently (as grey images) and recompose the image merging all planes.
cout << "Split and merge in CIE Lab color space:" << endl; const char * filenameIn = "../../datas/planet.jpg"; cout << ".Loading RGBub image file: " << filenameIn << endl; ImageVariant image(filenameIn); bool bSuccess = image.IsValid(); cout << ".Change image color space and resolution to CIE Lab floating point" << endl; bSuccess = image.ChangePixelFormat(PF_Labf); cout << ".Split planes: L, a and b" << endl; ImageVariant L, a, b; bSuccess = image.Split(L, a, b); cout << ".Blur L plane applying Gaussian filter of 1.5 radius" << endl; bSuccess = L.ApplyGaussian(1.5); cout << ".Sharpen L plane" << endl; bSuccess = L.ApplySharpenMore(); cout << ".Mul a plane by 1.7" << endl; bSuccess = a.Mul(1.7); cout << ".Mul b plane by 0.8" << endl; bSuccess = b.Mul(0.8); cout << ".Recompose Lab image merging L,a and b planes" << endl; image = ImageVariant(L, a, b, CS_CIE_Lab); cout << ".Change image color space and resolution to RGBub before saving" << endl; bSuccess = image.ChangePixelFormat(PF_RGBub); const char * filenameOut = "output/planet-Lab.jpg"; cout << ".Save image as " << filenameOut << " "; bSuccess = image.Save(filenameOut); cout << (bSuccess? "successfull" : "failed") << endl;
Output:
Split and merge in CIE Lab color space: .Loading RGBub image file: ../../datas/planet.jpg .Change image color space and resolution to CIE Lab floating point .Split planes: L, a and b .Blur L plane applying Gaussian filter of 1.5 radius .Sharpen L plane .Mul a plane by 1.7 .Mul b plane by 0.8 .Recompose Lab image merging L,a and b planes .Change image color space and resolution to RGBub before saving .Save image as output/planet-Lab.jpg successfull
![]() planet.jpg | ![]() planet-Lab.jpg |
You can also convert image to the CIE Lab color space, and directly process the planes independently.
cout << "Working in CIE Lab color space:" << endl; const char * filenameIn = "../../datas/planet.jpg"; cout << ".Loading RGBub image file: " << filenameIn << endl; ImageVariant image(filenameIn); bool bSuccess = image.IsValid(); cout << ".Change image color space and resolution to CIE Lab floating point" << endl; bSuccess = image.ChangePixelFormat(PF_Labf); cout << ".Blur L plane applying Gaussian filter of 1.5 radius" << endl; bSuccess = image.ApplyGaussian(1.5, 1., BF_Nearest, 1, CM_Channel0); cout << ".Sharpen L plane" << endl; bSuccess = image.ApplySharpenMore(1., 0.0, 1.0, 1.0, BF_Nearest, 1, CM_Channel0); cout << ".Mul a plane by 1.7" << endl; bSuccess = image.Mul(1.7, CM_Channel1); cout << ".Mul b plane by 0.8" << endl; bSuccess = image.Mul(0.8, CM_Channel2); cout << ".Change image color space and resolution to RGBub before saving" << endl; bSuccess = image.ChangePixelFormat(PF_RGBub); const char * filenameOut = "output/plane-Lab.jpg"; cout << ".Save image as " << filenameOut << " "; bSuccess = image.Save(filenameOut); cout << (bSuccess? "successfull" : "failed") << endl;
Output:
Working in CIE Lab color space: .Loading RGBub image file: ../../datas/planet.jpg .Change image color space and resolution to CIE Lab floating point .Blur L plane applying Gaussian filter of 1.5 radius .Sharpen L plane .Mul a plane by 1.7 .Mul b plane by 0.8 .Change image color space and resolution to RGBub before saving .Save image as output/plane-Lab.jpg ok