codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#include<stdio.h> #include"bmp.h" int main(void) { unsigned char input_image[256][256]; unsigned char output_image[256][256]={0}; char filename[255]; int mask[3][3]={{-1,-1,-1},{-1,8,-1},{-1,-1,-1}}; int i,j; int x,y; long temp=0; printf("filename:"); scanf("%s",filename); LoadBMP(filename,input_image[0],256,256); for (y = 1; y < 255; y++) { for (x = 1; x < 255; x++) { temp = 0; for (i = 0; i < 3; i++) { for (j = 0; j < 3; j++) { temp += input_image[y + i - 1][x + j - 1] * mask[i][j]; } } if (temp > 255) temp = 255; else if (temp < 0) temp = 0; output_image[y][x] = (unsigned char)temp; } } SaveBMP("result.bmp",output_image[0],256,256); return 0; }
Private
[
?
]
Run code
Submit