Documentation
¶
Overview ¶
Package vision provides common algorithms used in computer vision
Index ¶
- func Blobs(input *image.Image, connectivity Connectivity) *image.RGBA
- func Canny(img image.Image, upperThreshold, lowerThreshold uint8, k int, σ float64) (j *image.Gray)
- func Detect(I image.Image) (R image.Rectangle)
- func EdgeDrawing(gray *image.Gray) *image.Gray
- func Gaussian(gray *image.Gray, sigma float64) *image.Gray
- func GenerateKey(theta, rho int) int
- func Grad(gray *image.Gray) (mag, ang *image.Gray)
- func Gray2Mat(i *image.Gray) *matrix.Matrix
- func Harris(img *image.Gray, measure, k, d, i float32, strategy string, cells, N int, ...) (x, y *[]int)
- func Im2Mat(i image.Image) (array []*matrix.Matrix)
- func ListBlobs(i *image.Image, connectivity Connectivity) *[]Blob
- func Mat2Gray(mat *matrix.Matrix) (gray *image.Gray)
- func Mat2Im(array []*matrix.Matrix) (ptr *image.Image)
- func Stack(I image.RGBA, R image.Rectangle) (O []image.Image)
- func Threshold(img *image.Image, level uint8) (out *image.Gray)
- type Blob
- type Connectivity
- type HoughPoint
- type HoughSpace
- func (h *HoughSpace) At(theta, rho int) (*HoughPoint, bool)
- func (h *HoughSpace) Count() int
- func (h *HoughSpace) FindCentroids(threshold uint8) *HoughSpace
- func (h *HoughSpace) HoughImage() *image.Gray
- func (h *HoughSpace) PlotLines() *image.Gray
- func (h *HoughSpace) Set(theta, rho int, hp *HoughPoint)
- type Region
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Blobs ¶
func Blobs(input *image.Image, connectivity Connectivity) *image.RGBA
Blobs paint all connected white blobs in a different RGB color
func GenerateKey ¶
GenerateKey returns an unique integer representation for each Hough point.
func Harris ¶
func Harris(img *image.Gray, measure, k, d, i float32, strategy string, cells, N int, subpixel bool) (x, y *[]int)
Harris implements the Harris corner detector as described in Javier Sánchez, Nelson Monzón, and Agustín Salgado, An Analysis and Implementation of the Harris Corner Detector, Image Processing On Line, 8 (2018), pp. 305–328. https://doi.org/10.5201/ipol.2018.229
func Im2Mat ¶
Im2Mat converts an image to an array of matrices. The output array contains a single matrix if the input is a grayscale image or four matrices if it is a RGBA image. When converting from RGBA, the channel to index correspondence is the following:
RED -> 0 GREEN -> 1 BLUE -> 2 ALPHA -> 3
If the image pointer is nil the function produces nothing and returns a nil pointer, so remember always checking for nil when using it.
func ListBlobs ¶
func ListBlobs(i *image.Image, connectivity Connectivity) *[]Blob
ListBlobs returns a list of all white connected blobs
func Mat2Im ¶
Mat2Im converts an valid array of matrices to an 8-bit color depth image and returns a pointer to it. A valid array contains matrices of same size. The function produces a grayscale image if the array has a single matrix and a RGBA image if it has four matrices. When converting to RGBA, the index to channel correspondence is the following:
0 -> RED 1 -> GREEN 2 -> BLUE 3 -> ALPHA
If the array is not valid the function produces nothing and returns a nil pointer, so remember always checking for nil when using it.
Types ¶
type Connectivity ¶
type Connectivity int
Connectivity is an image graph connectivity for use in blob detection
const ( // Connectivity8 8-connected image graph Connectivity8 Connectivity = iota // Connectivity4 4-connected image graph Connectivity4 )
type HoughPoint ¶
HoughPoint represents a single point in the Hough space with its score, theta and rho values and and minimum and maximum corresponding spatial points.
func (HoughPoint) String ¶
func (h HoughPoint) String() string
String returns a string representation of the HoughPoint.
type HoughSpace ¶
type HoughSpace struct {
ThetaRes int
RhoRes int
MaxScore int
MinScore int
SpatialBounds image.Rectangle
// contains filtered or unexported fields
}
HoughSpace stores the relevant data from the Hough transform algorithm.
func NewHoughSpace ¶
func NewHoughSpace(input *image.Gray, thetaRes, rhoRes int) *HoughSpace
NewHoughSpace performs the Hough transform in the input space image and returns a HoughSpace struct pointer with the given theta and rho resolutions.
func (*HoughSpace) At ¶
func (h *HoughSpace) At(theta, rho int) (*HoughPoint, bool)
At returns the Hough point at theta and rho indexes.
func (*HoughSpace) Count ¶
func (h *HoughSpace) Count() int
Count returns the total number of Hough points.
func (*HoughSpace) FindCentroids ¶
func (h *HoughSpace) FindCentroids(threshold uint8) *HoughSpace
FindCentroids thresholds the image of the Hough space, find its blobs and return a new Hough space containing only the most representative point for each blob.
func (*HoughSpace) HoughImage ¶
func (h *HoughSpace) HoughImage() *image.Gray
HoughImage rescales the scores in the Hough space to the interval [0, 255] and plot it in a grayscale image.
func (*HoughSpace) PlotLines ¶
func (h *HoughSpace) PlotLines() *image.Gray
PlotLines returns an image with line segments for each corresponding point in the Hough space.
func (*HoughSpace) Set ¶
func (h *HoughSpace) Set(theta, rho int, hp *HoughPoint)
Set overwrites the Hough point at theta and rho indexes.