Java implementation of image processing algrithms, packaged as ImageJ plugins.
-
Compute x and y partial derivative respectively. (Sobel operator might be used)
-
Compute gradient magnitude and direction :
grad_magnitude[u, v] = sqrt(partial_derivative_x[u, v]^2 + partial_derivative_y[u, v]^2) grad_angle[u, v] = atan(partial_derivative_y[u, v] + partial_derivative_y[u, v]) -
Non-maximum suppression : divide the 8-neighborhoods of gradient magnitude at [u,v] into 4 regions, and decide which 2 of 8 neighbors is actually adjacent to gradient_mag[u, v], according to the gradient direction. If gradient_mag[u,v] is samller than one or both of its 2 adjacent neighbors, it get suppressed (set to zero).
-
Hysteresis Threshold : Two threshold values, T_low and T_high are used.
boolean[][] edges = new boolean[width][height]; if (gradient_mag[u,v] > T_high) edges[u][v] == true; else (gradient_mag[u, v] > T_low && one of its 8 neighbors are marked true in edges) edges[u][v] = true;

