edgeefy

package module
v0.0.0-...-402531e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2021 License: GPL-3.0 Imports: 15 Imported by: 1

README

edgeefy

Implementation of canny edge detection in Go

This projects implements edge detection in a given image using the so called canny algorithm. The implemented algorithm consists of the following steps:

  1. perform gaussian blur (optional)
  2. perform sobel filtering
  3. apply non-maximum suppression
  4. perform double thresholding
  5. track edges by hysteresis

The implementation supports the input and output of jpg and png images.

I started this project to get more familiar with the go programming language. In the future I would like to use the edge detection functionality to transform images into something that looks like a grid representation of the main features of the image.

Documentation

Index

Constants

View Source
const (
	HORIZONTAL direction = iota
	VERTICAL
)

Variables

View Source
var SOBEL_X = []float64{1, 0, -1, 2, 0, -2, 1, 0, -1} // matrix values for sobel filter (x-component)
View Source
var SOBEL_Y = []float64{1, 2, 1, 0, 0, 0, -1, -2, -1} // matrix values for sobel filter (y-component)

Functions

func CannyEdgeDetect

func CannyEdgeDetect(pixels [][]GrayPixel, blur bool, minRatio, maxRatio float64) [][]GrayPixel

func GrayImageFromGrayPixels

func GrayImageFromGrayPixels(pixels [][]GrayPixel) *image.Gray

GrayImageFromGrayPixels takes pixel information from the given two-dimensional array and creates a corresponding image.

func GrayPixelsFrommImage

func GrayPixelsFrommImage(img image.Image) ([][]GrayPixel, error)

Types

type GrayPixel

type GrayPixel struct {
	// contains filtered or unexported fields
}

GrayPixel is a data structure to represent the gray and alpha value of a pixel.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL