Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float convolve(mat3x3 kernel, mat3x3 sample){
- float accumulator = 0, sum = 0;
- for(int r = -1; r < 2; r++){
- for(int c = -1; c < 2; c++){
- sum += kernel[r + 1][c + 1];
- accumulator += kernel[r + 1][c + 1] * sample[-r + 1][-c + 1];
- }
- }
- return accumulator;// / sum;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement