#include <gevd_step.h>
Public Member Functions | |
gevd_step (float smooth_sigma=1, float noise_sigma=-0.5, float contour_factor=1.0, float junction_factor=1.5) | |
threshold factor for junction edgels | |
~gevd_step () | |
Free space allocated for detecting step profiles. Does nothing. | |
bool | DetectEdgels (const gevd_bufferxy &image, gevd_bufferxy *&edgels, gevd_bufferxy *&direction, gevd_bufferxy *&locationx, gevd_bufferxy *&locationy, gevd_bufferxy *&grad_mag, gevd_bufferxy *&angle) |
Gradient orientation. | |
int | RecoverJunctions (const gevd_bufferxy &image, gevd_bufferxy &edgels, gevd_bufferxy &direction, gevd_bufferxy &locationx, gevd_bufferxy &locationy, int *&junctionx, int *&junctiony) |
Find junctions by searching for extensions of contours from their dangling end points. | |
float | NoiseSigma () const |
query stored/estimated noise sigma | |
float | NoiseResponse () const |
response of noise sigma to filter ddG | |
float | NoiseThreshold (bool shortp=false) const |
elongated/directional? | |
Static Public Member Functions | |
static float | NoiseResponseToFilter (const float noiseSigma, const float smoothSigma, const float filterFactor) |
Compute response of white noise through the filter dG, or first-derivative of the Gaussian. | |
Protected Attributes | |
float | smoothSigma |
spatial smoothing | |
float | noiseSigma |
sensor/texture noise | |
float | contourFactor |
float | junctionFactor |
threshold factor for edgels | |
float | filterFactor |
factor in convolution filter | |
Friends | |
vcl_ostream & | operator<< (vcl_ostream &os, const gevd_step &st) |
Output a snapshot of current control parameters. | |
vcl_ostream & | operator<< (vcl_ostream &os, gevd_step &st) |
Output a snapshot of current control parameters. |
Definition at line 63 of file gevd_step.h.
gevd_step::gevd_step | ( | float | smooth_sigma = 1 , |
float | noise_sigma = -0.5 , |
||
float | contour_factor = 1.0 , |
||
float | junction_factor = 1.5 |
||
) |
threshold factor for junction edgels
Save parameters and create workspace for detecting step profiles.
High frequency features are smoothed away by smooth_sigma. Texture or white noise less than noise_sigma are not detected. smooth_sigma = 0.5-2.0, 1.0 insures separation of independent steps >= 2.
If noise_sigma > 0, noise_sigma = is interpreted as the standard deviation of intensity z(x,y) in a uniform region. If -1 <= noise_sigma <= 0, then noise_sigma is interpreted as a factor -k, where k is a weighting factor between two estimates: sensorNoise and textureNoise.
noiseSigma = ((1-k)*sensorNoise + k*textureNoise)/K
The values of sensorNoise and textureNoise are computed from the shape of the histogram of gradient magnitude values, in the neighborhood of low gradients. The value of K is computed in NoiseResponseToFilter and defined by:
1/(smoothSigma^1.5)*(.5/M_PI^.25)*filterFactor.
Given the defaults: smoothSigma =1 and filterFactor = 2, K = .75
The threshold used to delete weak edges is modified depending on the context. For edgels along a contour, shortp = false, and the threshold is given by:
NoiseThreshold(shortp) = 3*K*noiseSigma
For edgels at junctions, shortp = true, the threshold is computed using different factors. The difference is controlled by the parameters: contour_factor and junction_factor. smoothSigma when extending the boundary at junctions is 1/2 the value along contours.
smooth_sigma | spatial smoothing [0.5 2.0] |
noise_sigma | sensor/texture intensity noise -[0 1] |
contour_factor | threshold factor for contour edgels |
Definition at line 79 of file gevd_step.cxx.
gevd_step::~gevd_step | ( | ) |
Free space allocated for detecting step profiles. Does nothing.
Definition at line 103 of file gevd_step.cxx.
bool gevd_step::DetectEdgels | ( | const gevd_bufferxy & | image, |
gevd_bufferxy *& | contour, | ||
gevd_bufferxy *& | direction, | ||
gevd_bufferxy *& | locationx, | ||
gevd_bufferxy *& | locationy, | ||
gevd_bufferxy *& | grad_mag, | ||
gevd_bufferxy *& | angle | ||
) |
Gradient orientation.
Detect step profiles with Canny edge detector.
The image is convolved with a Gaussian to smooth away high frequency noise, and insure separation of step responses. Then local gradient magnitude and direction is detected using first difference [-1 0 +1]. Optionally estimate sensor/texture sigma and set threshold. Finally, non maximum suppression is done to find strict local maxima of slope. The Canny edge detector finds elongated contours only. These contours are typically broken at junctions because non maximum suppression is done along only the strongest direction. Return contour (float), direction (byte), location (float) images. Return true if no exception. J. Canny, A Computational Approach to Edge Detection, IEEE Trans on PAMI, vol 8, no 6, Nov 1986.
image | float image |
contour | strength = dG * I |
direction | direction % PI/4 |
locationx | subpixel loc |
grad_mag | Gradient magnitude |
Definition at line 121 of file gevd_step.cxx.
float gevd_step::NoiseResponse | ( | ) | const |
response of noise sigma to filter ddG
Compute response of white noise through the filter dG, or second-derivative of the Gaussian.
Using a threshold of 3 times this noise response would eliminate 99% of the noise edges.
Definition at line 487 of file gevd_step.cxx.
float gevd_step::NoiseResponseToFilter | ( | const float | noiseSigma, |
const float | smoothSigma, | ||
const float | filterFactor | ||
) | [static] |
Compute response of white noise through the filter dG, or first-derivative of the Gaussian.
Using a threshold of 3 times this noise response would eliminate 99% of the noise edges.
Definition at line 518 of file gevd_step.cxx.
float gevd_step::NoiseSigma | ( | ) | const |
query stored/estimated noise sigma
Return the standard deviation of raw noise, in the original image, either estimated or given by the user.
If the noise has not been estimated, return 0.
Definition at line 476 of file gevd_step.cxx.
float gevd_step::NoiseThreshold | ( | bool | shortp = false | ) | const |
elongated/directional?
Return threshold for detecting contour or junction, which is response of white gaussian noise, noise_sigma, to step edge detector, i.e.
first-order derivative of Gaussian, smooth_sigma. noise_sigma can be estimated by finding the standard deviation in a region of constant intensity, and no texture patterns. Use short_factor*noise_sigma and smooth_sigma/2, when detecting junctions, to account for multiple responses to step edge detector.
Definition at line 504 of file gevd_step.cxx.
int gevd_step::RecoverJunctions | ( | const gevd_bufferxy & | image, |
gevd_bufferxy & | contour, | ||
gevd_bufferxy & | direction, | ||
gevd_bufferxy & | locationx, | ||
gevd_bufferxy & | locationy, | ||
int *& | junctionx, | ||
int *& | junctiony | ||
) |
Find junctions by searching for extensions of contours from their dangling end points.
Non maximum suppression insures that contours have width < 2, and so we can find the left/right neighbors, and deduce end points. By using a minimally smoothed image, we find step profiles up to joining with a stronger contour, thus recovering the missing junction caused by NMS along only 1 direction. The junctions are returned but are not set in the contour image, to prevent incorrect tracing of stronger contours first. The search is extended outward for a distance of kmax which is currently 4*smoothSigma + 2.
image | iterative extension |
contour | from end points of contours |
Definition at line 355 of file gevd_step.cxx.
vcl_ostream& operator<< | ( | vcl_ostream & | os, |
const gevd_step & | st | ||
) | [friend] |
Output a snapshot of current control parameters.
Definition at line 530 of file gevd_step.cxx.
vcl_ostream& operator<< | ( | vcl_ostream & | os, |
gevd_step & | st | ||
) | [friend] |
Output a snapshot of current control parameters.
Definition at line 543 of file gevd_step.cxx.
float gevd_step::contourFactor [protected] |
Definition at line 99 of file gevd_step.h.
float gevd_step::filterFactor [protected] |
factor in convolution filter
Definition at line 100 of file gevd_step.h.
float gevd_step::junctionFactor [protected] |
threshold factor for edgels
Definition at line 99 of file gevd_step.h.
float gevd_step::noiseSigma [protected] |
sensor/texture noise
Definition at line 98 of file gevd_step.h.
float gevd_step::smoothSigma [protected] |
spatial smoothing
Definition at line 97 of file gevd_step.h.