Added a blur step to the edge finding example.

This commit is contained in:
Davis King 2011-09-24 18:40:06 -04:00
parent 6aaf3467d4
commit 27a6ad4560
1 changed files with 7 additions and 4 deletions

View File

@ -45,12 +45,15 @@ int main(int argc, char** argv)
// to BMP files. // to BMP files.
load_image(img, argv[1]); load_image(img, argv[1]);
// Now lets use some image functions. This example is going to perform
// simple edge detection on the image. First lets find the horizontal and // Now lets use some image functions. First lets blur the image a little.
// vertical gradient images. array2d<unsigned char> blurred_img;
gaussian_blur(img, blurred_img);
// Now find the horizontal and vertical gradient images.
array2d<short> horz_gradient, vert_gradient; array2d<short> horz_gradient, vert_gradient;
array2d<unsigned char> edge_image; array2d<unsigned char> edge_image;
sobel_edge_detector(img, horz_gradient, vert_gradient); sobel_edge_detector(blurred_img, horz_gradient, vert_gradient);
// now we do the non-maximum edge suppression step so that our edges are nice and thin // now we do the non-maximum edge suppression step so that our edges are nice and thin
suppress_non_maximum_edges(horz_gradient, vert_gradient, edge_image); suppress_non_maximum_edges(horz_gradient, vert_gradient, edge_image);