Advertisement
Guest User

Untitled

a guest
May 4th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.49 KB | None | 0 0
  1. for( i = 1, rows-1) {
  2.     for( j = 1, cols-1) {
  3.       int p1, p2, p3, p4, p5, p6, t;
  4.       p1 = imageIn[( i-1) *303 + j-1];
  5.       p2 = imageIn[( i-1) *303 + j];
  6.       p3 = imageIn[i*303 + j-1];
  7.       p4 = imageIn[i*303 + j+1];
  8.       p5 = imageIn[( i+1) *303 + j];
  9.       p6 = imageIn[( i+1) *303 + j+1];
  10.       t = 128 + p4 + p5 + p6 - p1 - p2 - p3;
  11.       // clip
  12.       if( t < 0) {
  13.         t = 0;
  14.       }
  15.       if( t > 255) {
  16.         t = 255;
  17.       }
  18.       imageOut[i*303 + j] = t;
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement