Sample image is as follows
The implementation step is removed from the source image (left figure) from the source image (left picture) by operation: 1. The image 2 is smoothly processed. Methods: 25 pixels around 25 pixels are given to SP2; 2. Get maximum of each component of each component in SP2 to max R, Maxg, MaxB; 3. Each pixel of Figure 1 (P1): P1.R = P1.R / SP2.R * maxR p1.g = p1.g / sp2.g * maxg p1.b = p1.b / sp2.b * maxb
Code segment:
Class classlenscomp {private: dataprocess * DPRGB; // = new data (); dataprocess * dpsmsk;
Pixel Smooth (Pixel *, size_t, size_t); public: // pixel getv1 (int, int); classlenscomp (dataprocess *, dataprocess *); void lenscomp (dataprocess *);}; / where DataProcess is the array of Pixel structures Struct Pixel {Double R; Double G; Double B;} / classlenscomp :: classlenscomp (dataprocess * rgb_in, dataprocess * SMSK_IN) {DPRGB = RGB_IN; DPSMSK = SMSK_IN;
}
void ClassLensComp :: LensComp (DataProcess * OutPut) {size_t i, j; pixel * RGBBuf = dpRGB-> get_rgbdata (); pixel * sMSKBuf = dpsMSK-> get_rgbdata (); pixel * OutPutBuf = OutPut-> get_rgbdata (); size_t W = DPRGB-> GET_RGB_WIDTH (); // The SMSK Width Is The Same as The GRB's Size_T H = DPRGB-> Get_RGB_HEight (); // The SMSK Height Is The Same As The Grb's Pixel Maxsmsk (0,0,0) ; // Save the max r, g, b pixel * smskbuffer = new pixel [h * w];
// for (k = 0; k <3; k ) {// smoothed smsk; for (i = 0; i Pixel classlenscomp :: smooth (Pixel * RGBBUF, SIZE_T X, SIZE_T Y) {size_t i, j; size_t w = DPRGB-> GET_RGB_WIDTH (); // The SMSK Width Is The Same as The Grb's Pixel SUM = (0,0 , 0); for (i = x-2; i <= x 2; i ) for (j = y-2; j <= y 2; j ) {Sum.R = sum.r rgbbuf [i * W j] .r; sum.g = sum.g RGBBUF [i * w j] .g; sum.b = sum.b rgbbbbuf [i * w j] .b;} Sum.R = SUM.R / 25; Sum.g = sum.g / 25; sum.b = sum.b / 25; return sum;} /// results picture The result picture is a bit too bright, and then correct it.