Canny edge detector: Difference between revisions
Content added Content deleted
(Small improvements in the D entry) |
(In the C entry: (int*) is an overkill for 8bpp images. Using (short int*) instead halves memory usage.) |
||
Line 67: | Line 67: | ||
// Use int instead `unsigned char' so that we can store |
// Use int instead `unsigned char' so that we can store |
||
// negative values. |
// negative values. |
||
typedef int pixel_t; |
typedef short int pixel_t; |
||
pixel_t *load_bmp(const char *filename, |
pixel_t *load_bmp(const char *filename, |
||
Line 339: | Line 339: | ||
// Reuse array |
// Reuse array |
||
int *edges = (int*) after_Gy; // used as a stack. nx*ny/2 elements should be enough. |
|||
memset(out, 0, sizeof(pixel_t) * nx * ny); |
memset(out, 0, sizeof(pixel_t) * nx * ny); |
||
memset(edges, 0, sizeof(pixel_t) * nx * ny); |
memset(edges, 0, sizeof(pixel_t) * nx * ny); |