segmentation

package
v0.0.0-...-ccf6f70 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2014 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

*

  • This is probably the most important package in the repository. It contains
  • all the segmentation algorithms and the utilities to transform from an
  • image to a graph and from a DisjointSet forest to an image.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IntensityDifference

func IntensityDifference(p1 graph.Pixel, p2 graph.Pixel) float64

*

  • Computes the absolute difference between the two pixels intensities.

func NNWeight

func NNWeight(p1 graph.Pixel, p2 graph.Pixel) float64

*

  • Computes the Euclidean distance between two pixels.
  • For p1 = (r1, g1, b1) and p2 = (r2, g2, b2):
  • d = sqrt((r2 - r1)^2 + (g2 - g1)^2 + (b2 - b1)^2)

Types

type ImageColor

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

*

  • Color type that implements color.RGBA

func (*ImageColor) RGBA

func (color *ImageColor) RGBA() (uint32, uint32, uint32, uint32)

*

  • Returns the RGBA values of the given color

type Segmenter

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

*

  • Type used to run all the segmentation algorithms.
  • It stores the graph, the resultset, the original image, the graph
  • obtained from the image and if it will generate a result image with
  • random colors.

func New

func New(img image.Image, graphType graph.GraphType,
	weightfn graph.WeightFn) *Segmenter

*

  • Returns a new Segmenter, generates a graph of the given graph type from
  • the given image using the given weight function to compute the edge
  • weights.

func (*Segmenter) GetResultImage

func (s *Segmenter) GetResultImage() image.Image

*

  • Returns the result image. Returns nil if no segmentation algorithm
  • has been executed before.

func (*Segmenter) SegmentGBS

func (s *Segmenter) SegmentGBS(sigma, k float64, minSize int)

*

  • Performs the image segmentation using the "Graph Based Segmentation"
  • algorithm. It uses sigma to apply a gaussian filter with it to the image
  • to smooth it before running the algorithm.
  • k and minSize are the algorithm parameters. For more information on this
  • algorithm refer to either my report which link is on the repo's README or
  • to: http://cs.brown.edu/~pff/papers/seg-ijcv.pdf

func (*Segmenter) SegmentHMSF

func (s *Segmenter) SegmentHMSF(sigmaSmooth, minWeight float64)

*

  • Performs the image segmentation using the "Heuristic for Minimum Spanning
  • Forests" algorithm. It uses the weightfn to compute the weight of the
  • graph edges. minWeight is the only parameter.
  • For more information on this algorithm refer to either my report which link
  • is on the repo's README or to:
  • http://algo2.iti.kit.edu/wassenberg/wassenberg09parallelSegmentation.pdf

func (*Segmenter) SetRandomColors

func (s *Segmenter) SetRandomColors(val bool)

*

  • Sets the random color attribute to true or false according to val

Jump to

Keyboard shortcuts

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