Documentation ¶
Overview ¶
Package keypoints contains the implementation of keypoints in an image. For now: - FAST keypoints
Index ¶
- Variables
- func ComputeKeypointsOrientations(img *image.Gray, kps KeyPoints, radius int) []float64
- func ComputeORBKeypoints(im *image.Gray, cfg *ORBConfig) (Descriptors, KeyPoints, error)
- func GetMatchingKeyPoints(matches *DescriptorMatches, kps1, kps2 KeyPoints) (KeyPoints, KeyPoints, error)
- func GetNumberOctaves(imgSize image.Point) int
- func GetPointValuesInNeighborhood(img *image.Gray, coords image.Point, neighborhood []image.Point) []float64
- func PlotKeypoints(img *image.Gray, kps []image.Point, outName string) error
- type BRIEFConfig
- type Descriptor
- type DescriptorMatch
- type DescriptorMatches
- type Descriptors
- type FASTConfig
- type FASTKeypoints
- type FASTPixel
- type ImagePyramid
- type KeyPoint
- type KeyPoints
- type MatchingConfig
- type ORBConfig
- type OrientedKeypoints
- type PixelType
- type SamplingType
Constants ¶
This section is empty.
Variables ¶
var ( // CrossIdx contains the neighbors coordinates in a 3-cross neighborhood. CrossIdx = []image.Point{{0, 3}, {3, 0}, {0, -3}, {-3, 0}} // CircleIdx contains the neighbors coordinates in a circle of radius 3 neighborhood. CircleIdx = []image.Point{ {0, -3}, {1, -3}, {2, -2}, {3, -1}, {3, 0}, {3, 1}, {2, 2}, {1, 3}, {0, 3}, {-1, 3}, {-2, 2}, {-3, 1}, {-3, 0}, {-3, -1}, {-2, -2}, {-1, -3}, } )
Functions ¶
func ComputeKeypointsOrientations ¶
ComputeKeypointsOrientations compute keypoints orientations in image.
func ComputeORBKeypoints ¶
ComputeORBKeypoints compute ORB keypoints on gray image.
func GetMatchingKeyPoints ¶
func GetMatchingKeyPoints(matches *DescriptorMatches, kps1, kps2 KeyPoints) (KeyPoints, KeyPoints, error)
GetMatchingKeyPoints takes the matches and the keypoints and returns the corresponding keypoints that are matched.
func GetNumberOctaves ¶
GetNumberOctaves returns the number of scales (or Octaves) in the Pyramid computed from the image size.
Types ¶
type BRIEFConfig ¶
type BRIEFConfig struct { N int `json:"n"` // number of samples taken Sampling SamplingType `json:"sampling"` UseOrientation bool `json:"use_orientation"` PatchSize int `json:"patch_size"` }
BRIEFConfig stores the parameters.
func LoadBRIEFConfiguration ¶
func LoadBRIEFConfiguration(file string) *BRIEFConfig
LoadBRIEFConfiguration loads a BRIEFConfig from a json file.
type DescriptorMatch ¶
DescriptorMatch contains the index of a match in the first and second set of descriptors.
type DescriptorMatches ¶
type DescriptorMatches struct { Indices []DescriptorMatch Descriptors1 Descriptors Descriptors2 Descriptors }
DescriptorMatches contains the descriptors and their matches.
func MatchKeypoints ¶
func MatchKeypoints(desc1, desc2 Descriptors, cfg *MatchingConfig, logger golog.Logger) *DescriptorMatches
MatchKeypoints takes 2 sets of descriptors and performs matching.
type Descriptors ¶
type Descriptors []Descriptor
Descriptors stores a slice of Descriptor.
func ComputeBRIEFDescriptors ¶
func ComputeBRIEFDescriptors(img *image.Gray, kps *FASTKeypoints, cfg *BRIEFConfig) (Descriptors, error)
ComputeBRIEFDescriptors computes BRIEF descriptors on image img at keypoints kps.
type FASTConfig ¶
type FASTConfig struct { NMatchesCircle int `json:"n_matches"` NMSWinSize int `json:"nms_win_size"` Threshold float64 `json:"threshold"` Oriented bool `json:"oriented"` Radius int `json:"radius"` }
FASTConfig holds the parameters necessary to compute the FAST keypoints.
func LoadFASTConfiguration ¶
func LoadFASTConfiguration(file string) *FASTConfig
LoadFASTConfiguration loads a FASTConfig from a json file.
type FASTKeypoints ¶
type FASTKeypoints OrientedKeypoints
FASTKeypoints stores keypoint locations and orientations (nil if not oriented).
func NewFASTKeypointsFromImage ¶
func NewFASTKeypointsFromImage(img *image.Gray, cfg *FASTConfig) *FASTKeypoints
NewFASTKeypointsFromImage returns a pointer to a FASTKeypoints struct containing keypoints locations and orientations if Oriented is set to true in the configuration.
func (*FASTKeypoints) IsOriented ¶
func (kps *FASTKeypoints) IsOriented() bool
IsOriented returns true if FASTKeypoints contains orientations.
type FASTPixel ¶
FASTPixel stores coordinates of an image point in a neighborhood and its PixelType.
type ImagePyramid ¶
ImagePyramid contains a slice of an image and its downscaled images as well as the corresponding scales wrt the original image.
func GetImagePyramid ¶
func GetImagePyramid(img *image.Gray) (*ImagePyramid, error)
GetImagePyramid return the images in the pyramid as well as the scales corresponding to each image in the ImagePyramid struct.
type KeyPoints ¶
KeyPoints is a slice of image.Point that contains several kps.
func ComputeFAST ¶
func ComputeFAST(img *image.Gray, cfg *FASTConfig) KeyPoints
ComputeFAST computes the location of FAST keypoints. The configuration should contain the following parameters
- nMatchCircle - Minimum number of consecutive pixels out of 16 pixels on the circle that should all be either brighter or darker w.r.t test-pixel. A point c on the circle is darker w.r.t test pixel p if “Ic < Ip - threshold“ and brighter if “Ic > Ip + threshold“.
- nmsWin - int, size of window to perform non-maximum suppression
- threshold - float64, Threshold used to decide whether the pixels on the circle are brighter, darker or similar w.r.t. the test pixel. Decrease the threshold when more corners are desired and vice-versa.
func RescaleKeypoints ¶
RescaleKeypoints rescales given keypoints wrt scaleFactor.
type MatchingConfig ¶
type MatchingConfig struct { DoCrossCheck bool `json:"do_cross_check"` MaxDist float64 `json:"max_dist"` }
MatchingConfig contains the parameters for matching descriptors.
type ORBConfig ¶
type ORBConfig struct { Layers int `json:"n_layers"` DownscaleFactor int `json:"downscale_factor"` FastConf *FASTConfig `json:"fast"` BRIEFConf *BRIEFConfig `json:"brief"` }
ORBConfig contains the parameters / configs needed to compute ORB features.
func LoadORBConfiguration ¶
LoadORBConfiguration loads a ORBConfig from a json file.
type OrientedKeypoints ¶
OrientedKeypoints stores keypoint locations and orientations (nil if not oriented).
type PixelType ¶
type PixelType int
PixelType stores 0 if a pixel is darker than center pixel, and 1 if brighter.
type SamplingType ¶
type SamplingType int
SamplingType stores 0 if a sampling of image points for BRIEF is uniform, 1 if gaussian.