2 Edge detectionAll of the previously studied edge detection filters worked on finding local gradients (1st derivative)As such, all had to make decisions regarding the actual existence of an edge based on local information
4 Sobel edges – threshold on magnitude The preceding images were edge-detected with a Sobel operator then binarized with various thresholdsThe overall trend is predictable but the individual results are notThis threshold dependency is the curse of image processingDifficult to isolate “real” edgesDifficult to find accurate edge locationWe need smarter algorithms
5 Scale space processing One method of dealing with the threshold dependency is through scale-space processingAn image is processed at various scales (sizes/resolution) revealing different sets of features at each scaleFeatures common to all [or many] sets are deemed “important”
6 The Gaussian PyramidSelect a set of Gaussian filter parameters (sigma and width) and blur the imageSave the imageReduce it’s size by subsampling (eliminating every other row/column)Do it again
7 The Gaussian PyramidYou end up with a series of images (a pyramid) each exposing different featuresCoarse features at the top of the pyramidFine features at the bottomYou can now use the coarse features to select where to concentrate your processing of the fine features
8 Better (different) algorithms Another method of dealing with the threshold dependency is through more complex algorithms
9 A better kernelThe Sobel mask is a derivative mask (computes the weighted difference of neighborhood pixels)So is the Laplacian (negative in the middle, positive around the rest)From calculus: the 2nd derivative of a signal is zero when the derivative magnitude is extremal
10 A better kernelCombining these observations we can derive the Laplacian-Gaussian filter due to Marr and HildrethAlso known as a DoG (Difference of Gaussians) because it can be approximated by subtracting two Gaussian kernels of same width and differing sigmas
12 The Laplacian-Gaussian kernel Bypassing the math and jumping to the results of applying the rules of calculus…Similar in form to the Gaussian kernel
13 The Laplacian-Gaussian kernel In 1 dimension…Can be approximated by difference of two Gaussians
14 The Laplacian-Gaussian kernel Convolution with this kernel results in edge magnitudes of both positive and negative valuesWe’re interested in where the sign changes occur (the zero crossing)These are where the edges are (recall the calculus result)
15 Sobel vs. Laplacian-Gaussian L-G does not detect as much “noise” as Sobel – why not?
16 Still something missing… What are we ignoring in the following edge detection processes?Gaussian filterSobel edge detectionThreshold based binarization of Sobel magnitudeAndLaplacian-Gaussian filterZero crossing detection
17 We need a smarter algorithm We merely selected each edge based on its magnitude and zero-crossingWe completely ignored its immediate surroundingsWhy is this bad?Detects edges we don’t wantProne to noiseProne to clutterDoesn’t detect edges we do wantWeak magnitude edges are thresholded (thresheld?) awayWe need a smarter algorithm!
18 The Canny edge detector John Canny – MIT 1986Developed a process (series of steps) for identifying edges in an imageGaussian smoothing of input imageLocal derivative operator to detect edge candidatesRemoval of edges that are clustered around a single locationAdaptive thresholding algorithm for final edge selection
19 Concepts Gaussian smooth original image Local derivative operator Reduce the effects of noiseLocal derivative operatorSimple neighbor pixel subtraction to detect gradients (1st derivative)Non-maximal suppressionThin out the edges around a given pointThresholdUse two thresholds combined with spatial continuity
20 Spatial continuity aka contour following Apply the high threshold to get “obvious” edgesSearch for a neighboring edge above the low threshold in the direction of the strong edgeWe’re using a strong edge as an anchor point for a contour of weak and strong edges – known as Hysteresis
21 Canny resultsWith very conservative high/low thresholds
23 SummaryThrough more complex processing we arrive at a set of edges in which we have confidenceMinimal reliance on thresholdsThe cost is complex (slow, memory intensive) processingWe must trade resources for accuracy!
25 Edge Sharpening An process for making an image look “better” In this case “better” means “sharper”The general approach is to amplify the high-frequency components (the edges) to create a “perceived” sharpness
26 Method 1 – subtract 2nd derivative This causes a step edge to undershoot at the bottom and overshoot at the topThe Laplacian works well for the 2nd derivative
27 ImageJNote that this is difficult to do in ImageJ since the convolution operation clamps negative pixel values to 0
28 Unsharp maskStepsSubtract a Gaussian-smoothed version of the image from the original creating a maskAdd a weighted version of the mask to the original image