ransac

package
v0.0.0-...-51c8454 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package ransac contains an implementation of the RANSAC algorithm.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Plot

func Plot(path string, x, y []float64, ps []float64, fn ModelFn, labelX, labelY string)

Plot is a helper to plot the results of a RANSAC iteration.

func Ransac

func Ransac(x, y []float64, model ModelFn, nParams int, p MetaParams) (*optimize.Location, error)

Ransac runs the RANSAC algorithm, trying to find model parameters for ModelFn according to the meta parameters.

Types

type MetaParams

type MetaParams struct {
	MinModelPoints  int
	MaxIter         int
	MinInliers      int
	InlierThreshold float64
	Seed            int64
}

MetaParams contains the meta-parameters for a RANSAC search.

func (*MetaParams) Check

func (p *MetaParams) Check(nx int)

Check validates RANSAC params and will panic if there are invalid settings.

type ModelFn

type ModelFn func(x float64, params []float64) float64

ModelFn represents the model to be fitted during RANSAC. It has to be implemented by the user. Example (poly2):

func(x float64, params []float64) float64 {
	return params[0] + params[1]*x + params[2]*x*x
}

Jump to

Keyboard shortcuts

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