eLynx SDK
v3.3.0 C++ image processing API reference |
cout << ".Create Perling noise: perlin.png "; const EResolution resolution = RT_UINT8; const uint32 w = 256; const uint32 h = 256; const int seed = 128; const uint32 period = 51031; const double scale = 1.42; ImageVariant image; bool bSuccess = elxMakePerlin(image, resolution, w,h, seed, period, scale); if (bSuccess) bSuccess = image.Save("output/perlin.png"); cout << (bSuccess? "successfull" : "failed") << endl;
Output:
![]() perlin.png |
cout << ".Create grey gradient: gradient.png "; const EResolution resolution = RT_UINT8; const uint32 w = 500; const uint32 h = 31; ImageVariant image; bool bSuccess = elxMakeGradient(image, resolution, w,h); if (bSuccess) bSuccess = image.Save("output/gradient.png"); cout << (bSuccess? "successfull" : "failed") << endl;
Output:
![]() gradient.png |
cout << ".Create color checker: checker.png "; ImageVariant r,g,b; const EResolution resolution = RT_UINT8; const uint32 w = 256; const uint32 h = 256; bool bSuccess; bSuccess = elxMakeChecker(r, resolution, w,h, 5); bSuccess = elxMakeChecker(g, resolution, w,h, 6); bSuccess = elxMakeChecker(b, resolution, w,h, 7); ImageVariant image = ImageVariant(r,g,b); bSuccess = image.Save("output/checker.png"); cout << (bSuccess? "successfull" : "failed") << endl;
Output:
![]() checker.png |
ImageVariant H,L,S; const EResolution resolution = RT_Float; const uint32 w = 256; const uint32 h = 256; bool bSuccess; cout << ".create hue plane as a liquid" << endl; bSuccess = elxMakeLiquid(H, resolution, w,h); H.Add(-0.12); H.Mul(2.1); cout << ".create luminance as a Butterworth" << endl; double cutoff = 0.8; bSuccess = elxMakeButterworth(L, resolution, w,h, cutoff); L.Mul(0.8); cout << ".create saturation as a gradient" << endl; bSuccess = elxMakeGradient(S, resolution, w,h); ImageVariant image = ImageVariant(H,L,S, CS_HLS); image.ChangePixelFormat(PF_RGBub); cout << ".Merge h,l,s creating hls-fusion.png "; bSuccess = image.Save("output/hls-fusion.png"); cout << (bSuccess? "successfull" : "failed") << endl;
Output:
![]() hls-fusion.png |
cout << ".Create an image with pixels access: myImage.png" << endl; cout << ".build image in RGB float format" << endl; const uint32 w = 256; const uint32 h = 256; ImageVariant image(PF_RGBf, w,h); cout << ".get pointer on specialized pixels" << endl; ImageRGBf& specialized = (ImageRGBf&)(*image.GetImpl().get()); PixelRGBf * prSrc = specialized.GetPixel(); cout << ".compute value for each pixels" << endl; const float dx = 1.0/w; const float dy = 1.0/h; float y = 0.0; for (int j=0; j<h; j++, y+=dy) { float x = 0.0; for (int i=0; i<w; i++, x+=dx) { prSrc->_red = 0.5f * (1.0f-x + y); prSrc->_green = 0.5f * (x + y); prSrc->_blue = 0.5f * (x + 1.0f-y); prSrc++; } } cout << ".change resolution to UINT8 before saving" << endl; bool bSuccess = image.ChangeResolution(RT_UINT8); if (bSuccess) bSuccess = image.Save("output/myImage.png"); cout << ".save " << (bSuccess? "successfull" : "failed") << endl;
Output:
.Create an image with pixels access: myImage.png .build image in RGB float format .get pointer on specialized pixels .compute value for each pixels .change resolution to UINT8 before saving .save successfull
![]() myImage.png |