C++ image processing and machine learning library with using of SIMD: SSE, AVX, AVX-512, AMX for x86/x64, VMX(Altivec) and VSX(Power7) for PowerPC, NEON for ARM.
i use your RAW to RGB32 the speed is very fast.Thank you for your great and selfless work. But in some cases the effect is not good, I have the following C language image quality is good. I hope it will be useful for you.
this is better
/*
BayerConversion
function: fairly basic interpolation scheme creating RGB values from surrounding R,G,B in bayer
image.bordercases are handled by coloring them black
in: pointer to 8bpp Bayer buffer
out: pointer to 32bpp RGB buffer
special: using the following 3x3 kernel interpolation:
i use your RAW to RGB32 the speed is very fast.Thank you for your great and selfless work. But in some cases the effect is not good, I have the following C language image quality is good. I hope it will be useful for you.
this is better /*
/ / G R B G */
define B_OFFSET 0
define G_OFFSET 1
define R_OFFSET 2
define ODD(i) ((i)&1)
define EVEN(i) (!((i)&1))
typedef enum { Pattern_Recognition_Filter, Laroche_Prescott_Filter, Fast_Linear_Filter, Anisotropic_Filter }Bayer_Filter;
void BayerConversionGRBG(unsigned char pIn, unsigned char pOut, int nRealWidth, int nRealHeight, Bayer_Filter BayerFilter) { int yWidth = 0, ym1Width = 0, yp1Width; int x, y; int pix; /*
border cases (fill it in with black) / /G R G R G R B G B G B G G R G R G R B G B G B G*/
for (y = 0; y<nRealHeight; y++) { x = 0; pOut[((x + ynRealWidth) << 2) + B_OFFSET] = 0; pOut[((x + ynRealWidth) << 2) + G_OFFSET] = 0; pOut[((x + ynRealWidth) << 2) + R_OFFSET] = 0; x = nRealWidth - 1; pOut[((x + ynRealWidth) << 2) + B_OFFSET] = 0; pOut[((x + ynRealWidth) << 2) + G_OFFSET] = 0; pOut[((x + ynRealWidth) << 2) + R_OFFSET] = 0; }
for (x = 0; x<nRealWidth; x++) { y = 0; pOut[((x + ynRealWidth) << 2) + B_OFFSET] = 0; pOut[((x + ynRealWidth) << 2) + G_OFFSET] = 0; pOut[((x + ynRealWidth) << 2) + R_OFFSET] = 0; y = nRealHeight - 1; pOut[((x + ynRealWidth) << 2) + B_OFFSET] = 0; pOut[((x + ynRealWidth) << 2) + G_OFFSET] = 0; pOut[((x + ynRealWidth) << 2) + R_OFFSET] = 0; }
if (BayerFilter == Anisotropic_Filter) { for (y = 1; y<nRealHeight - 1; y++) { yWidth += nRealWidth; ym1Width = yWidth - nRealWidth; yp1Width = yWidth + nRealWidth;
} }