#include <stdio.h>
#include <stdlib.h>
#include "allheaders.h"
Функции | |
PIX * | pixSobelEdgeFilter (PIX *pixs, l_int32 orientflag) |
PIX * | pixTwoSidedEdgeFilter (PIX *pixs, l_int32 orientflag) |
Input: pixs (8 bpp; no colormap) orientflag (L_HORIZONTAL_EDGES, L_VERTICAL_EDGES, L_ALL_EDGES) Return: pixd (8 bpp, edges are brighter), or null on error
Notes: (1) Invert pixd to see larger gradients as darker (grayscale). (2) To generate a binary image of the edges, threshold the result using pixThresholdToBinary(). If the high edge values are to be fg (1), invert after running pixThresholdToBinary(). (3) Label the pixels as follows: 1 4 7 2 5 8 3 6 9 Read the data incrementally across the image and unroll the loop. (4) This runs at about 45 Mpix/sec on a 3 GHz processor.
Input: pixs (8 bpp; no colormap) orientflag (L_HORIZONTAL_EDGES, L_VERTICAL_EDGES) Return: pixd (8 bpp, edges are brighter), or null on error
Notes: (1) For detecting vertical edges, this considers the difference of the central pixel from those on the left and right. For situations where the gradient is the same sign on both sides, this computes and stores the minimum (absolute value of the) difference. The reason for checking the sign is that we are looking for pixels within a transition. By contrast, for single pixel noise, the pixel value is either larger than or smaller than its neighbors, so the gradient would change direction on each side. Horizontal edges are handled similarly, looking for vertical gradients. (2) To generate a binary image of the edges, threshold the result using pixThresholdToBinary(). If the high edge values are to be fg (1), invert after running pixThresholdToBinary(). (3) This runs at about 60 Mpix/sec on a 3 GHz processor. It is about 30% faster than Sobel, and the results are similar.