From d624e2c00ef9af227bffa4a9661ea31234d4868c Mon Sep 17 00:00:00 2001 From: mh-cbon Date: Sun, 8 Dec 2019 14:46:32 +0100 Subject: [PATCH] add String method (#552) * all: add String() method for improved log output --- .gitignore | 1 + calib3d_string.go | 27 +++ codecov.yml | 3 + contrib/img_hash_string.go | 11 ++ core_string.go | 211 ++++++++++++++++++++++ cuda/cudawarping_string.go | 39 ++++ dnn_string.go | 35 ++++ features2d_string.go | 33 ++++ highgui_string.go | 35 ++++ imgproc_colorcodes_string.go | 303 +++++++++++++++++++++++++++++++ imgproc_string.go | 333 +++++++++++++++++++++++++++++++++++ videoio_string.go | 85 +++++++++ 12 files changed, 1116 insertions(+) create mode 100644 calib3d_string.go create mode 100644 codecov.yml create mode 100644 contrib/img_hash_string.go create mode 100644 core_string.go create mode 100644 cuda/cudawarping_string.go create mode 100644 dnn_string.go create mode 100644 features2d_string.go create mode 100644 highgui_string.go create mode 100644 imgproc_colorcodes_string.go create mode 100644 imgproc_string.go create mode 100644 videoio_string.go diff --git a/.gitignore b/.gitignore index 9e3a6e05..7549fff4 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ count.out .vscode/ /build .idea/ +contrib/data.yaml diff --git a/calib3d_string.go b/calib3d_string.go new file mode 100644 index 00000000..baa54513 --- /dev/null +++ b/calib3d_string.go @@ -0,0 +1,27 @@ +package gocv + +func (c CalibFlag) String() string { + switch c { + case CalibUseIntrinsicGuess: + return "calib-use-intrinsec-guess" + case CalibRecomputeExtrinsic: + return "calib-recompute-extrinsic" + case CalibCheckCond: + return "calib-check-cond" + case CalibFixSkew: + return "calib-fix-skew" + case CalibFixK1: + return "calib-fix-k1" + case CalibFixK2: + return "calib-fix-k2" + case CalibFixK3: + return "calib-fix-k3" + case CalibFixK4: + return "calib-fix-k4" + case CalibFixIntrinsic: + return "calib-fix-intrinsic" + case CalibFixPrincipalPoint: + return "calib-fix-principal-point" + } + return "" +} diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..f6086209 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,3 @@ +ignore: + - "*_string.go" + - "*/*_string.go" diff --git a/contrib/img_hash_string.go b/contrib/img_hash_string.go new file mode 100644 index 00000000..9b3219ac --- /dev/null +++ b/contrib/img_hash_string.go @@ -0,0 +1,11 @@ +package contrib + +func (c BlockMeanHashMode) String() string { + switch c { + case BlockMeanHashMode0: + return "block-mean-hash-mode0" + case BlockMeanHashMode1: + return "block-mean-hash-mode1" + } + return "" +} diff --git a/core_string.go b/core_string.go new file mode 100644 index 00000000..39d5d22b --- /dev/null +++ b/core_string.go @@ -0,0 +1,211 @@ +package gocv + +func (c MatType) String() string { + switch c { + case MatTypeCV8U: + return "CV8U" + case MatTypeCV8UC2: + return "CV8UC2" + case MatTypeCV8UC3: + return "CV8UC3" + case MatTypeCV8UC4: + return "CV8UC4" + case MatTypeCV16U: + return "CV16U" + case MatTypeCV16UC2: + return "CV16UC2" + case MatTypeCV16UC3: + return "CV16UC3" + case MatTypeCV16UC4: + return "CV16UC4" + case MatTypeCV16S: + return "CV16S" + case MatTypeCV16SC2: + return "CV16SC2" + case MatTypeCV16SC3: + return "CV16SC3" + case MatTypeCV16SC4: + return "CV16SC4" + case MatTypeCV32S: + return "CV32S" + case MatTypeCV32SC2: + return "CV32SC2" + case MatTypeCV32SC3: + return "CV32SC3" + case MatTypeCV32SC4: + return "CV32SC4" + case MatTypeCV32F: + return "CV32F" + case MatTypeCV32FC2: + return "CV32FC2" + case MatTypeCV32FC3: + return "CV32FC3" + case MatTypeCV32FC4: + return "CV32FC4" + case MatTypeCV64F: + return "CV64F" + case MatTypeCV64FC2: + return "CV64FC2" + case MatTypeCV64FC3: + return "CV64FC3" + case MatTypeCV64FC4: + return "CV64FC4" + } + return "" +} + +func (c CompareType) String() string { + switch c { + case CompareEQ: + return "eq" + case CompareGT: + return "gt" + case CompareGE: + return "ge" + case CompareLT: + return "lt" + case CompareLE: + return "le" + case CompareNE: + return "ne" + } + return "" +} + +func (c CovarFlags) String() string { + switch c { + case CovarScrambled: + return "covar-scrambled" + case CovarNormal: + return "covar-normal" + case CovarUseAvg: + return "covar-use-avg" + case CovarScale: + return "covar-scale" + case CovarRows: + return "covar-rows" + case CovarCols: + return "covar-cols" + } + return "" +} + +func (c DftFlags) String() string { + switch c { + case DftForward: + return "dft-forward" + case DftInverse: + return "dft-inverse" + case DftScale: + return "dft-scale" + case DftRows: + return "dft-rows" + case DftComplexOutput: + return "dft-complex-output" + case DftRealOutput: + return "dft-real-output" + case DftComplexInput: + return "dft-complex-input" + } + return "" +} + +func (c RotateFlag) String() string { + switch c { + case Rotate90Clockwise: + return "rotate-90-clockwise" + case Rotate180Clockwise: + return "rotate-180-clockwise" + case Rotate90CounterClockwise: + return "rotate-90-counter-clockwise" + } + return "" +} + +func (c KMeansFlags) String() string { + switch c { + case KMeansRandomCenters: + return "kmeans-random-centers" + case KMeansPPCenters: + return "kmeans-pp-centers" + case KMeansUseInitialLabels: + return "kmeans-use-initial-labels" + } + return "" +} + +func (c NormType) String() string { + switch c { + case NormInf: + return "norm-inf" + case NormL1: + return "norm-l1" + case NormL2: + return "norm-l2" + case NormL2Sqr: + return "norm-l2-sqr" + case NormHamming: + return "norm-hamming" + case NormHamming2: + return "norm-hamming2" + case NormRelative: + return "norm-relative" + case NormMinMax: + return "norm-minmax" + } + return "" +} + +func (c TermCriteriaType) String() string { + switch c { + case Count: + return "count" + case EPS: + return "eps" + } + return "" +} + +func (c SolveDecompositionFlags) String() string { + switch c { + case SolveDecompositionLu: + return "solve-decomposition-lu" + case SolveDecompositionSvd: + return "solve-decomposition-svd" + case SolveDecompositionEing: + return "solve-decomposition-eing" + case SolveDecompositionCholesky: + return "solve-decomposition-cholesky" + case SolveDecompositionQr: + return "solve-decomposition-qr" + case SolveDecompositionNormal: + return "solve-decomposition-normal" + } + return "" +} + +func (c ReduceTypes) String() string { + switch c { + case ReduceSum: + return "reduce-sum" + case ReduceAvg: + return "reduce-avg" + case ReduceMax: + return "reduce-max" + case ReduceMin: + return "reduce-min" + } + return "" +} + +func (c SortFlags) String() string { + switch c { + case SortEveryRow: + return "sort-every-row" + case SortEveryColumn: + return "sort-every-column" + case SortDescending: + return "sort-descending" + } + return "" +} diff --git a/cuda/cudawarping_string.go b/cuda/cudawarping_string.go new file mode 100644 index 00000000..c3904dd1 --- /dev/null +++ b/cuda/cudawarping_string.go @@ -0,0 +1,39 @@ +package cuda + +func (c InterpolationFlags) String() string { + switch c { + case InterpolationNearestNeighbor: + return "interpolation-nearest-neighbor" + case InterpolationLinear: + return "interpolation-linear" + case InterpolationCubic: + return "interpolation-cubic" + case InterpolationArea: + return "interpolation-area" + case InterpolationLanczos4: + return "interpolation-lanczos4" + case InterpolationMax: + return "interpolation-max" + } + return "" +} + +func (c BorderType) String() string { + switch c { + case BorderConstant: + return "border-constant" + case BorderReplicate: + return "border-replicate" + case BorderWrap: + return "border-wrap" + case BorderReflect101: + return "border-reflect101" + case BorderTransparent: + return "border-transparent" + case BorderDefault: + return "border-default" + case BorderIsolated: + return "border-isolated" + } + return "" +} diff --git a/dnn_string.go b/dnn_string.go new file mode 100644 index 00000000..ac42d8d8 --- /dev/null +++ b/dnn_string.go @@ -0,0 +1,35 @@ +package gocv + +func (c NetBackendType) String() string { + switch c { + case NetBackendDefault: + return "" + case NetBackendHalide: + return "halide" + case NetBackendOpenVINO: + return "openvino" + case NetBackendOpenCV: + return "opencv" + case NetBackendVKCOM: + return "vulkan" + } + return "" +} + +func (c NetTargetType) String() string { + switch c { + case NetTargetCPU: + return "cpu" + case NetTargetFP32: + return "fp32" + case NetTargetFP16: + return "fp16" + case NetTargetVPU: + return "vpu" + case NetTargetVulkan: + return "vulkan" + case NetTargetFPGA: + return "fpga" + } + return "" +} diff --git a/features2d_string.go b/features2d_string.go new file mode 100644 index 00000000..21637c6e --- /dev/null +++ b/features2d_string.go @@ -0,0 +1,33 @@ +package gocv + +/* +#include +#include "features2d.h" +*/ +import "C" + +func (c FastFeatureDetectorType) String() string { + switch c { + case FastFeatureDetectorType58: + return "fast-feature-detector-type-58" + case FastFeatureDetectorType712: + return "fast-feature-detector-type-712" + case FastFeatureDetectorType916: + return "fast-feature-detector-type-916" + } + return "" +} + +func (c DrawMatchesFlag) String() string { + switch c { + case DrawDefault: + return "draw-default" + case DrawOverOutImg: + return "draw-over-out-imt" + case NotDrawSinglePoints: + return "draw-single-points" + case DrawRichKeyPoints: + return "draw-rich-key-points" + } + return "" +} diff --git a/highgui_string.go b/highgui_string.go new file mode 100644 index 00000000..d073bbe2 --- /dev/null +++ b/highgui_string.go @@ -0,0 +1,35 @@ +package gocv + +/* +#include +#include "highgui_gocv.h" +*/ +import "C" + +func (c WindowFlag) String() string { + switch c { + case WindowNormal: + return "window-normal" + case WindowFullscreen: + return "window-fullscreen" + case WindowFreeRatio: + return "window-free-ratio" + } + return "" +} + +func (c WindowPropertyFlag) String() string { + switch c { + case WindowPropertyFullscreen: + return "window-property-fullscreen" + case WindowPropertyAutosize: + return "window-property-autosize" + case WindowPropertyAspectRatio: + return "window-property-aspect-ratio" + case WindowPropertyOpenGL: + return "window-property-opengl" + case WindowPropertyVisible: + return "window-property-visible" + } + return "" +} diff --git a/imgproc_colorcodes_string.go b/imgproc_colorcodes_string.go new file mode 100644 index 00000000..ac226efa --- /dev/null +++ b/imgproc_colorcodes_string.go @@ -0,0 +1,303 @@ +package gocv + +func (c ColorConversionCode) String() string { + switch c { + case ColorBGRToBGRA: + return "color-bgr-to-bgra" + case ColorBGRAToBGR: + return "color-bgra-to-bgr" + case ColorBGRToRGBA: + return "color-bgr-to-rgba" + case ColorRGBAToBGR: + return "color-rgba-to-bgr" + case ColorBGRToRGB: + return "color-bgr-to-rgb" + case ColorBGRAToRGBA: + return "color-bgra-to-rgba" + case ColorBGRToGray: + return "color-bgr-to-gray" + case ColorRGBToGray: + return "color-rgb-to-gray" + case ColorGrayToBGR: + return "color-gray-to-bgr" + case ColorGrayToBGRA: + return "color-gray-to-bgra" + case ColorBGRAToGray: + return "color-bgra-to-gray" + case ColorRGBAToGray: + return "color-rgba-to-gray" + case ColorBGRToBGR565: + return "color-bgr-to-bgr565" + case ColorRGBToBGR565: + return "color-rgb-to-bgr565" + case ColorBGR565ToBGR: + return "color-bgr565-to-bgr" + case ColorBGR565ToRGB: + return "color-bgr565-to-rgb" + case ColorBGRAToBGR565: + return "color-bgra-to-bgr565" + case ColorRGBAToBGR565: + return "color-rgba-to-bgr565" + case ColorBGR565ToBGRA: + return "color-bgr565-to-bgra" + case ColorBGR565ToRGBA: + return "color-bgr565-to-rgba" + case ColorGrayToBGR565: + return "color-gray-to-bgr565" + case ColorBGR565ToGray: + return "color-bgr565-to-gray" + case ColorBGRToBGR555: + return "color-bgr-to-bgr555" + case ColorRGBToBGR555: + return "color-rgb-to-bgr555" + case ColorBGR555ToBGR: + return "color-bgr555-to-bgr" + case ColorBGRAToBGR555: + return "color-bgra-to-bgr555" + case ColorRGBAToBGR555: + return "color-rgba-to-bgr555" + case ColorBGR555ToBGRA: + return "color-bgr555-to-bgra" + case ColorBGR555ToRGBA: + return "color-bgr555-to-rgba" + case ColorGrayToBGR555: + return "color-gray-to-bgr555" + case ColorBGR555ToGRAY: + return "color-bgr555-to-gray" + case ColorBGRToXYZ: + return "color-bgr-to-xyz" + case ColorRGBToXYZ: + return "color-rgb-to-xyz" + case ColorXYZToBGR: + return "color-xyz-to-bgr" + case ColorXYZToRGB: + return "color-xyz-to-rgb" + case ColorBGRToYCrCb: + return "color-bgr-to-ycrcb" + case ColorRGBToYCrCb: + return "color-rgb-to-ycrcb" + case ColorYCrCbToBGR: + return "color-ycrcb-to-bgr" + case ColorYCrCbToRGB: + return "color-ycrcb-to-rgb" + case ColorBGRToHSV: + return "color-bgr-to-hsv" + case ColorRGBToHSV: + return "color-rgb-to-hsv" + case ColorBGRToLab: + return "color-bgr-to-lab" + case ColorRGBToLab: + return "color-rgb-to-lab" + case ColorBGRToLuv: + return "color-bgr-to-luv" + case ColorRGBToLuv: + return "color-rgb-to-luv" + case ColorBGRToHLS: + return "color-bgr-to-hls" + case ColorRGBToHLS: + return "color-rgb-to-hls" + case ColorHSVToBGR: + return "color-hsv-to-bgr" + case ColorHSVToRGB: + return "color-hsv-to-rgb" + case ColorLabToBGR: + return "color-lab-to-bgr" + case ColorLabToRGB: + return "color-lab-to-rgb" + case ColorLuvToBGR: + return "color-luv-to-bgr" + case ColorLuvToRGB: + return "color-luv-to-rgb" + case ColorHLSToBGR: + return "color-hls-to-bgr" + case ColorHLSToRGB: + return "color-hls-to-rgb" + case ColorBGRToHSVFull: + return "color-bgr-to-hsv-full" + case ColorRGBToHSVFull: + return "color-rgb-to-hsv-full" + case ColorBGRToHLSFull: + return "color-bgr-to-hls-full" + case ColorRGBToHLSFull: + return "color-rgb-to-hls-full" + case ColorHSVToBGRFull: + return "color-hsv-to-bgr-full" + case ColorHSVToRGBFull: + return "color-hsv-to-rgb-full" + case ColorHLSToBGRFull: + return "color-hls-to-bgr-full" + case ColorHLSToRGBFull: + return "color-hls-to-rgb-full" + case ColorLBGRToLab: + return "color-lbgr-to-lab" + case ColorLRGBToLab: + return "color-lrgb-to-lab" + case ColorLBGRToLuv: + return "color-lbgr-to-luv" + case ColorLRGBToLuv: + return "color-lrgb-to-luv" + case ColorLabToLBGR: + return "color-lab-to-lbgr" + case ColorLabToLRGB: + return "color-lab-to-lrgb" + case ColorLuvToLBGR: + return "color-luv-to-lbgr" + case ColorLuvToLRGB: + return "color-luv-to-lrgb" + case ColorBGRToYUV: + return "color-bgr-to-yuv" + case ColorRGBToYUV: + return "color-rgb-to-yuv" + case ColorYUVToBGR: + return "color-yuv-to-bgr" + case ColorYUVToRGB: + return "color-yuv-to-rgb" + + case ColorYUVToRGBNV12: + return "color-yuv-to-rgbnv12" + case ColorYUVToBGRNV12: + return "color-yuv-to-bgrnv12" + case ColorYUVToRGBNV21: + return "color-yuv-to-rgbnv21" + case ColorYUVToBGRNV21: + return "color-yuv-to-bgrnv21" + + case ColorYUVToRGBANV12: + return "color-yuv-to-rgbanv12" + case ColorYUVToBGRANV12: + return "color-yuv-to-bgranv12" + case ColorYUVToRGBANV21: + return "color-yuv-to-rgbanv21" + case ColorYUVToBGRANV21: + return "color-yuv-to-bgranv21" + + case ColorYUVToRGBYV12: + return "color-yuv-to-rgbyv12" + case ColorYUVToBGRYV12: + return "color-yuv-to-bgryv12" + + case ColorYUVToRGBIYUV: + return "color-yuv-to-rgbiyuv" + case ColorYUVToBGRIYUV: + return "color-yuv-to-bgriyuv" + + case ColorYUVToRGBAYV12: + return "color-yuv-to-rgbayv12" + case ColorYUVToBGRAYV12: + return "color-yuv-to-bgrayv12" + case ColorYUVToRGBAIYUV: + return "color-yuv-to-rgbaiyuv" + case ColorYUVToBGRAIYUV: + return "color-yuv-to-bgraiyuv" + + case ColorYUVToGRAY420: + return "color-yuv-to-gray420" + + case ColorYUVToRGBUYVY: + return "color-yuv-to-rgbuyvy" + case ColorYUVToBGRUYVY: + return "color-yuv-to-bgruyvy" + + case ColorYUVToRGBAUYVY: + return "color-yuv-to-rgbauyvy" + case ColorYUVToBGRAUYVY: + return "color-yuv-to-bgrauyvy" + + case ColorYUVToRGBYUY2: + return "color-yuv-to-rgbyuy2" + case ColorYUVToBGRYUY2: + return "color-yuv-to-bgryuy2" + + case ColorYUVToRGBYVYU: + return "color-yuv-to-rgbyvyu" + case ColorYUVToBGRYVYU: + return "color-yuv-to-bgryvyu" + + case ColorYUVToRGBAYUY2: + return "color-yuv-to-rgbayuy2" + case ColorYUVToBGRAYUY2: + return "color-yuv-to-bgrayuy2" + + case ColorYUVToRGBAYVYU: + return "color-yuv-to-rgbayvyu" + case ColorYUVToBGRAYVYU: + return "color-yuv-to-bgrayvyu" + + case ColorYUVToGRAYUYVY: + return "color-yuv-to-grayuyvy" + case ColorYUVToGRAYYUY2: + return "color-yuv-to-grayyuy2" + + case ColorRGBATomRGBA: + return "color-rgba-to-mrgba" + case ColormRGBAToRGBA: + return "color-mrgba-to-rgba" + + case ColorRGBToYUVI420: + return "color-rgb-to-yuvi420" + case ColorBGRToYUVI420: + return "color-bgr-to-yuvi420" + + case ColorRGBAToYUVI420: + return "color-rgba-to-yuvi420" + + case ColorBGRAToYUVI420: + return "color-bgra-to-yuvi420" + case ColorRGBToYUVYV12: + return "color-rgb-to-yuvyv12" + case ColorBGRToYUVYV12: + return "color-bgr-to-yuvyv12" + case ColorRGBAToYUVYV12: + return "color-rgba-to-yuvyv12" + case ColorBGRAToYUVYV12: + return "color-bgra-to-yuvyv12" + + case ColorBayerBGToBGR: + return "color-bayer-bgt-to-bgr" + case ColorBayerGBToBGR: + return "color-bayer-gbt-to-bgr" + case ColorBayerRGToBGR: + return "color-bayer-rgt-to-bgr" + case ColorBayerGRToBGR: + return "color-bayer-grt-to-bgr" + + case ColorBayerBGToGRAY: + return "color-bayer-bgt-to-gray" + case ColorBayerGBToGRAY: + return "color-bayer-gbt-to-gray" + case ColorBayerRGToGRAY: + return "color-bayer-rgt-to-gray" + case ColorBayerGRToGRAY: + return "color-bayer-grt-to-gray" + + case ColorBayerBGToBGRVNG: + return "color-bayer-bgt-to-bgrvng" + case ColorBayerGBToBGRVNG: + return "color-bayer-gbt-to-bgrvng" + case ColorBayerRGToBGRVNG: + return "color-bayer-rgt-to-bgrvng" + case ColorBayerGRToBGRVNG: + return "color-bayer-grt-to-bgrvng" + + case ColorBayerBGToBGREA: + return "color-bayer-bgt-to-bgrea" + case ColorBayerGBToBGREA: + return "color-bayer-gbt-to-bgrea" + case ColorBayerRGToBGREA: + return "color-bayer-rgt-to-bgrea" + case ColorBayerGRToBGREA: + return "color-bayer-grt-to-bgrea" + + case ColorBayerBGToBGRA: + return "color-bayer-bgt-to-bgra" + case ColorBayerGBToBGRA: + return "color-bayer-gbt-to-bgra" + case ColorBayerRGToBGRA: + return "color-bayer-rgt-to-bgra" + case ColorBayerGRToBGRA: + return "color-bayer-grt-to-bgra" + case ColorCOLORCVTMAX: + return "color-color-cvt-max" + } + return "" +} diff --git a/imgproc_string.go b/imgproc_string.go new file mode 100644 index 00000000..589c7cb8 --- /dev/null +++ b/imgproc_string.go @@ -0,0 +1,333 @@ +package gocv + +func (c HistCompMethod) String() string { + switch c { + case HistCmpCorrel: + return "hist-cmp-correl" + case HistCmpChiSqr: + return "hist-cmp-chi-sqr" + case HistCmpIntersect: + return "hist-cmp-intersect" + case HistCmpBhattacharya: + return "hist-cmp-bhattacharya" + case HistCmpChiSqrAlt: + return "hist-cmp-chi-sqr-alt" + case HistCmpKlDiv: + return "hist-cmp-kl-div" + } + return "" +} + +func (c DistanceTransformLabelTypes) String() string { + switch c { + case DistanceLabelCComp: + return "distance-label-ccomp" + } + return "" +} + +func (c DistanceTransformMasks) String() string { + switch c { + case DistanceMask3: + return "distance-mask3" + } + return "" +} + +func (c RetrievalMode) String() string { + switch c { + case RetrievalExternal: + return "retrieval-external" + case RetrievalList: + return "retrieval-list" + case RetrievalCComp: + return "retrieval-ccomp" + case RetrievalTree: + return "retrieval-tree" + case RetrievalFloodfill: + return "retrieval-floodfill" + } + return "" +} + +func (c ContourApproximationMode) String() string { + switch c { + case ChainApproxNone: + return "chain-approx-none" + case ChainApproxSimple: + return "chain-approx-simple" + case ChainApproxTC89L1: + return "chain-approx-tc89l1" + case ChainApproxTC89KCOS: + return "chain-approx-tc89kcos" + } + return "" +} + +func (c ConnectedComponentsAlgorithmType) String() string { + switch c { + case CCL_WU: + return "ccl-wu" + case CCL_DEFAULT: + return "ccl-default" + case CCL_GRANA: + return "ccl-grana" + } + return "" +} + +func (c ConnectedComponentsTypes) String() string { + switch c { + case CC_STAT_LEFT: + return "cc-stat-left" + case CC_STAT_TOP: + return "cc-stat-top" + case CC_STAT_WIDTH: + return "cc-stat-width" + case CC_STAT_AREA: + return "cc-stat-area" + case CC_STAT_MAX: + return "cc-stat-max" + case CC_STAT_HEIGHT: + return "cc-stat-height" + } + return "" +} + +func (c TemplateMatchMode) String() string { + switch c { + case TmSqdiff: + return "tm-sq-diff" + case TmSqdiffNormed: + return "tm-sq-diff-normed" + case TmCcorr: + return "tm-ccorr" + case TmCcorrNormed: + return "tm-ccorr-normed" + case TmCcoeff: + return "tm-ccoeff" + case TmCcoeffNormed: + return "tm-ccoeff-normed" + } + return "" +} + +func (c MorphShape) String() string { + switch c { + case MorphRect: + return "morph-rect" + case MorphCross: + return "morph-cross" + case MorphEllipse: + return "morph-ellispe" + } + return "" +} + +func (c MorphType) String() string { + switch c { + case MorphErode: + return "morph-erode" + case MorphDilate: + return "morph-dilate" + case MorphOpen: + return "morph-open" + case MorphClose: + return "morph-close" + case MorphGradient: + return "morph-gradient" + case MorphTophat: + return "morph-tophat" + case MorphBlackhat: + return "morph-blackhat" + case MorphHitmiss: + return "morph-hitmiss" + } + return "" +} + +func (c BorderType) String() string { + switch c { + case BorderConstant: + return "border-constant" + case BorderReplicate: + return "border-replicate" + case BorderReflect: + return "border-reflect" + case BorderWrap: + return "border-wrap" + case BorderTransparent: + return "border-transparent" + case BorderDefault: + return "border-default" + case BorderIsolated: + return "border-isolated" + } + return "" +} + +func (c GrabCutMode) String() string { + switch c { + case GCInitWithRect: + return "gc-init-with-rect" + case GCInitWithMask: + return "gc-init-with-mask" + case GCEval: + return "gc-eval" + case GCEvalFreezeModel: + return "gc-eval-freeze-model" + } + return "" +} + +func (c HoughMode) String() string { + switch c { + case HoughStandard: + return "hough-standard" + case HoughProbabilistic: + return "hough-probabilistic" + case HoughMultiScale: + return "hough-multi-scale" + case HoughGradient: + return "hough-gradient" + } + return "" +} + +func (c ThresholdType) String() string { + switch c { + case ThresholdBinary: + return "threshold-binary" + case ThresholdBinaryInv: + return "threshold-binary-inv" + case ThresholdTrunc: + return "threshold-trunc" + case ThresholdToZero: + return "threshold-to-zero" + case ThresholdToZeroInv: + return "threshold-to-zero-inv" + case ThresholdMask: + return "threshold-mask" + case ThresholdOtsu: + return "threshold-otsu" + case ThresholdTriangle: + return "threshold-triangle" + } + return "" +} + +func (c AdaptiveThresholdType) String() string { + switch c { + case AdaptiveThresholdMean: + return "adaptative-threshold-mean" + case AdaptiveThresholdGaussian: + return "adaptative-threshold-gaussian" + } + return "" +} + +func (c HersheyFont) String() string { + switch c { + case FontHersheySimplex: + return "font-hershey-simplex" + case FontHersheyPlain: + return "font-hershey-plain" + case FontHersheyDuplex: + return "font-hershey-duplex" + case FontHersheyComplex: + return "font-hershey-complex" + case FontHersheyTriplex: + return "font-hershey-triplex" + case FontHersheyComplexSmall: + return "font-hershey-complex-small" + case FontHersheyScriptSimplex: + return "font-hershey-script-simplex" + case FontHersheyScriptComplex: + return "font-hershey-scipt-complex" + case FontItalic: + return "font-italic" + } + return "" +} + +func (c LineType) String() string { + switch c { + case Filled: + return "filled" + case Line4: + return "line4" + case Line8: + return "line8" + case LineAA: + return "line-aa" + } + return "" +} + +func (c InterpolationFlags) String() string { + switch c { + case InterpolationNearestNeighbor: + return "interpolation-nearest-neighbor" + case InterpolationLinear: + return "interpolation-linear" + case InterpolationCubic: + return "interpolation-cubic" + case InterpolationArea: + return "interpolation-area" + case InterpolationLanczos4: + return "interpolation-lanczos4" + case InterpolationMax: + return "interpolation-max" + } + return "" +} + +func (c ColormapTypes) String() string { + switch c { + case ColormapAutumn: + return "colormap-autumn" + case ColormapBone: + return "colormap-bone" + case ColormapJet: + return "colormap-jet" + case ColormapWinter: + return "colormap-winter" + case ColormapRainbow: + return "colormap-rainbow" + case ColormapOcean: + return "colormap-ocean" + case ColormapSummer: + return "colormap-summer" + case ColormapSpring: + return "colormap-spring" + case ColormapCool: + return "colormap-cool" + case ColormapHsv: + return "colormap-hsv" + case ColormapPink: + return "colormap-pink" + case ColormapParula: + return "colormap-parula" + } + return "" +} + +func (c DistanceTypes) String() string { + switch c { + case DistUser: + return "dist-user" + case DistL1: + return "dist-l1" + case DistL2: + return "dist-l2" + case DistL12: + return "dist-l12" + case DistFair: + return "dist-fair" + case DistWelsch: + return "dist-welsch" + case DistHuber: + return "dist-huber" + } + return "" +} diff --git a/videoio_string.go b/videoio_string.go new file mode 100644 index 00000000..b17d257a --- /dev/null +++ b/videoio_string.go @@ -0,0 +1,85 @@ +package gocv + +func (c VideoCaptureProperties) String() string { + switch c { + case VideoCapturePosMsec: + return "video-capture-pos-msec" + case VideoCapturePosFrames: + return "video-capture-pos-frames" + case VideoCapturePosAVIRatio: + return "video-capture-pos-avi-ratio" + case VideoCaptureFrameWidth: + return "video-capture-frame-width" + case VideoCaptureFrameHeight: + return "video-capture-frame-height" + case VideoCaptureFPS: + return "video-capture-fps" + case VideoCaptureFOURCC: + return "video-capture-fourcc" + case VideoCaptureFrameCount: + return "video-capture-frame-count" + case VideoCaptureFormat: + return "video-capture-format" + case VideoCaptureMode: + return "video-capture-mode" + case VideoCaptureBrightness: + return "video-capture-brightness" + case VideoCaptureContrast: + return "video-capture-contrast" + case VideoCaptureSaturation: + return "video-capture-saturation" + case VideoCaptureHue: + return "video-capture-hue" + case VideoCaptureGain: + return "video-capture-gain" + case VideoCaptureExposure: + return "video-capture-exposure" + case VideoCaptureConvertRGB: + return "video-capture-convert-rgb" + case VideoCaptureWhiteBalanceBlueU: + return "video-capture-white-balanced-blue-u" + case VideoCaptureWhiteBalanceRedV: + return "video-capture-white-balanced-red-v" + case VideoCaptureRectification: + return "video-capture-rectification" + case VideoCaptureMonochrome: + return "video-capture-monochrome" + case VideoCaptureSharpness: + return "video-capture-sharpness" + case VideoCaptureAutoExposure: + return "video-capture-auto-exposure" + case VideoCaptureGamma: + return "video-capture-gamma" + case VideoCaptureTemperature: + return "video-capture-temperature" + case VideoCaptureTrigger: + return "video-capture-trigger" + case VideoCaptureTriggerDelay: + return "video-capture-trigger-delay" + case VideoCaptureZoom: + return "video-capture-zoom" + case VideoCaptureFocus: + return "video-capture-focus" + case VideoCaptureGUID: + return "video-capture-guid" + case VideoCaptureISOSpeed: + return "video-capture-iso-speed" + case VideoCaptureBacklight: + return "video-capture-backlight" + case VideoCapturePan: + return "video-capture-pan" + case VideoCaptureTilt: + return "video-capture-tilt" + case VideoCaptureRoll: + return "video-capture-roll" + case VideoCaptureIris: + return "video-capture-iris" + case VideoCaptureSettings: + return "video-capture-settings" + case VideoCaptureBufferSize: + return "video-capture-buffer-size" + case VideoCaptureAutoFocus: + return "video-capture-auto-focus" + } + return "" +}