kmeans

package
v0.0.0-...-403afd8 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EuclideanDistance

func EuclideanDistance(firstVector, secondVector []float64) (float64, error)

func ImgRework

func ImgRework(clusteredData []ClusteredPixel, centroids []Pixel, rows int, cols int) (gocv.Mat, error)

Reconstroi a imagem a partir da clusterização do kmeans

func Kmeans

func Kmeans(data []ClusteredPixel, centroid []Pixel, distanceFunction DistanceFunction, threshold int) ([]ClusteredPixel, []Pixel, error)

Implementa o algoritimo de clusterização K-means

func ManhattanDistance

func ManhattanDistance(firstVector, secondVector []float64) (float64, error)

Types

type ClusteredPixel

type ClusteredPixel struct {
	ClusterNumber int
	Pixel
}

ClusteredPixel: Abstração de pixel com número de cluster

func FormatData

func FormatData(img gocv.Mat) []ClusteredPixel

Formata a imagem para ser processada pelo kmeans

type DistanceFunction

type DistanceFunction func(first, second []float64) (float64, error)

Distance Function: Calcula a distância entre pixeis

type Pixel

type Pixel []float64

Pixel: Abstração de uma slice N-dimensional de float64

func Seed

func Seed(data []ClusteredPixel, k int) []Pixel

Retorna uma slice de k centroids inicializados com valores de pixeis escolhidos aleatoriamente do data

func (Pixel) Add

func (Pixel Pixel) Add(otherPixel Pixel)

Soma dois pixeis

func (Pixel) Mul

func (Pixel Pixel) Mul(scalar float64)

Multiplica um pixel por um escalar

Jump to

Keyboard shortcuts

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