Skip to content

Commit

Permalink
all: correct formatting
Browse files Browse the repository at this point in the history
Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed Oct 11, 2023
1 parent 396d967 commit f3641a8
Show file tree
Hide file tree
Showing 37 changed files with 39 additions and 479 deletions.
1 change: 1 addition & 0 deletions asyncarray.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build openvino
// +build openvino

package gocv
Expand Down
1 change: 1 addition & 0 deletions asyncarray_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build openvino
// +build openvino

package gocv
Expand Down
7 changes: 0 additions & 7 deletions calib3d.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ func EstimateNewCameraMatrixForUndistortRectify(k, d Mat, imgSize image.Point, r
//
// For further details, please see:
// https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga7dfb72c9cf9780a347fbe3d1c47e5d5a
//
func InitUndistortRectifyMap(cameraMatrix Mat, distCoeffs Mat, r Mat, newCameraMatrix Mat, size image.Point, m1type int, map1 Mat, map2 Mat) {
sz := C.struct_Size{
width: C.int(size.X),
Expand All @@ -110,7 +109,6 @@ func InitUndistortRectifyMap(cameraMatrix Mat, distCoeffs Mat, r Mat, newCameraM
//
// For further details, please see:
// https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga7a6c4e032c97f03ba747966e6ad862b1
//
func GetOptimalNewCameraMatrixWithParams(cameraMatrix Mat, distCoeffs Mat, imageSize image.Point, alpha float64, newImgSize image.Point, centerPrincipalPoint bool) (Mat, image.Rectangle) {
sz := C.struct_Size{
width: C.int(imageSize.X),
Expand All @@ -128,7 +126,6 @@ func GetOptimalNewCameraMatrixWithParams(cameraMatrix Mat, distCoeffs Mat, image
//
// For further details, please see:
// https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga3207604e4b1a1758aa66acb6ed5aa65d
//
func CalibrateCamera(objectPoints Points3fVector, imagePoints Points2fVector, imageSize image.Point,
cameraMatrix *Mat, distCoeffs *Mat, rvecs *Mat, tvecs *Mat, calibFlag CalibFlag) float64 {
sz := C.struct_Size{
Expand Down Expand Up @@ -181,7 +178,6 @@ const (
//
// For further details, please see:
// https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga93efa9b0aa890de240ca32b11253dd4a
//
func FindChessboardCorners(image Mat, patternSize image.Point, corners *Mat, flags CalibCBFlag) bool {
sz := C.struct_Size{
width: C.int(patternSize.X),
Expand All @@ -194,7 +190,6 @@ func FindChessboardCorners(image Mat, patternSize image.Point, corners *Mat, fla
//
// For further details, please see:
// https://docs.opencv.org/master/d9/d0c/group__calib3d.html#gadc5bcb05cb21cf1e50963df26986d7c9
//
func FindChessboardCornersSB(image Mat, patternSize image.Point, corners *Mat, flags CalibCBFlag) bool {
sz := C.struct_Size{
width: C.int(patternSize.X),
Expand All @@ -207,7 +202,6 @@ func FindChessboardCornersSB(image Mat, patternSize image.Point, corners *Mat, f
//
// For further details, please see:
// https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga93efa9b0aa890de240ca32b11253dd4a
//
func FindChessboardCornersSBWithMeta(image Mat, patternSize image.Point, corners *Mat, flags CalibCBFlag, meta *Mat) bool {
sz := C.struct_Size{
width: C.int(patternSize.X),
Expand All @@ -220,7 +214,6 @@ func FindChessboardCornersSBWithMeta(image Mat, patternSize image.Point, corners
//
// For further details, please see:
// https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga6a10b0bb120c4907e5eabbcd22319022
//
func DrawChessboardCorners(image *Mat, patternSize image.Point, corners Mat, patternWasFound bool) {
sz := C.struct_Size{
width: C.int(patternSize.X),
Expand Down
1 change: 0 additions & 1 deletion cmd/dnn-pose-detection/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ func drawPose(frame *gocv.Mat) {
// PosePairs is a table of the body part connections in the format [model_id][pair_id][from/to]
// For details please see:
// https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/output.md
//
var PosePairs = [3][20][2]int{
{ // COCO body
{1, 2}, {1, 5}, {2, 3},
Expand Down
2 changes: 0 additions & 2 deletions contrib/bgsegm.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ type BackgroundSubtractorCNT struct {
//
// For further details, please see:
// https://docs.opencv.org/3.4/de/dca/classcv_1_1bgsegm_1_1BackgroundSubtractorCNT.html
//
func NewBackgroundSubtractorCNT() BackgroundSubtractorCNT {
return BackgroundSubtractorCNT{p: unsafe.Pointer(C.BackgroundSubtractorCNT_Create())}
}
Expand All @@ -42,7 +41,6 @@ func (b *BackgroundSubtractorCNT) Close() error {
//
// For further details, please see:
// https://docs.opencv.org/3.4/de/dca/classcv_1_1bgsegm_1_1BackgroundSubtractorCNT.html
//
func (b *BackgroundSubtractorCNT) Apply(src gocv.Mat, dst *gocv.Mat) {
C.BackgroundSubtractorCNT_Apply((C.BackgroundSubtractorCNT)(b.p), (C.Mat)(src.Ptr()), (C.Mat)(dst.Ptr()))

Expand Down
1 change: 0 additions & 1 deletion contrib/contrib.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
//
// For further details, please see:
// https://github.com/opencv/opencv_contrib
//
package contrib // import "gocv.io/x/gocv/contrib"
11 changes: 0 additions & 11 deletions contrib/face.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@ type LBPHFaceRecognizer struct {
//
// For further information, see:
// https://docs.opencv.org/master/df/d25/classcv_1_1face_1_1LBPHFaceRecognizer.html
//
func NewLBPHFaceRecognizer() *LBPHFaceRecognizer {
return &LBPHFaceRecognizer{p: C.CreateLBPHFaceRecognizer()}
}

// Train loaded model with images and their labels
//
// see https://docs.opencv.org/master/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#ac8680c2aa9649ad3f55e27761165c0d6
//
func (fr *LBPHFaceRecognizer) Train(images []gocv.Mat, labels []int) {
cparams := []C.int{}
for _, v := range labels {
Expand All @@ -61,7 +59,6 @@ func (fr *LBPHFaceRecognizer) Train(images []gocv.Mat, labels []int) {
//
// For further information, see:
// https://docs.opencv.org/master/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#a8a4e73ea878dcd0c235d0487189d25f3
//
func (fr *LBPHFaceRecognizer) Update(newImages []gocv.Mat, newLabels []int) {
cparams := []C.int{}
for _, v := range newLabels {
Expand All @@ -88,7 +85,6 @@ func (fr *LBPHFaceRecognizer) Update(newImages []gocv.Mat, newLabels []int) {
//
// For further information, see:
// https://docs.opencv.org/master/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#aa2d2f02faffab1bf01317ae6502fb631
//
func (fr *LBPHFaceRecognizer) Predict(sample gocv.Mat) int {
label := C.LBPHFaceRecognizer_Predict(fr.p, (C.Mat)(sample.Ptr()))

Expand All @@ -101,7 +97,6 @@ func (fr *LBPHFaceRecognizer) Predict(sample gocv.Mat) int {
//
// For further information, see:
// https://docs.opencv.org/master/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#ab0d593e53ebd9a0f350c989fcac7f251
//
func (fr *LBPHFaceRecognizer) PredictExtendedResponse(sample gocv.Mat) PredictResponse {
respp := C.LBPHFaceRecognizer_PredictExtended(fr.p, (C.Mat)(sample.Ptr()))
resp := PredictResponse{
Expand All @@ -117,7 +112,6 @@ func (fr *LBPHFaceRecognizer) PredictExtendedResponse(sample gocv.Mat) PredictRe
//
// For further information, see:
// https://docs.opencv.org/master/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#a3182081e5f8023e658ad8ab96656dd63
//
func (fr *LBPHFaceRecognizer) SetThreshold(threshold float32) {
C.LBPHFaceRecognizer_SetThreshold(fr.p, (C.double)(threshold))
}
Expand All @@ -128,7 +122,6 @@ func (fr *LBPHFaceRecognizer) SetThreshold(threshold float32) {
//
// For further information, see:
// https://docs.opencv.org/master/df/d25/classcv_1_1face_1_1LBPHFaceRecognizer.html#ab225f7bf353ce8697a506eda10124a92
//
func (fr *LBPHFaceRecognizer) SetNeighbors(neighbors int) {
C.LBPHFaceRecognizer_SetNeighbors(fr.p, (C.int)(neighbors))
}
Expand All @@ -137,7 +130,6 @@ func (fr *LBPHFaceRecognizer) SetNeighbors(neighbors int) {
//
// For further information, see:
// https://docs.opencv.org/master/df/d25/classcv_1_1face_1_1LBPHFaceRecognizer.html#a50a3e2ca6e8464166e153c9df84b0a77
//
func (fr *LBPHFaceRecognizer) GetNeighbors() int {
n := C.LBPHFaceRecognizer_GetNeighbors(fr.p)

Expand All @@ -149,7 +141,6 @@ func (fr *LBPHFaceRecognizer) GetNeighbors() int {
//
// For further information, see:
// https://docs.opencv.org/master/df/d25/classcv_1_1face_1_1LBPHFaceRecognizer.html#a62d94c75cade902fd3b487b1ef9883fc
//
func (fr *LBPHFaceRecognizer) SetRadius(radius int) {
C.LBPHFaceRecognizer_SetRadius(fr.p, (C.int)(radius))
}
Expand All @@ -158,7 +149,6 @@ func (fr *LBPHFaceRecognizer) SetRadius(radius int) {
//
// For further information, see:
// https://docs.opencv.org/master/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#a2adf2d555550194244b05c91fefcb4d6
//
func (fr *LBPHFaceRecognizer) SaveFile(fname string) {
cName := C.CString(fname)
defer C.free(unsafe.Pointer(cName))
Expand All @@ -169,7 +159,6 @@ func (fr *LBPHFaceRecognizer) SaveFile(fname string) {
//
// For further information, see:
// https://docs.opencv.org/master/dd/d65/classcv_1_1face_1_1FaceRecognizer.html#acc42e5b04595dba71f0777c7179af8c3
//
func (fr *LBPHFaceRecognizer) LoadFile(fname string) {
cName := C.CString(fname)
defer C.free(unsafe.Pointer(cName))
Expand Down
18 changes: 0 additions & 18 deletions contrib/img_hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@ type ImgHashBase interface {
}

// PHash is implementation of the PHash algorithm.
//
type PHash struct{}

// Compute computes hash of the input image using PHash.
//
// For further information, see:
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#ae2d9288db370089dfd8aab85d5e0b0f3
//
func (hash PHash) Compute(input gocv.Mat, output *gocv.Mat) {
C.pHashCompute(C.Mat(input.Ptr()), C.Mat(output.Ptr()))
}
Expand All @@ -31,20 +29,17 @@ func (hash PHash) Compute(input gocv.Mat, output *gocv.Mat) {
//
// For further information, see:
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#a444a3e9ec792cf029385809393f84ad5
//
func (hash PHash) Compare(a, b gocv.Mat) float64 {
return float64(C.pHashCompare(C.Mat(a.Ptr()), C.Mat(b.Ptr())))
}

// AverageHash is implementation of the AverageHash algorithm.
//
type AverageHash struct{}

// Compute computes hash of the input image using AverageHash.
//
// For further information, see:
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#ae2d9288db370089dfd8aab85d5e0b0f3
//
func (hash AverageHash) Compute(input gocv.Mat, output *gocv.Mat) {
C.averageHashCompute(C.Mat(input.Ptr()), C.Mat(output.Ptr()))
}
Expand All @@ -53,13 +48,11 @@ func (hash AverageHash) Compute(input gocv.Mat, output *gocv.Mat) {
//
// For further information, see:
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#a444a3e9ec792cf029385809393f84ad5
//
func (hash AverageHash) Compare(a, b gocv.Mat) float64 {
return float64(C.averageHashCompare(C.Mat(a.Ptr()), C.Mat(b.Ptr())))
}

// BlockMeanHash is implementation of the BlockMeanHash algorithm.
//
type BlockMeanHash struct {
Mode BlockMeanHashMode
}
Expand All @@ -76,7 +69,6 @@ const (
//
// For further information, see:
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#ae2d9288db370089dfd8aab85d5e0b0f3
//
func (hash BlockMeanHash) Compute(input gocv.Mat, output *gocv.Mat) {
C.blockMeanHashCompute(C.Mat(input.Ptr()), C.Mat(output.Ptr()), C.int(hash.Mode))
}
Expand All @@ -85,7 +77,6 @@ func (hash BlockMeanHash) Compute(input gocv.Mat, output *gocv.Mat) {
//
// For further information, see:
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#a444a3e9ec792cf029385809393f84ad5
//
func (hash BlockMeanHash) Compare(a, b gocv.Mat) float64 {
return float64(C.blockMeanHashCompare(C.Mat(a.Ptr()), C.Mat(b.Ptr()), C.int(hash.Mode)))
}
Expand All @@ -94,14 +85,12 @@ func (hash BlockMeanHash) Compare(a, b gocv.Mat) float64 {
// call to Compute, and there's no easy way to keep it.

// ColorMomentHash is implementation of the ColorMomentHash algorithm.
//
type ColorMomentHash struct{}

// Compute computes hash of the input image using ColorMomentHash.
//
// For further information, see:
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#ae2d9288db370089dfd8aab85d5e0b0f3
//
func (hash ColorMomentHash) Compute(input gocv.Mat, output *gocv.Mat) {
C.colorMomentHashCompute(C.Mat(input.Ptr()), C.Mat(output.Ptr()))
}
Expand All @@ -110,13 +99,11 @@ func (hash ColorMomentHash) Compute(input gocv.Mat, output *gocv.Mat) {
//
// For further information, see:
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#a444a3e9ec792cf029385809393f84ad5
//
func (hash ColorMomentHash) Compare(a, b gocv.Mat) float64 {
return float64(C.colorMomentHashCompare(C.Mat(a.Ptr()), C.Mat(b.Ptr())))
}

// MarrHildrethHash is implementation of the MarrHildrethHash algorithm.
//
type MarrHildrethHash struct {
Alpha float32
Scale float32
Expand All @@ -130,7 +117,6 @@ func NewMarrHildrethHash() MarrHildrethHash {
//
// For further information, see:
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#ae2d9288db370089dfd8aab85d5e0b0f3
//
func (hash MarrHildrethHash) Compute(input gocv.Mat, output *gocv.Mat) {
C.marrHildrethHashCompute(C.Mat(input.Ptr()), C.Mat(output.Ptr()),
C.float(hash.Alpha), C.float(hash.Scale))
Expand All @@ -140,14 +126,12 @@ func (hash MarrHildrethHash) Compute(input gocv.Mat, output *gocv.Mat) {
//
// For further information, see:
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#a444a3e9ec792cf029385809393f84ad5
//
func (hash MarrHildrethHash) Compare(a, b gocv.Mat) float64 {
return float64(C.marrHildrethHashCompare(C.Mat(a.Ptr()), C.Mat(b.Ptr()),
C.float(hash.Alpha), C.float(hash.Scale)))
}

// RadialVarianceHash is implementation of the RadialVarianceHash algorithm.
//
type RadialVarianceHash struct {
Sigma float64
NumOfAngleLine int
Expand All @@ -161,7 +145,6 @@ func NewRadialVarianceHash() RadialVarianceHash {
//
// For further information, see:
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#ae2d9288db370089dfd8aab85d5e0b0f3
//
func (hash RadialVarianceHash) Compute(input gocv.Mat, output *gocv.Mat) {
C.radialVarianceHashCompute(C.Mat(input.Ptr()), C.Mat(output.Ptr()),
C.double(hash.Sigma), C.int(hash.NumOfAngleLine))
Expand All @@ -171,7 +154,6 @@ func (hash RadialVarianceHash) Compute(input gocv.Mat, output *gocv.Mat) {
//
// For further information, see:
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#a444a3e9ec792cf029385809393f84ad5
//
func (hash RadialVarianceHash) Compare(a, b gocv.Mat) float64 {
return float64(C.radialVarianceHashCompare(C.Mat(a.Ptr()), C.Mat(b.Ptr()),
C.double(hash.Sigma), C.int(hash.NumOfAngleLine)))
Expand Down
2 changes: 0 additions & 2 deletions contrib/tracking.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
//
// For further details, please see:
// https://docs.opencv.org/master/d2/dff/classcv_1_1TrackerKCF.html
//
type TrackerKCF struct {
p C.TrackerKCF
}
Expand Down Expand Up @@ -47,7 +46,6 @@ func (trk TrackerKCF) Update(img gocv.Mat) (image.Rectangle, bool) {
//
// For further details, please see:
// https://docs.opencv.org/master/d2/da2/classcv_1_1TrackerCSRT.html
//
type TrackerCSRT struct {
p C.TrackerCSRT
}
Expand Down
3 changes: 0 additions & 3 deletions contrib/xfeatures2d.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ type SURF struct {
//
// For further details, please see:
// https://docs.opencv.org/master/d5/df7/classcv_1_1xfeatures2d_1_1SURF.html
//
func NewSURF() SURF {
return SURF{p: unsafe.Pointer(C.SURF_Create())}
}
Expand All @@ -41,7 +40,6 @@ func (d *SURF) Close() error {
//
// For further details, please see:
// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887
//
func (d *SURF) Detect(src gocv.Mat) []gocv.KeyPoint {
ret := C.SURF_Detect((C.SURF)(d.p), C.Mat(src.Ptr()))

Expand All @@ -52,7 +50,6 @@ func (d *SURF) Detect(src gocv.Mat) []gocv.KeyPoint {
//
// For further details, please see:
// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#a8be0d1c20b08eb867184b8d74c15a677
//
func (d *SURF) DetectAndCompute(src gocv.Mat, mask gocv.Mat) ([]gocv.KeyPoint, gocv.Mat) {
desc := gocv.NewMat()
ret := C.SURF_DetectAndCompute((C.SURF)(d.p), C.Mat(src.Ptr()), C.Mat(mask.Ptr()),
Expand Down
Loading

0 comments on commit f3641a8

Please sign in to comment.