5 int laplacian(
unsigned char *image1,
unsigned char *image2,
unsigned int x_size,
unsigned int y_size)
11 int weight[3][3] = {{ 1, 1, 1 },
21 for (y = 1; y < y_size - 1; y++) {
22 for (x = 1; x < x_size - 1; x++) {
24 for (j = - 1; j < 2; j++) {
25 for (i = -1; i < 2; i++) {
26 pixel_value += weight[j + 1][i + 1] * (*(image1 + (y + j) + (x + i) *
MAX_IMAGESIZE));
29 if (pixel_value < min) min = pixel_value;
30 if (pixel_value > max) max = pixel_value;
33 if ((
int)(max - min) == 0) {
38 for (y = 0; y < y_size; y++) {
39 for (x = 0; x < x_size; x++) {
45 for (y = 1; y < y_size - 1; y++) {
46 for (x = 1; x < x_size - 1; x++) {
48 for (j = - 1; j < 2; j++) {
49 for (i = -1; i < 2; i++) {
50 pixel_value += weight[j + 1][i + 1] * (*(image1 + (y + j) + (x + i) *
MAX_IMAGESIZE));
54 *(image2 + y + x *
MAX_IMAGESIZE) = (
unsigned char)pixel_value;
int laplacian(unsigned char *image1, unsigned char *image2, unsigned int x_size, unsigned int y_size)
x
Return the smallest n such that 2^n >= _x.