SHARE
TWEET

Untitled

a guest Oct 17th, 2019 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. static void BypassImage(rgbType* frameInput, rgbType* frameOutput)
  2. {
  3.     s32 x,y,u,v;
  4.  
  5.     for (x = 1; x < 480; x++)   {
  6.         for(y = 1; y < 640; y++) {
  7.  
  8.             int sumRed = 0;
  9.             int sumGreen = 0;
  10.             int sumBlue = 0;
  11.  
  12.             for(u = -1; u < 2; u++) {
  13.                 for(v = -1; v < 2; v++) {
  14.                     sumRed += (frameInput[(x+u)*640+y+v].red * filterEdge[u+1][v+1]);
  15.                     sumGreen += (frameInput[(x+u)*640+y+v].green * filterEdge[u+1][v+1]);
  16.                     sumBlue += (frameInput[(x+u)*640+y+v].blue * filterEdge[u+1][v+1]);
  17.                 }
  18.             }
  19.  
  20.             frameOutput[x*640+y].red = saturation(sumRed);
  21.             frameOutput[x*640+y].green = saturation(sumGreen);
  22.             frameOutput[x*640+y].blue = saturation(sumBlue);
  23.  
  24.         }
  25.     }
  26. }
  27.  
  28. int saturation(int pixelValue) {
  29.     int result;
  30.         if(pixelValue > 255) {
  31.             result = 255;
  32.         } else if(pixelValue < 0) {
  33.             result = 0;
  34.         } else {
  35.             result = pixelValue;
  36.         }
  37.  
  38.         return result;
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top