Computer Vision Library
Files | Functions
Edge Detection

Files

file  sobel.js
 Edge Detection operators Implements OpenGL GLSL Shaders for fast gradient (edges) extraction.
 

Functions

void schaar ()
 
void sobel ()
 

Detailed Description

Different edge detection algorithms

Function Documentation

◆ schaar()

void schaar ( )

Schaar edge detection. Implements Schaar gradient operator using GPU shaders.

Overview
The Schaar operator is an alternative to sobel edge detector. Schaar edge detector aims to improve rotational symmetry. The most frequently used two 3x3 kernels are:
  • \(\displaystyle{G}{x}={\left[\begin{matrix}+{3}&{0}&-{3}\\+{10}&{0}&-{10}\\+{3}&{0}&-{3}\end{matrix}\right]}\)
  • \(\displaystyle{G}{y}={\left[\begin{matrix}+{3}&+{10}&+{3}\\{0}&{0}&{0}\\-{3}&-{10}&-{3}\end{matrix}\right]}\)
See also
sobel

◆ sobel()

void sobel ( )

Sobel-Federman edge detection. Implements Sobel–Feldman gradient operator using GPU shaders. The resulting gradient image is with thin edges after a Non-maximum suppression procedure.

Overview
The Sobel operator is a fundamental part in many Computer Vision algorithms. It convolves two 3x3 kernels to approximate image derivative and extract gradients.
Math Theory
  • \(\displaystyle{G}{x}={\left[\begin{matrix}+{1}&{0}&-{1}\\+{2}&{0}&-{2}\\+{1}&{0}&-{1}\end{matrix}\right]}={\left[\begin{matrix}{1}\\{2}\\{1}\end{matrix}\right]}\ast{\left[\begin{matrix}{1}&{0}&-{1}\end{matrix}\right]}\)
  • \(\displaystyle{G}{y}={\left[\begin{matrix}+{1}&+{2}&+{1}\\{0}&{0}&{0}\\-{1}&-{2}&-{1}\end{matrix}\right]}={\left[\begin{matrix}{1}\\{0}\\-{1}\end{matrix}\right]}\ast{\left[\begin{matrix}{1}&{2}&{1}\end{matrix}\right]}\)
  • Gradient magnitute: \(\displaystyle{G}=\sqrt{{{G}{x}^{2}+{G}{y}^{2}}}\)
  • Gradient direction: \(\displaystyle\theta={a} \tan{{\left(\frac{{{G}{x}}}{{{G}{y}}}\right)}}\)
Example image result
sobel_nms_ex.jpg
Clippers edge detection with Sobel operator
External resources
See also
schaar