log | Laplace of Gaussian and zero crossing |
-in <image> | input image |
-out <image> | output image |
[ -mask < 1 | 2 | 3 > ] | used mask |
grad | Gradient based edge detection |
-in <image> | input image |
-out <image> | output image |
[ -tmp <image> ] | gradient image |
[ -mask <r | p | s | i> ] | used mask |
[ -thresper <percent> ] | percent of pixels on edge area |
These two commands take an image, convolute it with some mask and decide which pixels belong to the edge area. They give out black image where edges are marked with white.
Command log uses Laplace of Gaussian and zero crossing for edge detection. Possible masks are:
1: 0 -1 0 2: -1 -1 -1 3: 1 -2 1 -1 4 -1 -1 8 -1 -2 4 -2 0 -1 0 -1 -1 -1 1 -2 1
Command grad uses Roberts (r), Prewitt (p), Sobel (s) or isotropic (i) mask to approximate gradient in each pixel. After that, result is thresholded so that given percent of pixels is marked edge area.
Example: Following commands load an image, detect edges using both commands above and show resulting images.
... # Load image NDA> loadimg lenna.gif img_in # Convert image into grayscale NDA> cnvimg -in img_in -out img_gray -gray # Use Laplace of Gaussian for edge detection NDA> log -in img_gray -out img_edge1 -mask 1 # Show the result NDA> mkgrp g1 NDA> bgimg g1 -img img_edge1 NDA> show g1 # Do the same thing using gradient based edge detection NDA> grad -in img_gray -out img_edge2 -tmp img_tmp -mask s \ -thresper 15 NDA> mkgrp g2 NDA> bgimg g2 -img img_edge2 NDA> show g2