Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
13d446f194 | |||
9fb0843d80 | |||
b599a971d4 | |||
6a59f55f97 | |||
8e6b7edec9 |
136
build-docker.sh
136
build-docker.sh
@ -1,134 +1,50 @@
|
||||
#! /bin/bash
|
||||
|
||||
IMAGE_NAME=robocar-steering
|
||||
BINARY_NAME=rc-steering
|
||||
TAG=$(git describe)
|
||||
FULL_IMAGE_NAME=docker.io/cyrilix/${IMAGE_NAME}:${TAG}
|
||||
OPENCV_VERSION=4.6.0
|
||||
SRC_CMD=./cmd/$BINARY_NAME
|
||||
GOLANG_VERSION=1.21
|
||||
BINARY=rc-steering
|
||||
|
||||
GOTAGS="-tags netgo"
|
||||
|
||||
image_build(){
|
||||
local containerName=builder
|
||||
|
||||
GOPATH=/go
|
||||
|
||||
buildah from --name ${containerName} docker.io/cyrilix/opencv-buildstage:${OPENCV_VERSION}
|
||||
buildah config --label maintainer="Cyrille Nofficial" "${containerName}"
|
||||
|
||||
buildah copy --from=docker.io/library/golang:${GOLANG_VERSION} "${containerName}" /usr/local/go /usr/local/go
|
||||
buildah config --env GOPATH=/go \
|
||||
--env PATH=/usr/local/go/bin:$GOPATH/bin:/usr/local/go/bin:/usr/bin:/bin \
|
||||
"${containerName}"
|
||||
|
||||
buildah run \
|
||||
--env GOPATH=${GOPATH} \
|
||||
"${containerName}" \
|
||||
mkdir -p /src "$GOPATH/src" "$GOPATH/bin"
|
||||
|
||||
buildah run \
|
||||
--env GOPATH=${GOPATH} \
|
||||
"${containerName}" \
|
||||
chmod -R 777 "$GOPATH"
|
||||
local platform=$1
|
||||
|
||||
|
||||
buildah config --env PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig "${containerName}"
|
||||
buildah config --workingdir /src/ "${containerName}"
|
||||
GOOS=$(echo $platform | cut -f1 -d/) && \
|
||||
GOARCH=$(echo $platform | cut -f2 -d/) && \
|
||||
GOARM=$(echo $platform | cut -f3 -d/ | sed "s/v//" )
|
||||
VARIANT="--variant $(echo $platform | cut -f3 -d/ )"
|
||||
if [[ -z "$GOARM" ]] ;
|
||||
then
|
||||
VARIANT=""
|
||||
fi
|
||||
|
||||
buildah add "${containerName}" . .
|
||||
local binary_suffix="$GOARCH$(echo $platform | cut -f3 -d/ )"
|
||||
|
||||
for platform in "linux/amd64" "linux/arm64" "linux/arm/v7"
|
||||
do
|
||||
local containerName="$IMAGE_NAME-$GOARCH$GOARM"
|
||||
|
||||
GOOS=$(echo "$platform" | cut -f1 -d/) && \
|
||||
GOARCH=$(echo "$platform" | cut -f2 -d/) && \
|
||||
GOARM=$(echo "$platform" | cut -f3 -d/ | sed "s/v//" )
|
||||
|
||||
case $GOARCH in
|
||||
"amd64")
|
||||
ARCH=amd64
|
||||
ARCH_LIB_DIR=/usr/lib/x86_64-linux-gnu
|
||||
EXTRA_LIBS=""
|
||||
CC=gcc
|
||||
CXX=g++
|
||||
;;
|
||||
"arm64")
|
||||
ARCH=arm64
|
||||
ARCH_LIB_DIR=/usr/lib/aarch64-linux-gnu
|
||||
EXTRA_LIBS="-ltbb"
|
||||
CC=aarch64-linux-gnu-gcc
|
||||
CXX=aarch64-linux-gnu-g++
|
||||
;;
|
||||
"arm")
|
||||
ARCH=armhf
|
||||
ARCH_LIB_DIR=/usr/lib/arm-linux-gnueabihf
|
||||
EXTRA_LIBS="-ltbb"
|
||||
CC=arm-linux-gnueabihf-gcc
|
||||
CXX=arm-linux-gnueabihf-g++
|
||||
;;
|
||||
esac
|
||||
printf "\n\nBuild go binary %s\n\n" "${BINARY}.${binary_suffix}"
|
||||
mkdir -p build
|
||||
CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} go build -mod vendor -a ${GOTAGS} -o "build/${BINARY}.${binary_suffix}" ./cmd/${BINARY}/
|
||||
|
||||
printf "Build binary for %s\n\n" "${platform}"
|
||||
buildah --os "$GOOS" --arch "$GOARCH" $VARIANT --name "$containerName" from gcr.io/distroless/static
|
||||
buildah config --user 1234 "$containerName"
|
||||
buildah copy "$containerName" "build/${BINARY}.${binary_suffix}" /bin/$BINARY
|
||||
buildah config --entrypoint '["/bin/'$BINARY'"]' "${containerName}"
|
||||
|
||||
buildah run \
|
||||
--env CGO_ENABLED=1 \
|
||||
--env CC=${CC} \
|
||||
--env CXX=${CXX} \
|
||||
--env GOOS=${GOOS} \
|
||||
--env GOARCH=${GOARCH} \
|
||||
--env GOARM=${GOARM} \
|
||||
--env CGO_CPPFLAGS="-I/opt/opencv/${ARCH}/include/opencv4/" \
|
||||
--env CGO_LDFLAGS="-L/opt/opencv/${ARCH}/lib -L${ARCH_LIB_DIR} ${EXTRA_LIBS} -lopencv_core -lopencv_face -lopencv_videoio -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs -lopencv_objdetect -lopencv_features2d -lopencv_video -lopencv_dnn -lopencv_xfeatures2d -lopencv_calib3d -lopencv_photo -lopencv_flann" \
|
||||
--env CGO_CXXFLAGS="--std=c++1z" \
|
||||
"${containerName}" \
|
||||
go build -tags customenv -a -o ${BINARY_NAME}.${ARCH} ${SRC_CMD}
|
||||
|
||||
done
|
||||
buildah commit --rm ${containerName} ${IMAGE_NAME}-builder
|
||||
}
|
||||
|
||||
image_final(){
|
||||
local containerName=runtime
|
||||
|
||||
for platform in "linux/amd64" "linux/arm64" "linux/arm/v7"
|
||||
do
|
||||
|
||||
GOOS=$(echo $platform | cut -f1 -d/) && \
|
||||
GOARCH=$(echo $platform | cut -f2 -d/) && \
|
||||
GOARM=$(echo $platform | cut -f3 -d/ | sed "s/v//" )
|
||||
VARIANT="--variant $(echo $platform | cut -f3 -d/ )"
|
||||
|
||||
if [[ -z "$GOARM" ]] ;
|
||||
then
|
||||
VARIANT=""
|
||||
fi
|
||||
|
||||
if [[ "${GOARCH}" == "arm" ]]
|
||||
then
|
||||
BINARY="${BINARY_NAME}.armhf"
|
||||
else
|
||||
BINARY="${BINARY_NAME}.${GOARCH}"
|
||||
fi
|
||||
|
||||
buildah from --name "${containerName}" --os "${GOOS}" --arch "${GOARCH}" ${VARIANT} docker.io/cyrilix/opencv-runtime:${OPENCV_VERSION}
|
||||
|
||||
buildah copy --from ${IMAGE_NAME}-builder "$containerName" "/src/${BINARY}" /usr/local/bin/${BINARY_NAME}
|
||||
|
||||
buildah config --label maintainer="Cyrille Nofficial" "${containerName}"
|
||||
buildah config --user 1234 "$containerName"
|
||||
buildah config --cmd '' "$containerName"
|
||||
buildah config --entrypoint '[ "/usr/local/bin/'${BINARY_NAME}'" ]' "$containerName"
|
||||
|
||||
buildah commit --rm --manifest ${IMAGE_NAME} ${containerName}
|
||||
done
|
||||
buildah commit --rm --manifest $IMAGE_NAME "${containerName}" "${containerName}"
|
||||
}
|
||||
|
||||
buildah rmi localhost/$IMAGE_NAME
|
||||
buildah manifest rm localhost/${IMAGE_NAME}
|
||||
|
||||
image_build
|
||||
image_build linux/amd64
|
||||
image_build linux/arm64
|
||||
image_build linux/arm/v7
|
||||
|
||||
|
||||
# push image
|
||||
image_final
|
||||
printf "\n\nPush manifest to %s\n\n" ${FULL_IMAGE_NAME}
|
||||
buildah manifest push --rm -f v2s2 "localhost/$IMAGE_NAME" "docker://$FULL_IMAGE_NAME" --all
|
||||
|
@ -16,7 +16,6 @@ const (
|
||||
func main() {
|
||||
var mqttBroker, username, password, clientId string
|
||||
var steeringTopic, driveModeTopic, rcSteeringTopic, tfSteeringTopic, objectsTopic string
|
||||
var imgWidth, imgHeight int
|
||||
var enableObjectsCorrection, enableObjectsCorrectionOnUserMode bool
|
||||
var gridMapConfig, objectsMoveFactorsConfig string
|
||||
var deltaMiddle float64
|
||||
@ -31,8 +30,6 @@ func main() {
|
||||
flag.StringVar(&tfSteeringTopic, "mqtt-topic-tf-steering", os.Getenv("MQTT_TOPIC_TF_STEERING"), "Mqtt topic that contains tenorflow steering value, use MQTT_TOPIC_TF_STEERING if args not set")
|
||||
flag.StringVar(&driveModeTopic, "mqtt-topic-drive-mode", os.Getenv("MQTT_TOPIC_DRIVE_MODE"), "Mqtt topic that contains DriveMode value, use MQTT_TOPIC_DRIVE_MODE if args not set")
|
||||
flag.StringVar(&objectsTopic, "mqtt-topic-objects", os.Getenv("MQTT_TOPIC_OBJECTS"), "Mqtt topic that contains Objects from object detection value, use MQTT_TOPIC_OBJECTS if args not set")
|
||||
flag.IntVar(&imgWidth, "image-width", 160, "Video pixels width")
|
||||
flag.IntVar(&imgHeight, "image-height", 128, "Video pixels height")
|
||||
flag.BoolVar(&enableObjectsCorrection, "enable-objects-correction", false, "Adjust steering to avoid objects")
|
||||
flag.BoolVar(&enableObjectsCorrectionOnUserMode, "enable-objects-correction-user", false, "Adjust steering to avoid objects on user mode driving")
|
||||
flag.StringVar(&gridMapConfig, "grid-map-config", "", "Json file path to configure grid object correction")
|
||||
@ -69,7 +66,6 @@ func main() {
|
||||
zap.S().Infof("objects correction on user mode : %v", enableObjectsCorrectionOnUserMode)
|
||||
zap.S().Infof("grid map file config : %v", gridMapConfig)
|
||||
zap.S().Infof("objects move factors grid config: %v", objectsMoveFactorsConfig)
|
||||
zap.S().Infof("image width x height : %v x %v", imgWidth, imgHeight)
|
||||
|
||||
client, err := cli.Connect(mqttBroker, username, password, clientId)
|
||||
if err != nil {
|
||||
@ -85,8 +81,6 @@ func main() {
|
||||
steering.WidthDeltaMiddle(deltaMiddle),
|
||||
steering.WithGridMap(gridMapConfig),
|
||||
steering.WithObjectMoveFactors(objectsMoveFactorsConfig),
|
||||
steering.WithImageSize(imgWidth, imgHeight),
|
||||
steering.WithSizeThreshold(0.75),
|
||||
),
|
||||
),
|
||||
steering.WithObjectsCorrectionEnabled(enableObjectsCorrection, enableObjectsCorrectionOnUserMode),
|
||||
|
19
go.mod
19
go.mod
@ -1,21 +1,18 @@
|
||||
module github.com/cyrilix/robocar-steering
|
||||
|
||||
go 1.21
|
||||
|
||||
toolchain go1.21.3
|
||||
go 1.22
|
||||
|
||||
require (
|
||||
github.com/cyrilix/robocar-base v0.1.8
|
||||
github.com/cyrilix/robocar-protobuf/go v1.4.0
|
||||
github.com/cyrilix/robocar-protobuf/go v1.5.2
|
||||
github.com/eclipse/paho.mqtt.golang v1.4.3
|
||||
go.uber.org/zap v1.26.0
|
||||
gocv.io/x/gocv v0.31.0
|
||||
google.golang.org/protobuf v1.31.0
|
||||
go.uber.org/zap v1.27.0
|
||||
google.golang.org/protobuf v1.33.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/gorilla/websocket v1.5.0 // indirect
|
||||
go.uber.org/multierr v1.10.0 // indirect
|
||||
golang.org/x/net v0.9.0 // indirect
|
||||
golang.org/x/sync v0.1.0 // indirect
|
||||
github.com/gorilla/websocket v1.5.1 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
golang.org/x/net v0.22.0 // indirect
|
||||
golang.org/x/sync v0.6.0 // indirect
|
||||
)
|
||||
|
38
go.sum
38
go.sum
@ -1,38 +1,32 @@
|
||||
github.com/cyrilix/robocar-base v0.1.8 h1:9hfH9rCcyGXR0dtESIhI9tCrK9juq+dSnJXCxCF2LVw=
|
||||
github.com/cyrilix/robocar-base v0.1.8/go.mod h1:oJnfYjoz2PX16BD8I8LJ14kRQt1zbFb7XaUHtUEZgjg=
|
||||
github.com/cyrilix/robocar-protobuf/go v1.4.0 h1:ZMN2zjn2iplsbHoBrjiI7d3HdNutWUB+NcVDh2mFcqM=
|
||||
github.com/cyrilix/robocar-protobuf/go v1.4.0/go.mod h1:69ZGmxS2JufIxGZPEKvAMZj5b1fVMVG3QTyFlCCHGtg=
|
||||
github.com/cyrilix/robocar-protobuf/go v1.5.2 h1:2JvVYCl+WD0OpJOuymPtANhBhyn4EA/MejPvMPW7v9Y=
|
||||
github.com/cyrilix/robocar-protobuf/go v1.5.2/go.mod h1:52tSzcJNtSdoU9jBNbdmOWN2Herc6hN+Yyebg4rc06w=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/eclipse/paho.mqtt.golang v1.4.3 h1:2kwcUGn8seMUfWndX0hGbvH8r7crgcJguQNCyp70xik=
|
||||
github.com/eclipse/paho.mqtt.golang v1.4.3/go.mod h1:CSYvoAlsMkhYOXh/oKyxa8EcBci6dVkLCbo5tTC1RIE=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
|
||||
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/hybridgroup/mjpeg v0.0.0-20140228234708-4680f319790e/go.mod h1:eagM805MRKrioHYuU7iKLUyFPVKqVV6um5DAvCkUtXs=
|
||||
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
|
||||
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk=
|
||||
go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo=
|
||||
go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
|
||||
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
|
||||
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
|
||||
gocv.io/x/gocv v0.31.0 h1:BHDtK8v+YPvoSPQTTiZB2fM/7BLg6511JqkruY2z6LQ=
|
||||
gocv.io/x/gocv v0.31.0/go.mod h1:oc6FvfYqfBp99p+yOEzs9tbYF9gOrAQSeL/dyIPefJU=
|
||||
golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM=
|
||||
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
|
||||
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
||||
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||
golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc=
|
||||
golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
|
||||
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
|
||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
|
||||
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
|
||||
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
@ -1,62 +0,0 @@
|
||||
package steering
|
||||
|
||||
import (
|
||||
"github.com/cyrilix/robocar-protobuf/go/events"
|
||||
"gocv.io/x/gocv"
|
||||
"image"
|
||||
)
|
||||
|
||||
func GroupBBoxes(bboxes []image.Rectangle) []image.Rectangle {
|
||||
if len(bboxes) == 0 {
|
||||
return []image.Rectangle{}
|
||||
}
|
||||
if len(bboxes) == 1 {
|
||||
return []image.Rectangle{bboxes[0]}
|
||||
}
|
||||
return gocv.GroupRectangles(bboxes, 1, 0.2)
|
||||
}
|
||||
func GroupObjects(objects []*events.Object, imgWidth, imgHeight int) []*events.Object {
|
||||
if len(objects) == 0 {
|
||||
return []*events.Object{}
|
||||
}
|
||||
if len(objects) == 1 {
|
||||
return []*events.Object{objects[0]}
|
||||
}
|
||||
|
||||
rectangles := make([]image.Rectangle, 0, len(objects))
|
||||
for _, o := range objects {
|
||||
rectangles = append(rectangles, *objectToRect(o, imgWidth, imgHeight))
|
||||
}
|
||||
grp := gocv.GroupRectangles(rectangles, 1, 0.2)
|
||||
result := make([]*events.Object, 0, len(grp))
|
||||
for _, r := range grp {
|
||||
result = append(result, rectToObject(&r, imgWidth, imgHeight))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func objectToRect(object *events.Object, imgWidth, imgHeight int) *image.Rectangle {
|
||||
r := image.Rect(
|
||||
int(object.Left*float32(imgWidth)),
|
||||
int(object.Top*float32(imgHeight)),
|
||||
int(object.Right*float32(imgWidth)),
|
||||
int(object.Bottom*float32(imgHeight)),
|
||||
)
|
||||
return &r
|
||||
}
|
||||
|
||||
func sizeObject(object *events.Object, imgWidth, imgHeight int) float64 {
|
||||
r := objectToRect(object, imgWidth, imgHeight)
|
||||
return float64(r.Dx()) * float64(r.Dy())
|
||||
}
|
||||
|
||||
func rectToObject(r *image.Rectangle, imgWidth, imgHeight int) *events.Object {
|
||||
return &events.Object{
|
||||
Type: events.TypeObject_ANY,
|
||||
Left: float32(r.Min.X) / float32(imgWidth),
|
||||
Top: float32(r.Min.Y) / float32(imgHeight),
|
||||
Right: float32(r.Max.X) / float32(imgWidth),
|
||||
Bottom: float32(r.Max.Y) / float32(imgHeight),
|
||||
Confidence: -1,
|
||||
}
|
||||
}
|
@ -1,304 +0,0 @@
|
||||
package steering
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/cyrilix/robocar-protobuf/go/events"
|
||||
"go.uber.org/zap"
|
||||
"gocv.io/x/gocv"
|
||||
"image"
|
||||
"image/color"
|
||||
"os"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type ObjectsList struct {
|
||||
BBoxes []BBox `json:"bboxes"`
|
||||
}
|
||||
type BBox struct {
|
||||
Left float32 `json:"left"`
|
||||
Top float32 `json:"top"`
|
||||
Bottom float32 `json:"bottom"`
|
||||
Right float32 `json:"right"`
|
||||
Confidence float32 `json:"confidence"`
|
||||
}
|
||||
|
||||
var (
|
||||
dataBBoxes map[string][]image.Rectangle
|
||||
dataObjects map[string][]*events.Object
|
||||
dataImages map[string]*gocv.Mat
|
||||
)
|
||||
|
||||
func init() {
|
||||
// TODO: empty img without bbox
|
||||
dataNames := []string{"01", "02", "03", "04"}
|
||||
dataBBoxes = make(map[string][]image.Rectangle, len(dataNames))
|
||||
dataObjects = make(map[string][]*events.Object, len(dataNames))
|
||||
dataImages = make(map[string]*gocv.Mat, len(dataNames))
|
||||
|
||||
for _, dataName := range dataNames {
|
||||
img, bb, err := loadData(dataName)
|
||||
if err != nil {
|
||||
zap.S().Panicf("unable to load data test: %v", err)
|
||||
}
|
||||
dataBBoxes[dataName] = bboxesToRectangles(bb, img.Cols(), img.Rows())
|
||||
dataObjects[dataName] = bboxesToObjects(bb)
|
||||
dataImages[dataName] = img
|
||||
}
|
||||
}
|
||||
|
||||
func bboxesToRectangles(bboxes []BBox, imgWidth, imgHeiht int) []image.Rectangle {
|
||||
rects := make([]image.Rectangle, 0, len(bboxes))
|
||||
for _, bb := range bboxes {
|
||||
rects = append(rects, bb.toRect(imgWidth, imgHeiht))
|
||||
}
|
||||
return rects
|
||||
}
|
||||
|
||||
func bboxesToObjects(bboxes []BBox) []*events.Object {
|
||||
objects := make([]*events.Object, 0, len(bboxes))
|
||||
for _, bb := range bboxes {
|
||||
objects = append(objects, &events.Object{
|
||||
Type: events.TypeObject_ANY,
|
||||
Left: bb.Left,
|
||||
Top: bb.Top,
|
||||
Right: bb.Right,
|
||||
Bottom: bb.Bottom,
|
||||
Confidence: bb.Confidence,
|
||||
})
|
||||
}
|
||||
return objects
|
||||
}
|
||||
func (bb *BBox) toRect(imgWidth, imgHeight int) image.Rectangle {
|
||||
return image.Rect(
|
||||
int(bb.Left*float32(imgWidth)),
|
||||
int(bb.Top*float32(imgHeight)),
|
||||
int(bb.Right*float32(imgWidth)),
|
||||
int(bb.Bottom*float32(imgHeight)),
|
||||
)
|
||||
}
|
||||
|
||||
func loadData(dataName string) (*gocv.Mat, []BBox, error) {
|
||||
contentBBoxes, err := os.ReadFile(fmt.Sprintf("test_data/bboxes-%s.json", dataName))
|
||||
if err != nil {
|
||||
return nil, []BBox{}, fmt.Errorf("unable to load json file for bbox of '%v': %w", dataName, err)
|
||||
}
|
||||
|
||||
var obj ObjectsList
|
||||
err = json.Unmarshal(contentBBoxes, &obj)
|
||||
if err != nil {
|
||||
return nil, []BBox{}, fmt.Errorf("unable to unmarsh json file for bbox of '%v': %w", dataName, err)
|
||||
}
|
||||
|
||||
imgContent, err := os.ReadFile(fmt.Sprintf("test_data/img-%s.jpg", dataName))
|
||||
if err != nil {
|
||||
return nil, []BBox{}, fmt.Errorf("unable to load jpg file of '%v': %w", dataName, err)
|
||||
}
|
||||
img, err := gocv.IMDecode(imgContent, gocv.IMReadUnchanged)
|
||||
if err != nil {
|
||||
return nil, []BBox{}, fmt.Errorf("unable to load jpg of '%v': %w", dataName, err)
|
||||
}
|
||||
return &img, obj.BBoxes, nil
|
||||
}
|
||||
|
||||
func drawImage(img *gocv.Mat, bboxes []BBox) {
|
||||
for _, bb := range bboxes {
|
||||
gocv.Rectangle(img, bb.toRect(img.Cols(), img.Rows()), color.RGBA{R: 0, G: 255, B: 0, A: 0}, 2)
|
||||
gocv.PutText(
|
||||
img,
|
||||
fmt.Sprintf("%.2f", bb.Confidence),
|
||||
image.Point{
|
||||
X: int(bb.Left*float32(img.Cols()) + 10.),
|
||||
Y: int(bb.Top*float32(img.Rows()) + 10.),
|
||||
},
|
||||
gocv.FontHersheyTriplex,
|
||||
0.4,
|
||||
color.RGBA{R: 0, G: 0, B: 0, A: 0},
|
||||
1)
|
||||
}
|
||||
}
|
||||
|
||||
func drawRectangles(img *gocv.Mat, rects []image.Rectangle, c color.RGBA) {
|
||||
for _, r := range rects {
|
||||
gocv.Rectangle(img, r, c, 2)
|
||||
}
|
||||
}
|
||||
|
||||
func saveImage(name string, img *gocv.Mat) error {
|
||||
err := os.MkdirAll("test_result", os.ModePerm)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to create directory for test result: %w", err)
|
||||
}
|
||||
jpg, err := gocv.IMEncode(gocv.JPEGFileExt, *img)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to encode jpg image: %w", err)
|
||||
}
|
||||
defer jpg.Close()
|
||||
|
||||
err = os.WriteFile(fmt.Sprintf("test_result/%s.jpg", name), jpg.GetBytes(), os.ModePerm)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to write jpeg file: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func DisplayImageAndBBoxes(dataName string) error {
|
||||
img, bboxes, err := loadData(dataName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to load image and bboxes: %w", err)
|
||||
}
|
||||
drawImage(img, bboxes)
|
||||
err = saveImage(dataName, img)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to save image: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestDisplayBBox(t *testing.T) {
|
||||
|
||||
type args struct {
|
||||
dataName string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
}{
|
||||
{
|
||||
name: "default",
|
||||
args: args{dataName: "01"},
|
||||
},
|
||||
{
|
||||
name: "02",
|
||||
args: args{dataName: "02"},
|
||||
},
|
||||
{
|
||||
name: "03",
|
||||
args: args{dataName: "03"},
|
||||
},
|
||||
{
|
||||
name: "04",
|
||||
args: args{dataName: "04"},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
err := DisplayImageAndBBoxes(tt.args.dataName)
|
||||
if err != nil {
|
||||
t.Errorf("unable to draw image: %v", err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestGroupBBoxes(t *testing.T) {
|
||||
type args struct {
|
||||
dataName string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want []image.Rectangle
|
||||
}{
|
||||
{
|
||||
name: "groupbbox-01",
|
||||
args: args{
|
||||
dataName: "01",
|
||||
},
|
||||
want: []image.Rectangle{{Min: image.Point{X: 42, Y: 20}, Max: image.Point{X: 84, Y: 57}}},
|
||||
},
|
||||
{
|
||||
name: "groupbbox-02",
|
||||
args: args{
|
||||
dataName: "02",
|
||||
},
|
||||
want: []image.Rectangle{{Min: image.Point{X: 25, Y: 13}, Max: image.Point{X: 110, Y: 80}}},
|
||||
},
|
||||
{
|
||||
name: "groupbbox-03",
|
||||
args: args{
|
||||
dataName: "03",
|
||||
},
|
||||
want: []image.Rectangle{{Min: image.Point{X: 0, Y: 17}, Max: image.Point{X: 35, Y: 77}}},
|
||||
},
|
||||
{
|
||||
name: "groupbbox-04",
|
||||
args: args{
|
||||
dataName: "04",
|
||||
},
|
||||
want: []image.Rectangle{{Min: image.Point{X: 129, Y: 10}, Max: image.Point{X: 159, Y: 64}}},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got := GroupBBoxes(dataBBoxes[tt.args.dataName])
|
||||
img := gocv.NewMat()
|
||||
defer img.Close()
|
||||
dataImages[tt.args.dataName].CopyTo(&img)
|
||||
drawRectangles(&img, got, color.RGBA{R: 0, G: 0, B: 255, A: 0})
|
||||
saveImage(tt.name, &img)
|
||||
if !reflect.DeepEqual(got, tt.want) {
|
||||
t.Errorf("GroupBBoxes() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
func TestGroupObjects(t *testing.T) {
|
||||
type args struct {
|
||||
dataName string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want []*events.Object
|
||||
}{
|
||||
{
|
||||
name: "groupbbox-01",
|
||||
args: args{
|
||||
dataName: "01",
|
||||
},
|
||||
want: []*events.Object{
|
||||
{Left: 0.26660156, Top: 0.1706543, Right: 0.5258789, Bottom: 0.47583008, Confidence: 0.4482422},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "groupbbox-02",
|
||||
args: args{
|
||||
dataName: "02",
|
||||
},
|
||||
want: []*events.Object{
|
||||
{Left: 0.15625, Top: 0.108333334, Right: 0.6875, Bottom: 0.6666667, Confidence: -1},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "groupbbox-03",
|
||||
args: args{
|
||||
dataName: "03",
|
||||
},
|
||||
want: []*events.Object{
|
||||
{Top: 0.14166667, Right: 0.21875, Bottom: 0.64166665, Confidence: -1},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "groupbbox-04",
|
||||
args: args{
|
||||
dataName: "04",
|
||||
},
|
||||
want: []*events.Object{
|
||||
{Left: 0.80625, Top: 0.083333336, Right: 0.99375, Bottom: 0.53333336, Confidence: -1},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
img := dataImages[tt.args.dataName]
|
||||
got := GroupObjects(dataObjects[tt.args.dataName], img.Cols(), img.Rows())
|
||||
if !reflect.DeepEqual(got, tt.want) {
|
||||
t.Errorf("GroupObjects() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@ -202,7 +202,8 @@ func (c *Controller) Objects() []*events.Object {
|
||||
defer c.muObjects.RUnlock()
|
||||
res := make([]*events.Object, 0, len(c.objects))
|
||||
for _, o := range c.objects {
|
||||
res = append(res, o)
|
||||
oCpy := o
|
||||
res = append(res, oCpy)
|
||||
}
|
||||
zap.S().Debugf("copy object from %v to %v", c.objects, res)
|
||||
return res
|
||||
|
@ -60,33 +60,17 @@ func loadConfig(configPath string) (*GridMap, error) {
|
||||
return &gm, nil
|
||||
}
|
||||
|
||||
func WithImageSize(width, height int) OptionCorrector {
|
||||
return func(c *GridCorrector) {
|
||||
c.imgWidth = width
|
||||
c.imgHeight = height
|
||||
}
|
||||
}
|
||||
|
||||
func WithSizeThreshold(sizeThreshold float64) OptionCorrector {
|
||||
return func(c *GridCorrector) {
|
||||
c.sizeThreshold = sizeThreshold
|
||||
}
|
||||
}
|
||||
|
||||
func WidthDeltaMiddle(d float64) OptionCorrector {
|
||||
return func(c *GridCorrector) {
|
||||
c.deltaMiddle = d
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func NewGridCorrector(options ...OptionCorrector) *GridCorrector {
|
||||
c := &GridCorrector{
|
||||
gridMap: &defaultGridMap,
|
||||
objectMoveFactors: &defaultObjectFactors,
|
||||
deltaMiddle: 0.1,
|
||||
imgWidth: 160,
|
||||
imgHeight: 120,
|
||||
sizeThreshold: 0.75,
|
||||
}
|
||||
for _, o := range options {
|
||||
o(c)
|
||||
@ -95,11 +79,9 @@ func NewGridCorrector(options ...OptionCorrector) *GridCorrector {
|
||||
}
|
||||
|
||||
type GridCorrector struct {
|
||||
gridMap *GridMap
|
||||
objectMoveFactors *GridMap
|
||||
deltaMiddle float64
|
||||
imgWidth, imgHeight int
|
||||
sizeThreshold float64
|
||||
gridMap *GridMap
|
||||
objectMoveFactors *GridMap
|
||||
deltaMiddle float64
|
||||
}
|
||||
|
||||
/*
|
||||
@ -139,20 +121,15 @@ AdjustFromObjectPosition modify steering value according object positions
|
||||
: | ... | ... | ... | ... | ... | ... |
|
||||
*/
|
||||
func (c *GridCorrector) AdjustFromObjectPosition(currentSteering float64, objs []*events.Object) float64 {
|
||||
objects := c.filter_big_objects(objs, c.imgWidth, c.imgHeight, c.sizeThreshold)
|
||||
objects := objs
|
||||
|
||||
zap.S().Debugf("%v objects to avoid", len(objects))
|
||||
if len(objects) == 0 {
|
||||
return currentSteering
|
||||
}
|
||||
grpObjs := GroupObjects(objects, c.imgWidth, c.imgHeight)
|
||||
|
||||
// get nearest object
|
||||
nearest, err := c.nearObject(grpObjs)
|
||||
if err != nil {
|
||||
zap.S().Warnf("unexpected error on nearest search object, ignore objects: %v", err)
|
||||
return currentSteering
|
||||
}
|
||||
nearest := objs[0]
|
||||
|
||||
if currentSteering > -1*c.deltaMiddle && currentSteering < c.deltaMiddle {
|
||||
// Straight
|
||||
@ -205,35 +182,6 @@ func (c *GridCorrector) computeDeviation(nearest *events.Object) float64 {
|
||||
return delta
|
||||
}
|
||||
|
||||
func (c *GridCorrector) nearObject(objects []*events.Object) (*events.Object, error) {
|
||||
if len(objects) == 0 {
|
||||
return nil, fmt.Errorf("list objects must contain at least one object")
|
||||
}
|
||||
if len(objects) == 1 {
|
||||
return objects[0], nil
|
||||
}
|
||||
|
||||
var result *events.Object
|
||||
for _, obj := range objects {
|
||||
if result == nil || obj.Bottom > result.Bottom {
|
||||
result = obj
|
||||
continue
|
||||
}
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (c *GridCorrector) filter_big_objects(objts []*events.Object, imgWidth int, imgHeight int, sizeThreshold float64) []*events.Object {
|
||||
objectFiltred := make([]*events.Object, 0, len(objts))
|
||||
sizeLimit := float64(imgWidth*imgHeight) * sizeThreshold
|
||||
for _, o := range objts {
|
||||
if sizeObject(o, imgWidth, imgHeight) < sizeLimit {
|
||||
objectFiltred = append(objectFiltred, o)
|
||||
}
|
||||
}
|
||||
return objectFiltred
|
||||
}
|
||||
|
||||
func NewGridMapFromJson(fileName string) (*GridMap, error) {
|
||||
content, err := os.ReadFile(fileName)
|
||||
if err != nil {
|
||||
|
@ -167,56 +167,6 @@ func TestCorrector_AdjustFromObjectPosition(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCorrector_nearObject(t *testing.T) {
|
||||
type args struct {
|
||||
objects []*events.Object
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want *events.Object
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "List object is empty",
|
||||
args: args{
|
||||
objects: []*events.Object{},
|
||||
},
|
||||
want: nil,
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "List with only one object",
|
||||
args: args{
|
||||
objects: []*events.Object{&objectOnMiddleNear},
|
||||
},
|
||||
want: &objectOnMiddleNear,
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "List with many objects",
|
||||
args: args{
|
||||
objects: []*events.Object{&objectOnLeftDistant, &objectOnMiddleNear, &objectOnRightDistant, &objectOnMiddleDistant},
|
||||
},
|
||||
want: &objectOnMiddleNear,
|
||||
wantErr: false,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
c := &GridCorrector{}
|
||||
got, err := c.nearObject(tt.args.objects)
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("nearObject() error = %v, wantErr %v", err, tt.wantErr)
|
||||
return
|
||||
}
|
||||
if !reflect.DeepEqual(got, tt.want) {
|
||||
t.Errorf("nearObject() got = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewGridMapFromJson(t *testing.T) {
|
||||
type args struct {
|
||||
fileName string
|
||||
|
504
vendor/github.com/cyrilix/robocar-protobuf/go/events/events.pb.go
generated
vendored
504
vendor/github.com/cyrilix/robocar-protobuf/go/events/events.pb.go
generated
vendored
@ -295,6 +295,78 @@ func (x *FrameMessage) GetFrame() []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
type DisparityMessage struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
FrameRef *FrameRef `protobuf:"bytes,1,opt,name=frame_ref,json=frameRef,proto3" json:"frame_ref,omitempty"`
|
||||
Disparity []byte `protobuf:"bytes,2,opt,name=disparity,proto3" json:"disparity,omitempty"`
|
||||
FocalLengthInPixels float64 `protobuf:"fixed64,3,opt,name=focal_length_in_pixels,json=focalLengthInPixels,proto3" json:"focal_length_in_pixels,omitempty"`
|
||||
// the distance between two mono cameras
|
||||
BaselineInMm float64 `protobuf:"fixed64,4,opt,name=baseline_in_mm,json=baselineInMm,proto3" json:"baseline_in_mm,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DisparityMessage) Reset() {
|
||||
*x = DisparityMessage{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_events_events_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DisparityMessage) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DisparityMessage) ProtoMessage() {}
|
||||
|
||||
func (x *DisparityMessage) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_events_events_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DisparityMessage.ProtoReflect.Descriptor instead.
|
||||
func (*DisparityMessage) Descriptor() ([]byte, []int) {
|
||||
return file_events_events_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *DisparityMessage) GetFrameRef() *FrameRef {
|
||||
if x != nil {
|
||||
return x.FrameRef
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *DisparityMessage) GetDisparity() []byte {
|
||||
if x != nil {
|
||||
return x.Disparity
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *DisparityMessage) GetFocalLengthInPixels() float64 {
|
||||
if x != nil {
|
||||
return x.FocalLengthInPixels
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DisparityMessage) GetBaselineInMm() float64 {
|
||||
if x != nil {
|
||||
return x.BaselineInMm
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type SteeringMessage struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@ -308,7 +380,7 @@ type SteeringMessage struct {
|
||||
func (x *SteeringMessage) Reset() {
|
||||
*x = SteeringMessage{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_events_events_proto_msgTypes[2]
|
||||
mi := &file_events_events_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -321,7 +393,7 @@ func (x *SteeringMessage) String() string {
|
||||
func (*SteeringMessage) ProtoMessage() {}
|
||||
|
||||
func (x *SteeringMessage) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_events_events_proto_msgTypes[2]
|
||||
mi := &file_events_events_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -334,7 +406,7 @@ func (x *SteeringMessage) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use SteeringMessage.ProtoReflect.Descriptor instead.
|
||||
func (*SteeringMessage) Descriptor() ([]byte, []int) {
|
||||
return file_events_events_proto_rawDescGZIP(), []int{2}
|
||||
return file_events_events_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *SteeringMessage) GetSteering() float32 {
|
||||
@ -371,7 +443,7 @@ type ThrottleMessage struct {
|
||||
func (x *ThrottleMessage) Reset() {
|
||||
*x = ThrottleMessage{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_events_events_proto_msgTypes[3]
|
||||
mi := &file_events_events_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -384,7 +456,7 @@ func (x *ThrottleMessage) String() string {
|
||||
func (*ThrottleMessage) ProtoMessage() {}
|
||||
|
||||
func (x *ThrottleMessage) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_events_events_proto_msgTypes[3]
|
||||
mi := &file_events_events_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -397,7 +469,7 @@ func (x *ThrottleMessage) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ThrottleMessage.ProtoReflect.Descriptor instead.
|
||||
func (*ThrottleMessage) Descriptor() ([]byte, []int) {
|
||||
return file_events_events_proto_rawDescGZIP(), []int{3}
|
||||
return file_events_events_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *ThrottleMessage) GetThrottle() float32 {
|
||||
@ -434,7 +506,7 @@ type SpeedZoneMessage struct {
|
||||
func (x *SpeedZoneMessage) Reset() {
|
||||
*x = SpeedZoneMessage{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_events_events_proto_msgTypes[4]
|
||||
mi := &file_events_events_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -447,7 +519,7 @@ func (x *SpeedZoneMessage) String() string {
|
||||
func (*SpeedZoneMessage) ProtoMessage() {}
|
||||
|
||||
func (x *SpeedZoneMessage) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_events_events_proto_msgTypes[4]
|
||||
mi := &file_events_events_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -460,7 +532,7 @@ func (x *SpeedZoneMessage) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use SpeedZoneMessage.ProtoReflect.Descriptor instead.
|
||||
func (*SpeedZoneMessage) Descriptor() ([]byte, []int) {
|
||||
return file_events_events_proto_rawDescGZIP(), []int{4}
|
||||
return file_events_events_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *SpeedZoneMessage) GetSpeedZone() SpeedZone {
|
||||
@ -495,7 +567,7 @@ type DriveModeMessage struct {
|
||||
func (x *DriveModeMessage) Reset() {
|
||||
*x = DriveModeMessage{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_events_events_proto_msgTypes[5]
|
||||
mi := &file_events_events_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -508,7 +580,7 @@ func (x *DriveModeMessage) String() string {
|
||||
func (*DriveModeMessage) ProtoMessage() {}
|
||||
|
||||
func (x *DriveModeMessage) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_events_events_proto_msgTypes[5]
|
||||
mi := &file_events_events_proto_msgTypes[6]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -521,7 +593,7 @@ func (x *DriveModeMessage) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use DriveModeMessage.ProtoReflect.Descriptor instead.
|
||||
func (*DriveModeMessage) Descriptor() ([]byte, []int) {
|
||||
return file_events_events_proto_rawDescGZIP(), []int{5}
|
||||
return file_events_events_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *DriveModeMessage) GetDriveMode() DriveMode {
|
||||
@ -543,7 +615,7 @@ type ObjectsMessage struct {
|
||||
func (x *ObjectsMessage) Reset() {
|
||||
*x = ObjectsMessage{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_events_events_proto_msgTypes[6]
|
||||
mi := &file_events_events_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -556,7 +628,7 @@ func (x *ObjectsMessage) String() string {
|
||||
func (*ObjectsMessage) ProtoMessage() {}
|
||||
|
||||
func (x *ObjectsMessage) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_events_events_proto_msgTypes[6]
|
||||
mi := &file_events_events_proto_msgTypes[7]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -569,7 +641,7 @@ func (x *ObjectsMessage) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ObjectsMessage.ProtoReflect.Descriptor instead.
|
||||
func (*ObjectsMessage) Descriptor() ([]byte, []int) {
|
||||
return file_events_events_proto_rawDescGZIP(), []int{6}
|
||||
return file_events_events_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *ObjectsMessage) GetObjects() []*Object {
|
||||
@ -592,18 +664,19 @@ type Object struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Type TypeObject `protobuf:"varint,1,opt,name=type,proto3,enum=robocar.events.TypeObject" json:"type,omitempty"`
|
||||
Left float32 `protobuf:"fixed32,2,opt,name=left,proto3" json:"left,omitempty"`
|
||||
Top float32 `protobuf:"fixed32,3,opt,name=top,proto3" json:"top,omitempty"`
|
||||
Right float32 `protobuf:"fixed32,4,opt,name=right,proto3" json:"right,omitempty"`
|
||||
Bottom float32 `protobuf:"fixed32,5,opt,name=bottom,proto3" json:"bottom,omitempty"`
|
||||
Confidence float32 `protobuf:"fixed32,6,opt,name=confidence,proto3" json:"confidence,omitempty"`
|
||||
Type TypeObject `protobuf:"varint,1,opt,name=type,proto3,enum=robocar.events.TypeObject" json:"type,omitempty"`
|
||||
Left float32 `protobuf:"fixed32,2,opt,name=left,proto3" json:"left,omitempty"`
|
||||
Top float32 `protobuf:"fixed32,3,opt,name=top,proto3" json:"top,omitempty"`
|
||||
Right float32 `protobuf:"fixed32,4,opt,name=right,proto3" json:"right,omitempty"`
|
||||
Bottom float32 `protobuf:"fixed32,5,opt,name=bottom,proto3" json:"bottom,omitempty"`
|
||||
Confidence float32 `protobuf:"fixed32,6,opt,name=confidence,proto3" json:"confidence,omitempty"`
|
||||
DistanceInMm int64 `protobuf:"varint,7,opt,name=distanceInMm,proto3" json:"distanceInMm,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Object) Reset() {
|
||||
*x = Object{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_events_events_proto_msgTypes[7]
|
||||
mi := &file_events_events_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -616,7 +689,7 @@ func (x *Object) String() string {
|
||||
func (*Object) ProtoMessage() {}
|
||||
|
||||
func (x *Object) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_events_events_proto_msgTypes[7]
|
||||
mi := &file_events_events_proto_msgTypes[8]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -629,7 +702,7 @@ func (x *Object) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use Object.ProtoReflect.Descriptor instead.
|
||||
func (*Object) Descriptor() ([]byte, []int) {
|
||||
return file_events_events_proto_rawDescGZIP(), []int{7}
|
||||
return file_events_events_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *Object) GetType() TypeObject {
|
||||
@ -674,6 +747,13 @@ func (x *Object) GetConfidence() float32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Object) GetDistanceInMm() int64 {
|
||||
if x != nil {
|
||||
return x.DistanceInMm
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type SwitchRecordMessage struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@ -685,7 +765,7 @@ type SwitchRecordMessage struct {
|
||||
func (x *SwitchRecordMessage) Reset() {
|
||||
*x = SwitchRecordMessage{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_events_events_proto_msgTypes[8]
|
||||
mi := &file_events_events_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -698,7 +778,7 @@ func (x *SwitchRecordMessage) String() string {
|
||||
func (*SwitchRecordMessage) ProtoMessage() {}
|
||||
|
||||
func (x *SwitchRecordMessage) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_events_events_proto_msgTypes[8]
|
||||
mi := &file_events_events_proto_msgTypes[9]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -711,7 +791,7 @@ func (x *SwitchRecordMessage) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use SwitchRecordMessage.ProtoReflect.Descriptor instead.
|
||||
func (*SwitchRecordMessage) Descriptor() ([]byte, []int) {
|
||||
return file_events_events_proto_rawDescGZIP(), []int{8}
|
||||
return file_events_events_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
func (x *SwitchRecordMessage) GetEnabled() bool {
|
||||
@ -735,7 +815,7 @@ type RoadMessage struct {
|
||||
func (x *RoadMessage) Reset() {
|
||||
*x = RoadMessage{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_events_events_proto_msgTypes[9]
|
||||
mi := &file_events_events_proto_msgTypes[10]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -748,7 +828,7 @@ func (x *RoadMessage) String() string {
|
||||
func (*RoadMessage) ProtoMessage() {}
|
||||
|
||||
func (x *RoadMessage) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_events_events_proto_msgTypes[9]
|
||||
mi := &file_events_events_proto_msgTypes[10]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -761,7 +841,7 @@ func (x *RoadMessage) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use RoadMessage.ProtoReflect.Descriptor instead.
|
||||
func (*RoadMessage) Descriptor() ([]byte, []int) {
|
||||
return file_events_events_proto_rawDescGZIP(), []int{9}
|
||||
return file_events_events_proto_rawDescGZIP(), []int{10}
|
||||
}
|
||||
|
||||
func (x *RoadMessage) GetContour() []*Point {
|
||||
@ -797,7 +877,7 @@ type Point struct {
|
||||
func (x *Point) Reset() {
|
||||
*x = Point{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_events_events_proto_msgTypes[10]
|
||||
mi := &file_events_events_proto_msgTypes[11]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -810,7 +890,7 @@ func (x *Point) String() string {
|
||||
func (*Point) ProtoMessage() {}
|
||||
|
||||
func (x *Point) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_events_events_proto_msgTypes[10]
|
||||
mi := &file_events_events_proto_msgTypes[11]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -823,7 +903,7 @@ func (x *Point) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use Point.ProtoReflect.Descriptor instead.
|
||||
func (*Point) Descriptor() ([]byte, []int) {
|
||||
return file_events_events_proto_rawDescGZIP(), []int{10}
|
||||
return file_events_events_proto_rawDescGZIP(), []int{11}
|
||||
}
|
||||
|
||||
func (x *Point) GetX() int32 {
|
||||
@ -855,7 +935,7 @@ type Ellipse struct {
|
||||
func (x *Ellipse) Reset() {
|
||||
*x = Ellipse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_events_events_proto_msgTypes[11]
|
||||
mi := &file_events_events_proto_msgTypes[12]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -868,7 +948,7 @@ func (x *Ellipse) String() string {
|
||||
func (*Ellipse) ProtoMessage() {}
|
||||
|
||||
func (x *Ellipse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_events_events_proto_msgTypes[11]
|
||||
mi := &file_events_events_proto_msgTypes[12]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -881,7 +961,7 @@ func (x *Ellipse) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use Ellipse.ProtoReflect.Descriptor instead.
|
||||
func (*Ellipse) Descriptor() ([]byte, []int) {
|
||||
return file_events_events_proto_rawDescGZIP(), []int{11}
|
||||
return file_events_events_proto_rawDescGZIP(), []int{12}
|
||||
}
|
||||
|
||||
func (x *Ellipse) GetCenter() *Point {
|
||||
@ -929,13 +1009,14 @@ type RecordMessage struct {
|
||||
Steering *SteeringMessage `protobuf:"bytes,2,opt,name=steering,proto3" json:"steering,omitempty"`
|
||||
AutopilotSteering *SteeringMessage `protobuf:"bytes,4,opt,name=autopilot_steering,json=autopilotSteering,proto3" json:"autopilot_steering,omitempty"`
|
||||
DriveMode *DriveModeMessage `protobuf:"bytes,5,opt,name=drive_mode,json=driveMode,proto3" json:"drive_mode,omitempty"`
|
||||
Disparity *DisparityMessage `protobuf:"bytes,6,opt,name=disparity,proto3" json:"disparity,omitempty"`
|
||||
RecordSet string `protobuf:"bytes,3,opt,name=recordSet,proto3" json:"recordSet,omitempty"` // Record set name
|
||||
}
|
||||
|
||||
func (x *RecordMessage) Reset() {
|
||||
*x = RecordMessage{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_events_events_proto_msgTypes[12]
|
||||
mi := &file_events_events_proto_msgTypes[13]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -948,7 +1029,7 @@ func (x *RecordMessage) String() string {
|
||||
func (*RecordMessage) ProtoMessage() {}
|
||||
|
||||
func (x *RecordMessage) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_events_events_proto_msgTypes[12]
|
||||
mi := &file_events_events_proto_msgTypes[13]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -961,7 +1042,7 @@ func (x *RecordMessage) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use RecordMessage.ProtoReflect.Descriptor instead.
|
||||
func (*RecordMessage) Descriptor() ([]byte, []int) {
|
||||
return file_events_events_proto_rawDescGZIP(), []int{12}
|
||||
return file_events_events_proto_rawDescGZIP(), []int{13}
|
||||
}
|
||||
|
||||
func (x *RecordMessage) GetFrame() *FrameMessage {
|
||||
@ -992,6 +1073,13 @@ func (x *RecordMessage) GetDriveMode() *DriveModeMessage {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RecordMessage) GetDisparity() *DisparityMessage {
|
||||
if x != nil {
|
||||
return x.Disparity
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RecordMessage) GetRecordSet() string {
|
||||
if x != nil {
|
||||
return x.RecordSet
|
||||
@ -1018,114 +1106,133 @@ var file_events_events_proto_rawDesc = []byte{
|
||||
0x72, 0x6f, 0x62, 0x6f, 0x63, 0x61, 0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x46,
|
||||
0x72, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x66, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x66,
|
||||
0x72, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x66, 0x72, 0x61, 0x6d,
|
||||
0x65, 0x22, 0x84, 0x01, 0x0a, 0x0f, 0x53, 0x74, 0x65, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x74, 0x65, 0x65, 0x72, 0x69, 0x6e,
|
||||
0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x52, 0x08, 0x73, 0x74, 0x65, 0x65, 0x72, 0x69, 0x6e,
|
||||
0x67, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63,
|
||||
0x65, 0x12, 0x35, 0x0a, 0x09, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x72, 0x6f, 0x62, 0x6f, 0x63, 0x61, 0x72, 0x2e, 0x65,
|
||||
0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x66, 0x52, 0x08,
|
||||
0x66, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x66, 0x22, 0x84, 0x01, 0x0a, 0x0f, 0x54, 0x68, 0x72,
|
||||
0x6f, 0x74, 0x74, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08,
|
||||
0x74, 0x68, 0x72, 0x6f, 0x74, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x52, 0x08,
|
||||
0x74, 0x68, 0x72, 0x6f, 0x74, 0x74, 0x6c, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x66,
|
||||
0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x35, 0x0a, 0x09, 0x66, 0x72, 0x61, 0x6d,
|
||||
0x65, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x72, 0x6f,
|
||||
0x62, 0x6f, 0x63, 0x61, 0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x46, 0x72, 0x61,
|
||||
0x6d, 0x65, 0x52, 0x65, 0x66, 0x52, 0x08, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x66, 0x22,
|
||||
0xa3, 0x01, 0x0a, 0x10, 0x53, 0x70, 0x65, 0x65, 0x64, 0x5a, 0x6f, 0x6e, 0x65, 0x4d, 0x65, 0x73,
|
||||
0x73, 0x61, 0x67, 0x65, 0x12, 0x38, 0x0a, 0x0a, 0x73, 0x70, 0x65, 0x65, 0x64, 0x5f, 0x7a, 0x6f,
|
||||
0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x72, 0x6f, 0x62, 0x6f, 0x63,
|
||||
0x61, 0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x53, 0x70, 0x65, 0x65, 0x64, 0x5a,
|
||||
0x6f, 0x6e, 0x65, 0x52, 0x09, 0x73, 0x70, 0x65, 0x65, 0x64, 0x5a, 0x6f, 0x6e, 0x65, 0x12, 0x1e,
|
||||
0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x02, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x35,
|
||||
0x0a, 0x09, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x18, 0x2e, 0x72, 0x6f, 0x62, 0x6f, 0x63, 0x61, 0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e,
|
||||
0x74, 0x73, 0x2e, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x66, 0x52, 0x08, 0x66, 0x72, 0x61,
|
||||
0x6d, 0x65, 0x52, 0x65, 0x66, 0x22, 0x4c, 0x0a, 0x10, 0x44, 0x72, 0x69, 0x76, 0x65, 0x4d, 0x6f,
|
||||
0x64, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x38, 0x0a, 0x0a, 0x64, 0x72, 0x69,
|
||||
0x76, 0x65, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e,
|
||||
0x72, 0x6f, 0x62, 0x6f, 0x63, 0x61, 0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x44,
|
||||
0x72, 0x69, 0x76, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x09, 0x64, 0x72, 0x69, 0x76, 0x65, 0x4d,
|
||||
0x6f, 0x64, 0x65, 0x22, 0x79, 0x0a, 0x0e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x4d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x30, 0x0a, 0x07, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73,
|
||||
0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x72, 0x6f, 0x62, 0x6f, 0x63, 0x61, 0x72,
|
||||
0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x07,
|
||||
0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x35, 0x0a, 0x09, 0x66, 0x72, 0x61, 0x6d, 0x65,
|
||||
0x5f, 0x72, 0x65, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x72, 0x6f, 0x62,
|
||||
0x6f, 0x63, 0x61, 0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x46, 0x72, 0x61, 0x6d,
|
||||
0x65, 0x52, 0x65, 0x66, 0x52, 0x08, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x66, 0x22, 0xac,
|
||||
0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x79, 0x70,
|
||||
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x72, 0x6f, 0x62, 0x6f, 0x63, 0x61,
|
||||
0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x4f, 0x62, 0x6a,
|
||||
0x65, 0x63, 0x74, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x65, 0x66,
|
||||
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x04, 0x6c, 0x65, 0x66, 0x74, 0x12, 0x10, 0x0a,
|
||||
0x03, 0x74, 0x6f, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x03, 0x74, 0x6f, 0x70, 0x12,
|
||||
0x14, 0x0a, 0x05, 0x72, 0x69, 0x67, 0x68, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05,
|
||||
0x72, 0x69, 0x67, 0x68, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x6f, 0x74, 0x74, 0x6f, 0x6d, 0x18,
|
||||
0x05, 0x20, 0x01, 0x28, 0x02, 0x52, 0x06, 0x62, 0x6f, 0x74, 0x74, 0x6f, 0x6d, 0x12, 0x1e, 0x0a,
|
||||
0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28,
|
||||
0x02, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x2f, 0x0a,
|
||||
0x13, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x4d, 0x65, 0x73,
|
||||
0x73, 0x61, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x22, 0xa8,
|
||||
0x01, 0x0a, 0x0b, 0x52, 0x6f, 0x61, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x2f,
|
||||
0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x6f, 0x75, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
|
||||
0x15, 0x2e, 0x72, 0x6f, 0x62, 0x6f, 0x63, 0x61, 0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73,
|
||||
0x2e, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x6f, 0x75, 0x72, 0x12,
|
||||
0x31, 0x0a, 0x07, 0x65, 0x6c, 0x6c, 0x69, 0x70, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x17, 0x2e, 0x72, 0x6f, 0x62, 0x6f, 0x63, 0x61, 0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74,
|
||||
0x73, 0x2e, 0x45, 0x6c, 0x6c, 0x69, 0x70, 0x73, 0x65, 0x52, 0x07, 0x65, 0x6c, 0x6c, 0x69, 0x70,
|
||||
0x73, 0x65, 0x12, 0x35, 0x0a, 0x09, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x72, 0x65, 0x66, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x72, 0x6f, 0x62, 0x6f, 0x63, 0x61, 0x72, 0x2e,
|
||||
0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x66, 0x52,
|
||||
0x08, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x66, 0x22, 0x23, 0x0a, 0x05, 0x50, 0x6f, 0x69,
|
||||
0x6e, 0x74, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78,
|
||||
0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x79, 0x22, 0x9c,
|
||||
0x01, 0x0a, 0x07, 0x45, 0x6c, 0x6c, 0x69, 0x70, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x06, 0x63, 0x65,
|
||||
0x6e, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x72, 0x6f, 0x62,
|
||||
0x6f, 0x63, 0x61, 0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x50, 0x6f, 0x69, 0x6e,
|
||||
0x74, 0x52, 0x06, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x69, 0x64,
|
||||
0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x12,
|
||||
0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x6e, 0x67, 0x6c, 0x65,
|
||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, 0x61, 0x6e, 0x67, 0x6c, 0x65, 0x12, 0x1e, 0x0a,
|
||||
0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28,
|
||||
0x02, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x22, 0xaf, 0x02,
|
||||
0x0a, 0x0d, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12,
|
||||
0x32, 0x0a, 0x05, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c,
|
||||
0x65, 0x22, 0xc2, 0x01, 0x0a, 0x10, 0x44, 0x69, 0x73, 0x70, 0x61, 0x72, 0x69, 0x74, 0x79, 0x4d,
|
||||
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x35, 0x0a, 0x09, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f,
|
||||
0x72, 0x65, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x72, 0x6f, 0x62, 0x6f,
|
||||
0x63, 0x61, 0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x46, 0x72, 0x61, 0x6d, 0x65,
|
||||
0x52, 0x65, 0x66, 0x52, 0x08, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x66, 0x12, 0x1c, 0x0a,
|
||||
0x09, 0x64, 0x69, 0x73, 0x70, 0x61, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c,
|
||||
0x52, 0x09, 0x64, 0x69, 0x73, 0x70, 0x61, 0x72, 0x69, 0x74, 0x79, 0x12, 0x33, 0x0a, 0x16, 0x66,
|
||||
0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x5f, 0x69, 0x6e, 0x5f, 0x70,
|
||||
0x69, 0x78, 0x65, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x13, 0x66, 0x6f, 0x63,
|
||||
0x61, 0x6c, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x49, 0x6e, 0x50, 0x69, 0x78, 0x65, 0x6c, 0x73,
|
||||
0x12, 0x24, 0x0a, 0x0e, 0x62, 0x61, 0x73, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x69, 0x6e, 0x5f,
|
||||
0x6d, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0c, 0x62, 0x61, 0x73, 0x65, 0x6c, 0x69,
|
||||
0x6e, 0x65, 0x49, 0x6e, 0x4d, 0x6d, 0x22, 0x84, 0x01, 0x0a, 0x0f, 0x53, 0x74, 0x65, 0x65, 0x72,
|
||||
0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x74,
|
||||
0x65, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x52, 0x08, 0x73, 0x74,
|
||||
0x65, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64,
|
||||
0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x66,
|
||||
0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x35, 0x0a, 0x09, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f,
|
||||
0x72, 0x65, 0x66, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x72, 0x6f, 0x62, 0x6f,
|
||||
0x63, 0x61, 0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x46, 0x72, 0x61, 0x6d, 0x65,
|
||||
0x52, 0x65, 0x66, 0x52, 0x08, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x66, 0x22, 0x84, 0x01,
|
||||
0x0a, 0x0f, 0x54, 0x68, 0x72, 0x6f, 0x74, 0x74, 0x6c, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67,
|
||||
0x65, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x68, 0x72, 0x6f, 0x74, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x02, 0x52, 0x08, 0x74, 0x68, 0x72, 0x6f, 0x74, 0x74, 0x6c, 0x65, 0x12, 0x1e, 0x0a,
|
||||
0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x02, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x35, 0x0a,
|
||||
0x09, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x18, 0x2e, 0x72, 0x6f, 0x62, 0x6f, 0x63, 0x61, 0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74,
|
||||
0x73, 0x2e, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x66, 0x52, 0x08, 0x66, 0x72, 0x61, 0x6d,
|
||||
0x65, 0x52, 0x65, 0x66, 0x22, 0xa3, 0x01, 0x0a, 0x10, 0x53, 0x70, 0x65, 0x65, 0x64, 0x5a, 0x6f,
|
||||
0x6e, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x38, 0x0a, 0x0a, 0x73, 0x70, 0x65,
|
||||
0x65, 0x64, 0x5f, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e,
|
||||
0x72, 0x6f, 0x62, 0x6f, 0x63, 0x61, 0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x53,
|
||||
0x70, 0x65, 0x65, 0x64, 0x5a, 0x6f, 0x6e, 0x65, 0x52, 0x09, 0x73, 0x70, 0x65, 0x65, 0x64, 0x5a,
|
||||
0x6f, 0x6e, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63,
|
||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65,
|
||||
0x6e, 0x63, 0x65, 0x12, 0x35, 0x0a, 0x09, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x72, 0x65, 0x66,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x72, 0x6f, 0x62, 0x6f, 0x63, 0x61, 0x72,
|
||||
0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x66,
|
||||
0x52, 0x08, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x66, 0x22, 0x4c, 0x0a, 0x10, 0x44, 0x72,
|
||||
0x69, 0x76, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x38,
|
||||
0x0a, 0x0a, 0x64, 0x72, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x0e, 0x32, 0x19, 0x2e, 0x72, 0x6f, 0x62, 0x6f, 0x63, 0x61, 0x72, 0x2e, 0x65, 0x76, 0x65,
|
||||
0x6e, 0x74, 0x73, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x09, 0x64,
|
||||
0x72, 0x69, 0x76, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x22, 0x79, 0x0a, 0x0e, 0x4f, 0x62, 0x6a, 0x65,
|
||||
0x63, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x30, 0x0a, 0x07, 0x6f, 0x62,
|
||||
0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x72, 0x6f,
|
||||
0x62, 0x6f, 0x63, 0x61, 0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x4f, 0x62, 0x6a,
|
||||
0x65, 0x63, 0x74, 0x52, 0x07, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x35, 0x0a, 0x09,
|
||||
0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x18, 0x2e, 0x72, 0x6f, 0x62, 0x6f, 0x63, 0x61, 0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73,
|
||||
0x2e, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x66, 0x52, 0x08, 0x66, 0x72, 0x61, 0x6d, 0x65,
|
||||
0x52, 0x65, 0x66, 0x22, 0xd0, 0x01, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x2e,
|
||||
0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x72,
|
||||
0x6f, 0x62, 0x6f, 0x63, 0x61, 0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x54, 0x79,
|
||||
0x70, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12,
|
||||
0x0a, 0x04, 0x6c, 0x65, 0x66, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x04, 0x6c, 0x65,
|
||||
0x66, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x6f, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52,
|
||||
0x03, 0x74, 0x6f, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x69, 0x67, 0x68, 0x74, 0x18, 0x04, 0x20,
|
||||
0x01, 0x28, 0x02, 0x52, 0x05, 0x72, 0x69, 0x67, 0x68, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x6f,
|
||||
0x74, 0x74, 0x6f, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x02, 0x52, 0x06, 0x62, 0x6f, 0x74, 0x74,
|
||||
0x6f, 0x6d, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65,
|
||||
0x18, 0x06, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e,
|
||||
0x63, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x6e,
|
||||
0x4d, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e,
|
||||
0x63, 0x65, 0x49, 0x6e, 0x4d, 0x6d, 0x22, 0x2f, 0x0a, 0x13, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68,
|
||||
0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x18, 0x0a,
|
||||
0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07,
|
||||
0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x22, 0xa8, 0x01, 0x0a, 0x0b, 0x52, 0x6f, 0x61, 0x64,
|
||||
0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x2f, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x6f,
|
||||
0x75, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x72, 0x6f, 0x62, 0x6f, 0x63,
|
||||
0x61, 0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x52,
|
||||
0x07, 0x63, 0x6f, 0x6e, 0x74, 0x6f, 0x75, 0x72, 0x12, 0x31, 0x0a, 0x07, 0x65, 0x6c, 0x6c, 0x69,
|
||||
0x70, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x72, 0x6f, 0x62, 0x6f,
|
||||
0x63, 0x61, 0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x45, 0x6c, 0x6c, 0x69, 0x70,
|
||||
0x73, 0x65, 0x52, 0x07, 0x65, 0x6c, 0x6c, 0x69, 0x70, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x09, 0x66,
|
||||
0x72, 0x61, 0x6d, 0x65, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18,
|
||||
0x2e, 0x72, 0x6f, 0x62, 0x6f, 0x63, 0x61, 0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e,
|
||||
0x46, 0x72, 0x61, 0x6d, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x05, 0x66, 0x72,
|
||||
0x61, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x73, 0x74, 0x65, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x72, 0x6f, 0x62, 0x6f, 0x63, 0x61, 0x72, 0x2e,
|
||||
0x46, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x66, 0x52, 0x08, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x52,
|
||||
0x65, 0x66, 0x22, 0x23, 0x0a, 0x05, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x0c, 0x0a, 0x01, 0x78,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x79, 0x22, 0x9c, 0x01, 0x0a, 0x07, 0x45, 0x6c, 0x6c, 0x69,
|
||||
0x70, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x06, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x72, 0x6f, 0x62, 0x6f, 0x63, 0x61, 0x72, 0x2e, 0x65, 0x76,
|
||||
0x65, 0x6e, 0x74, 0x73, 0x2e, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x06, 0x63, 0x65, 0x6e, 0x74,
|
||||
0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x05, 0x52, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67,
|
||||
0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74,
|
||||
0x12, 0x14, 0x0a, 0x05, 0x61, 0x6e, 0x67, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x02, 0x52,
|
||||
0x05, 0x61, 0x6e, 0x67, 0x6c, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64,
|
||||
0x65, 0x6e, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x66,
|
||||
0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x22, 0xef, 0x02, 0x0a, 0x0d, 0x52, 0x65, 0x63, 0x6f, 0x72,
|
||||
0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x32, 0x0a, 0x05, 0x66, 0x72, 0x61, 0x6d,
|
||||
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x6f, 0x62, 0x6f, 0x63, 0x61,
|
||||
0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x4d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x05, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x08,
|
||||
0x73, 0x74, 0x65, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f,
|
||||
0x2e, 0x72, 0x6f, 0x62, 0x6f, 0x63, 0x61, 0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e,
|
||||
0x53, 0x74, 0x65, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52,
|
||||
0x08, 0x73, 0x74, 0x65, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x4e, 0x0a, 0x12, 0x61, 0x75, 0x74,
|
||||
0x6f, 0x70, 0x69, 0x6c, 0x6f, 0x74, 0x5f, 0x73, 0x74, 0x65, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x18,
|
||||
0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x72, 0x6f, 0x62, 0x6f, 0x63, 0x61, 0x72, 0x2e,
|
||||
0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x53, 0x74, 0x65, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x4d,
|
||||
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x73, 0x74, 0x65, 0x65, 0x72, 0x69, 0x6e, 0x67,
|
||||
0x12, 0x4e, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x6f, 0x70, 0x69, 0x6c, 0x6f, 0x74, 0x5f, 0x73, 0x74,
|
||||
0x65, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x72,
|
||||
0x6f, 0x62, 0x6f, 0x63, 0x61, 0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x53, 0x74,
|
||||
0x65, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x11, 0x61,
|
||||
0x75, 0x74, 0x6f, 0x70, 0x69, 0x6c, 0x6f, 0x74, 0x53, 0x74, 0x65, 0x65, 0x72, 0x69, 0x6e, 0x67,
|
||||
0x12, 0x3f, 0x0a, 0x0a, 0x64, 0x72, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x05,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x72, 0x6f, 0x62, 0x6f, 0x63, 0x61, 0x72, 0x2e, 0x65,
|
||||
0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x44, 0x72, 0x69, 0x76, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x4d,
|
||||
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x09, 0x64, 0x72, 0x69, 0x76, 0x65, 0x4d, 0x6f, 0x64,
|
||||
0x65, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, 0x65, 0x74, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, 0x65, 0x74, 0x2a,
|
||||
0x38, 0x0a, 0x09, 0x53, 0x70, 0x65, 0x65, 0x64, 0x5a, 0x6f, 0x6e, 0x65, 0x12, 0x0b, 0x0a, 0x07,
|
||||
0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x4c, 0x4f,
|
||||
0x57, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x02, 0x12,
|
||||
0x08, 0x0a, 0x04, 0x46, 0x41, 0x53, 0x54, 0x10, 0x03, 0x2a, 0x3a, 0x0a, 0x09, 0x44, 0x72, 0x69,
|
||||
0x76, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49,
|
||||
0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x01, 0x12, 0x09, 0x0a,
|
||||
0x05, 0x50, 0x49, 0x4c, 0x4f, 0x54, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4f, 0x50, 0x49,
|
||||
0x4c, 0x4f, 0x54, 0x10, 0x03, 0x2a, 0x32, 0x0a, 0x0a, 0x54, 0x79, 0x70, 0x65, 0x4f, 0x62, 0x6a,
|
||||
0x65, 0x63, 0x74, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x59, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03,
|
||||
0x43, 0x41, 0x52, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x42, 0x55, 0x4d, 0x50, 0x10, 0x02, 0x12,
|
||||
0x08, 0x0a, 0x04, 0x50, 0x4c, 0x4f, 0x54, 0x10, 0x03, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x65,
|
||||
0x76, 0x65, 0x6e, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x11, 0x61, 0x75, 0x74, 0x6f, 0x70, 0x69, 0x6c, 0x6f,
|
||||
0x74, 0x53, 0x74, 0x65, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x3f, 0x0a, 0x0a, 0x64, 0x72, 0x69,
|
||||
0x76, 0x65, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e,
|
||||
0x72, 0x6f, 0x62, 0x6f, 0x63, 0x61, 0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x44,
|
||||
0x72, 0x69, 0x76, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52,
|
||||
0x09, 0x64, 0x72, 0x69, 0x76, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x3e, 0x0a, 0x09, 0x64, 0x69,
|
||||
0x73, 0x70, 0x61, 0x72, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e,
|
||||
0x72, 0x6f, 0x62, 0x6f, 0x63, 0x61, 0x72, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x44,
|
||||
0x69, 0x73, 0x70, 0x61, 0x72, 0x69, 0x74, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52,
|
||||
0x09, 0x64, 0x69, 0x73, 0x70, 0x61, 0x72, 0x69, 0x74, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65,
|
||||
0x63, 0x6f, 0x72, 0x64, 0x53, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72,
|
||||
0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, 0x65, 0x74, 0x2a, 0x38, 0x0a, 0x09, 0x53, 0x70, 0x65, 0x65,
|
||||
0x64, 0x5a, 0x6f, 0x6e, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e,
|
||||
0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06,
|
||||
0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x41, 0x53, 0x54,
|
||||
0x10, 0x03, 0x2a, 0x3a, 0x0a, 0x09, 0x44, 0x72, 0x69, 0x76, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12,
|
||||
0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04,
|
||||
0x55, 0x53, 0x45, 0x52, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x50, 0x49, 0x4c, 0x4f, 0x54, 0x10,
|
||||
0x02, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4f, 0x50, 0x49, 0x4c, 0x4f, 0x54, 0x10, 0x03, 0x2a, 0x32,
|
||||
0x0a, 0x0a, 0x54, 0x79, 0x70, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x07, 0x0a, 0x03,
|
||||
0x41, 0x4e, 0x59, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x43, 0x41, 0x52, 0x10, 0x01, 0x12, 0x08,
|
||||
0x0a, 0x04, 0x42, 0x55, 0x4d, 0x50, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x50, 0x4c, 0x4f, 0x54,
|
||||
0x10, 0x03, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -1141,50 +1248,53 @@ func file_events_events_proto_rawDescGZIP() []byte {
|
||||
}
|
||||
|
||||
var file_events_events_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
|
||||
var file_events_events_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
|
||||
var file_events_events_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
|
||||
var file_events_events_proto_goTypes = []interface{}{
|
||||
(SpeedZone)(0), // 0: robocar.events.SpeedZone
|
||||
(DriveMode)(0), // 1: robocar.events.DriveMode
|
||||
(TypeObject)(0), // 2: robocar.events.TypeObject
|
||||
(*FrameRef)(nil), // 3: robocar.events.FrameRef
|
||||
(*FrameMessage)(nil), // 4: robocar.events.FrameMessage
|
||||
(*SteeringMessage)(nil), // 5: robocar.events.SteeringMessage
|
||||
(*ThrottleMessage)(nil), // 6: robocar.events.ThrottleMessage
|
||||
(*SpeedZoneMessage)(nil), // 7: robocar.events.SpeedZoneMessage
|
||||
(*DriveModeMessage)(nil), // 8: robocar.events.DriveModeMessage
|
||||
(*ObjectsMessage)(nil), // 9: robocar.events.ObjectsMessage
|
||||
(*Object)(nil), // 10: robocar.events.Object
|
||||
(*SwitchRecordMessage)(nil), // 11: robocar.events.SwitchRecordMessage
|
||||
(*RoadMessage)(nil), // 12: robocar.events.RoadMessage
|
||||
(*Point)(nil), // 13: robocar.events.Point
|
||||
(*Ellipse)(nil), // 14: robocar.events.Ellipse
|
||||
(*RecordMessage)(nil), // 15: robocar.events.RecordMessage
|
||||
(*timestamppb.Timestamp)(nil), // 16: google.protobuf.Timestamp
|
||||
(*DisparityMessage)(nil), // 5: robocar.events.DisparityMessage
|
||||
(*SteeringMessage)(nil), // 6: robocar.events.SteeringMessage
|
||||
(*ThrottleMessage)(nil), // 7: robocar.events.ThrottleMessage
|
||||
(*SpeedZoneMessage)(nil), // 8: robocar.events.SpeedZoneMessage
|
||||
(*DriveModeMessage)(nil), // 9: robocar.events.DriveModeMessage
|
||||
(*ObjectsMessage)(nil), // 10: robocar.events.ObjectsMessage
|
||||
(*Object)(nil), // 11: robocar.events.Object
|
||||
(*SwitchRecordMessage)(nil), // 12: robocar.events.SwitchRecordMessage
|
||||
(*RoadMessage)(nil), // 13: robocar.events.RoadMessage
|
||||
(*Point)(nil), // 14: robocar.events.Point
|
||||
(*Ellipse)(nil), // 15: robocar.events.Ellipse
|
||||
(*RecordMessage)(nil), // 16: robocar.events.RecordMessage
|
||||
(*timestamppb.Timestamp)(nil), // 17: google.protobuf.Timestamp
|
||||
}
|
||||
var file_events_events_proto_depIdxs = []int32{
|
||||
16, // 0: robocar.events.FrameRef.created_at:type_name -> google.protobuf.Timestamp
|
||||
17, // 0: robocar.events.FrameRef.created_at:type_name -> google.protobuf.Timestamp
|
||||
3, // 1: robocar.events.FrameMessage.id:type_name -> robocar.events.FrameRef
|
||||
3, // 2: robocar.events.SteeringMessage.frame_ref:type_name -> robocar.events.FrameRef
|
||||
3, // 3: robocar.events.ThrottleMessage.frame_ref:type_name -> robocar.events.FrameRef
|
||||
0, // 4: robocar.events.SpeedZoneMessage.speed_zone:type_name -> robocar.events.SpeedZone
|
||||
3, // 5: robocar.events.SpeedZoneMessage.frame_ref:type_name -> robocar.events.FrameRef
|
||||
1, // 6: robocar.events.DriveModeMessage.drive_mode:type_name -> robocar.events.DriveMode
|
||||
10, // 7: robocar.events.ObjectsMessage.objects:type_name -> robocar.events.Object
|
||||
3, // 8: robocar.events.ObjectsMessage.frame_ref:type_name -> robocar.events.FrameRef
|
||||
2, // 9: robocar.events.Object.type:type_name -> robocar.events.TypeObject
|
||||
13, // 10: robocar.events.RoadMessage.contour:type_name -> robocar.events.Point
|
||||
14, // 11: robocar.events.RoadMessage.ellipse:type_name -> robocar.events.Ellipse
|
||||
3, // 12: robocar.events.RoadMessage.frame_ref:type_name -> robocar.events.FrameRef
|
||||
13, // 13: robocar.events.Ellipse.center:type_name -> robocar.events.Point
|
||||
4, // 14: robocar.events.RecordMessage.frame:type_name -> robocar.events.FrameMessage
|
||||
5, // 15: robocar.events.RecordMessage.steering:type_name -> robocar.events.SteeringMessage
|
||||
5, // 16: robocar.events.RecordMessage.autopilot_steering:type_name -> robocar.events.SteeringMessage
|
||||
8, // 17: robocar.events.RecordMessage.drive_mode:type_name -> robocar.events.DriveModeMessage
|
||||
18, // [18:18] is the sub-list for method output_type
|
||||
18, // [18:18] is the sub-list for method input_type
|
||||
18, // [18:18] is the sub-list for extension type_name
|
||||
18, // [18:18] is the sub-list for extension extendee
|
||||
0, // [0:18] is the sub-list for field type_name
|
||||
3, // 2: robocar.events.DisparityMessage.frame_ref:type_name -> robocar.events.FrameRef
|
||||
3, // 3: robocar.events.SteeringMessage.frame_ref:type_name -> robocar.events.FrameRef
|
||||
3, // 4: robocar.events.ThrottleMessage.frame_ref:type_name -> robocar.events.FrameRef
|
||||
0, // 5: robocar.events.SpeedZoneMessage.speed_zone:type_name -> robocar.events.SpeedZone
|
||||
3, // 6: robocar.events.SpeedZoneMessage.frame_ref:type_name -> robocar.events.FrameRef
|
||||
1, // 7: robocar.events.DriveModeMessage.drive_mode:type_name -> robocar.events.DriveMode
|
||||
11, // 8: robocar.events.ObjectsMessage.objects:type_name -> robocar.events.Object
|
||||
3, // 9: robocar.events.ObjectsMessage.frame_ref:type_name -> robocar.events.FrameRef
|
||||
2, // 10: robocar.events.Object.type:type_name -> robocar.events.TypeObject
|
||||
14, // 11: robocar.events.RoadMessage.contour:type_name -> robocar.events.Point
|
||||
15, // 12: robocar.events.RoadMessage.ellipse:type_name -> robocar.events.Ellipse
|
||||
3, // 13: robocar.events.RoadMessage.frame_ref:type_name -> robocar.events.FrameRef
|
||||
14, // 14: robocar.events.Ellipse.center:type_name -> robocar.events.Point
|
||||
4, // 15: robocar.events.RecordMessage.frame:type_name -> robocar.events.FrameMessage
|
||||
6, // 16: robocar.events.RecordMessage.steering:type_name -> robocar.events.SteeringMessage
|
||||
6, // 17: robocar.events.RecordMessage.autopilot_steering:type_name -> robocar.events.SteeringMessage
|
||||
9, // 18: robocar.events.RecordMessage.drive_mode:type_name -> robocar.events.DriveModeMessage
|
||||
5, // 19: robocar.events.RecordMessage.disparity:type_name -> robocar.events.DisparityMessage
|
||||
20, // [20:20] is the sub-list for method output_type
|
||||
20, // [20:20] is the sub-list for method input_type
|
||||
20, // [20:20] is the sub-list for extension type_name
|
||||
20, // [20:20] is the sub-list for extension extendee
|
||||
0, // [0:20] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_events_events_proto_init() }
|
||||
@ -1218,7 +1328,7 @@ func file_events_events_proto_init() {
|
||||
}
|
||||
}
|
||||
file_events_events_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SteeringMessage); i {
|
||||
switch v := v.(*DisparityMessage); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@ -1230,7 +1340,7 @@ func file_events_events_proto_init() {
|
||||
}
|
||||
}
|
||||
file_events_events_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ThrottleMessage); i {
|
||||
switch v := v.(*SteeringMessage); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@ -1242,7 +1352,7 @@ func file_events_events_proto_init() {
|
||||
}
|
||||
}
|
||||
file_events_events_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SpeedZoneMessage); i {
|
||||
switch v := v.(*ThrottleMessage); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@ -1254,7 +1364,7 @@ func file_events_events_proto_init() {
|
||||
}
|
||||
}
|
||||
file_events_events_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DriveModeMessage); i {
|
||||
switch v := v.(*SpeedZoneMessage); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@ -1266,7 +1376,7 @@ func file_events_events_proto_init() {
|
||||
}
|
||||
}
|
||||
file_events_events_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ObjectsMessage); i {
|
||||
switch v := v.(*DriveModeMessage); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@ -1278,7 +1388,7 @@ func file_events_events_proto_init() {
|
||||
}
|
||||
}
|
||||
file_events_events_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Object); i {
|
||||
switch v := v.(*ObjectsMessage); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@ -1290,7 +1400,7 @@ func file_events_events_proto_init() {
|
||||
}
|
||||
}
|
||||
file_events_events_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SwitchRecordMessage); i {
|
||||
switch v := v.(*Object); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@ -1302,7 +1412,7 @@ func file_events_events_proto_init() {
|
||||
}
|
||||
}
|
||||
file_events_events_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RoadMessage); i {
|
||||
switch v := v.(*SwitchRecordMessage); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@ -1314,7 +1424,7 @@ func file_events_events_proto_init() {
|
||||
}
|
||||
}
|
||||
file_events_events_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Point); i {
|
||||
switch v := v.(*RoadMessage); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@ -1326,7 +1436,7 @@ func file_events_events_proto_init() {
|
||||
}
|
||||
}
|
||||
file_events_events_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Ellipse); i {
|
||||
switch v := v.(*Point); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@ -1338,6 +1448,18 @@ func file_events_events_proto_init() {
|
||||
}
|
||||
}
|
||||
file_events_events_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Ellipse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_events_events_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RecordMessage); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@ -1356,7 +1478,7 @@ func file_events_events_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_events_events_proto_rawDesc,
|
||||
NumEnums: 3,
|
||||
NumMessages: 13,
|
||||
NumMessages: 14,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
20
vendor/github.com/gorilla/websocket/.editorconfig
generated
vendored
Normal file
20
vendor/github.com/gorilla/websocket/.editorconfig
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
; https://editorconfig.org/
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
insert_final_newline = true
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[{Makefile,go.mod,go.sum,*.go,.gitmodules}]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[*.md]
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
eclint_indent_style = unset
|
26
vendor/github.com/gorilla/websocket/.gitignore
generated
vendored
26
vendor/github.com/gorilla/websocket/.gitignore
generated
vendored
@ -1,25 +1 @@
|
||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
|
||||
.idea/
|
||||
*.iml
|
||||
coverage.coverprofile
|
||||
|
3
vendor/github.com/gorilla/websocket/.golangci.yml
generated
vendored
Normal file
3
vendor/github.com/gorilla/websocket/.golangci.yml
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
run:
|
||||
skip-dirs:
|
||||
- examples/*.go
|
9
vendor/github.com/gorilla/websocket/AUTHORS
generated
vendored
9
vendor/github.com/gorilla/websocket/AUTHORS
generated
vendored
@ -1,9 +0,0 @@
|
||||
# This is the official list of Gorilla WebSocket authors for copyright
|
||||
# purposes.
|
||||
#
|
||||
# Please keep the list sorted.
|
||||
|
||||
Gary Burd <gary@beagledreams.com>
|
||||
Google LLC (https://opensource.google.com/)
|
||||
Joachim Bauch <mail@joachim-bauch.de>
|
||||
|
39
vendor/github.com/gorilla/websocket/LICENSE
generated
vendored
39
vendor/github.com/gorilla/websocket/LICENSE
generated
vendored
@ -1,22 +1,27 @@
|
||||
Copyright (c) 2013 The Gorilla WebSocket Authors. All rights reserved.
|
||||
Copyright (c) 2023 The Gorilla Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
34
vendor/github.com/gorilla/websocket/Makefile
generated
vendored
Normal file
34
vendor/github.com/gorilla/websocket/Makefile
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
GO_LINT=$(shell which golangci-lint 2> /dev/null || echo '')
|
||||
GO_LINT_URI=github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
||||
|
||||
GO_SEC=$(shell which gosec 2> /dev/null || echo '')
|
||||
GO_SEC_URI=github.com/securego/gosec/v2/cmd/gosec@latest
|
||||
|
||||
GO_VULNCHECK=$(shell which govulncheck 2> /dev/null || echo '')
|
||||
GO_VULNCHECK_URI=golang.org/x/vuln/cmd/govulncheck@latest
|
||||
|
||||
.PHONY: golangci-lint
|
||||
golangci-lint:
|
||||
$(if $(GO_LINT), ,go install $(GO_LINT_URI))
|
||||
@echo "##### Running golangci-lint"
|
||||
golangci-lint run -v
|
||||
|
||||
.PHONY: gosec
|
||||
gosec:
|
||||
$(if $(GO_SEC), ,go install $(GO_SEC_URI))
|
||||
@echo "##### Running gosec"
|
||||
gosec -exclude-dir examples ./...
|
||||
|
||||
.PHONY: govulncheck
|
||||
govulncheck:
|
||||
$(if $(GO_VULNCHECK), ,go install $(GO_VULNCHECK_URI))
|
||||
@echo "##### Running govulncheck"
|
||||
govulncheck ./...
|
||||
|
||||
.PHONY: verify
|
||||
verify: golangci-lint gosec govulncheck
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
@echo "##### Running tests"
|
||||
go test -race -cover -coverprofile=coverage.coverprofile -covermode=atomic -v ./...
|
19
vendor/github.com/gorilla/websocket/README.md
generated
vendored
19
vendor/github.com/gorilla/websocket/README.md
generated
vendored
@ -1,17 +1,14 @@
|
||||
# Gorilla WebSocket
|
||||
# gorilla/websocket
|
||||
|
||||
[](https://godoc.org/github.com/gorilla/websocket)
|
||||
[](https://circleci.com/gh/gorilla/websocket)
|
||||

|
||||
[](https://codecov.io/github/gorilla/websocket)
|
||||
[](https://godoc.org/github.com/gorilla/websocket)
|
||||
[](https://sourcegraph.com/github.com/gorilla/websocket?badge)
|
||||
|
||||
Gorilla WebSocket is a [Go](http://golang.org/) implementation of the
|
||||
[WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol.
|
||||
Gorilla WebSocket is a [Go](http://golang.org/) implementation of the [WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
⚠️ **[The Gorilla WebSocket Package is looking for a new maintainer](https://github.com/gorilla/websocket/issues/370)**
|
||||
|
||||
---
|
||||
|
||||
### Documentation
|
||||
|
||||
@ -20,6 +17,7 @@ Gorilla WebSocket is a [Go](http://golang.org/) implementation of the
|
||||
* [Command example](https://github.com/gorilla/websocket/tree/master/examples/command)
|
||||
* [Client and server example](https://github.com/gorilla/websocket/tree/master/examples/echo)
|
||||
* [File watch example](https://github.com/gorilla/websocket/tree/master/examples/filewatch)
|
||||
* [Write buffer pool example](https://github.com/gorilla/websocket/tree/master/examples/bufferpool)
|
||||
|
||||
### Status
|
||||
|
||||
@ -36,4 +34,3 @@ package API is stable.
|
||||
The Gorilla WebSocket package passes the server tests in the [Autobahn Test
|
||||
Suite](https://github.com/crossbario/autobahn-testsuite) using the application in the [examples/autobahn
|
||||
subdirectory](https://github.com/gorilla/websocket/tree/master/examples/autobahn).
|
||||
|
||||
|
44
vendor/github.com/gorilla/websocket/client.go
generated
vendored
44
vendor/github.com/gorilla/websocket/client.go
generated
vendored
@ -9,14 +9,18 @@ import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
|
||||
"net"
|
||||
"net/http"
|
||||
"net/http/httptrace"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/proxy"
|
||||
)
|
||||
|
||||
// ErrBadHandshake is returned when the server response to opening handshake is
|
||||
@ -224,6 +228,7 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h
|
||||
k == "Connection" ||
|
||||
k == "Sec-Websocket-Key" ||
|
||||
k == "Sec-Websocket-Version" ||
|
||||
//#nosec G101 (CWE-798): Potential HTTP request smuggling via parameter pollution
|
||||
k == "Sec-Websocket-Extensions" ||
|
||||
(k == "Sec-Websocket-Protocol" && len(d.Subprotocols) > 0):
|
||||
return nil, nil, errors.New("websocket: duplicate header not allowed: " + k)
|
||||
@ -289,7 +294,9 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h
|
||||
}
|
||||
err = c.SetDeadline(deadline)
|
||||
if err != nil {
|
||||
c.Close()
|
||||
if err := c.Close(); err != nil {
|
||||
log.Printf("websocket: failed to close network connection: %v", err)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
return c, nil
|
||||
@ -303,7 +310,7 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h
|
||||
return nil, nil, err
|
||||
}
|
||||
if proxyURL != nil {
|
||||
dialer, err := proxy_FromURL(proxyURL, netDialerFunc(netDial))
|
||||
dialer, err := proxy.FromURL(proxyURL, netDialerFunc(netDial))
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
@ -318,18 +325,20 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h
|
||||
}
|
||||
|
||||
netConn, err := netDial("tcp", hostPort)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
if trace != nil && trace.GotConn != nil {
|
||||
trace.GotConn(httptrace.GotConnInfo{
|
||||
Conn: netConn,
|
||||
})
|
||||
}
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if netConn != nil {
|
||||
netConn.Close()
|
||||
if err := netConn.Close(); err != nil {
|
||||
log.Printf("websocket: failed to close network connection: %v", err)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
@ -370,6 +379,17 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h
|
||||
|
||||
resp, err := http.ReadResponse(conn.br, req)
|
||||
if err != nil {
|
||||
if d.TLSClientConfig != nil {
|
||||
for _, proto := range d.TLSClientConfig.NextProtos {
|
||||
if proto != "http/1.1" {
|
||||
return nil, nil, fmt.Errorf(
|
||||
"websocket: protocol %q was given but is not supported;"+
|
||||
"sharing tls.Config with net/http Transport can cause this error: %w",
|
||||
proto, err,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
@ -388,7 +408,7 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h
|
||||
// debugging.
|
||||
buf := make([]byte, 1024)
|
||||
n, _ := io.ReadFull(resp.Body, buf)
|
||||
resp.Body = ioutil.NopCloser(bytes.NewReader(buf[:n]))
|
||||
resp.Body = io.NopCloser(bytes.NewReader(buf[:n]))
|
||||
return nil, resp, ErrBadHandshake
|
||||
}
|
||||
|
||||
@ -406,17 +426,19 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h
|
||||
break
|
||||
}
|
||||
|
||||
resp.Body = ioutil.NopCloser(bytes.NewReader([]byte{}))
|
||||
resp.Body = io.NopCloser(bytes.NewReader([]byte{}))
|
||||
conn.subprotocol = resp.Header.Get("Sec-Websocket-Protocol")
|
||||
|
||||
netConn.SetDeadline(time.Time{})
|
||||
if err := netConn.SetDeadline(time.Time{}); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
netConn = nil // to avoid close in defer.
|
||||
return conn, resp, nil
|
||||
}
|
||||
|
||||
func cloneTLSConfig(cfg *tls.Config) *tls.Config {
|
||||
if cfg == nil {
|
||||
return &tls.Config{}
|
||||
return &tls.Config{MinVersion: tls.VersionTLS12}
|
||||
}
|
||||
return cfg.Clone()
|
||||
}
|
||||
|
9
vendor/github.com/gorilla/websocket/compression.go
generated
vendored
9
vendor/github.com/gorilla/websocket/compression.go
generated
vendored
@ -8,6 +8,7 @@ import (
|
||||
"compress/flate"
|
||||
"errors"
|
||||
"io"
|
||||
"log"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
@ -33,7 +34,9 @@ func decompressNoContextTakeover(r io.Reader) io.ReadCloser {
|
||||
"\x01\x00\x00\xff\xff"
|
||||
|
||||
fr, _ := flateReaderPool.Get().(io.ReadCloser)
|
||||
fr.(flate.Resetter).Reset(io.MultiReader(r, strings.NewReader(tail)), nil)
|
||||
if err := fr.(flate.Resetter).Reset(io.MultiReader(r, strings.NewReader(tail)), nil); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return &flateReadWrapper{fr}
|
||||
}
|
||||
|
||||
@ -132,7 +135,9 @@ func (r *flateReadWrapper) Read(p []byte) (int, error) {
|
||||
// Preemptively place the reader back in the pool. This helps with
|
||||
// scenarios where the application does not call NextReader() soon after
|
||||
// this final read.
|
||||
r.Close()
|
||||
if err := r.Close(); err != nil {
|
||||
log.Printf("websocket: flateReadWrapper.Close() returned error: %v", err)
|
||||
}
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
|
83
vendor/github.com/gorilla/websocket/conn.go
generated
vendored
83
vendor/github.com/gorilla/websocket/conn.go
generated
vendored
@ -6,11 +6,11 @@ package websocket
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"crypto/rand"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"log"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -181,13 +181,20 @@ var (
|
||||
errInvalidControlFrame = errors.New("websocket: invalid control frame")
|
||||
)
|
||||
|
||||
// maskRand is an io.Reader for generating mask bytes. The reader is initialized
|
||||
// to crypto/rand Reader. Tests swap the reader to a math/rand reader for
|
||||
// reproducible results.
|
||||
var maskRand = rand.Reader
|
||||
|
||||
// newMaskKey returns a new 32 bit value for masking client frames.
|
||||
func newMaskKey() [4]byte {
|
||||
n := rand.Uint32()
|
||||
return [4]byte{byte(n), byte(n >> 8), byte(n >> 16), byte(n >> 24)}
|
||||
var k [4]byte
|
||||
_, _ = io.ReadFull(maskRand, k[:])
|
||||
return k
|
||||
}
|
||||
|
||||
func hideTempErr(err error) error {
|
||||
if e, ok := err.(net.Error); ok && e.Temporary() {
|
||||
if e, ok := err.(net.Error); ok {
|
||||
err = &netError{msg: e.Error(), timeout: e.Timeout()}
|
||||
}
|
||||
return err
|
||||
@ -372,7 +379,9 @@ func (c *Conn) read(n int) ([]byte, error) {
|
||||
if err == io.EOF {
|
||||
err = errUnexpectedEOF
|
||||
}
|
||||
c.br.Discard(len(p))
|
||||
if _, err := c.br.Discard(len(p)); err != nil {
|
||||
return p, err
|
||||
}
|
||||
return p, err
|
||||
}
|
||||
|
||||
@ -387,7 +396,9 @@ func (c *Conn) write(frameType int, deadline time.Time, buf0, buf1 []byte) error
|
||||
return err
|
||||
}
|
||||
|
||||
c.conn.SetWriteDeadline(deadline)
|
||||
if err := c.conn.SetWriteDeadline(deadline); err != nil {
|
||||
return c.writeFatal(err)
|
||||
}
|
||||
if len(buf1) == 0 {
|
||||
_, err = c.conn.Write(buf0)
|
||||
} else {
|
||||
@ -397,7 +408,7 @@ func (c *Conn) write(frameType int, deadline time.Time, buf0, buf1 []byte) error
|
||||
return c.writeFatal(err)
|
||||
}
|
||||
if frameType == CloseMessage {
|
||||
c.writeFatal(ErrCloseSent)
|
||||
_ = c.writeFatal(ErrCloseSent)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@ -438,7 +449,7 @@ func (c *Conn) WriteControl(messageType int, data []byte, deadline time.Time) er
|
||||
|
||||
d := 1000 * time.Hour
|
||||
if !deadline.IsZero() {
|
||||
d = deadline.Sub(time.Now())
|
||||
d = time.Until(deadline)
|
||||
if d < 0 {
|
||||
return errWriteTimeout
|
||||
}
|
||||
@ -460,13 +471,15 @@ func (c *Conn) WriteControl(messageType int, data []byte, deadline time.Time) er
|
||||
return err
|
||||
}
|
||||
|
||||
c.conn.SetWriteDeadline(deadline)
|
||||
if err := c.conn.SetWriteDeadline(deadline); err != nil {
|
||||
return c.writeFatal(err)
|
||||
}
|
||||
_, err = c.conn.Write(buf)
|
||||
if err != nil {
|
||||
return c.writeFatal(err)
|
||||
}
|
||||
if messageType == CloseMessage {
|
||||
c.writeFatal(ErrCloseSent)
|
||||
_ = c.writeFatal(ErrCloseSent)
|
||||
}
|
||||
return err
|
||||
}
|
||||
@ -477,7 +490,9 @@ func (c *Conn) beginMessage(mw *messageWriter, messageType int) error {
|
||||
// probably better to return an error in this situation, but we cannot
|
||||
// change this without breaking existing applications.
|
||||
if c.writer != nil {
|
||||
c.writer.Close()
|
||||
if err := c.writer.Close(); err != nil {
|
||||
log.Printf("websocket: discarding writer close error: %v", err)
|
||||
}
|
||||
c.writer = nil
|
||||
}
|
||||
|
||||
@ -630,7 +645,7 @@ func (w *messageWriter) flushFrame(final bool, extra []byte) error {
|
||||
}
|
||||
|
||||
if final {
|
||||
w.endMessage(errWriteClosed)
|
||||
_ = w.endMessage(errWriteClosed)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -795,7 +810,7 @@ func (c *Conn) advanceFrame() (int, error) {
|
||||
// 1. Skip remainder of previous frame.
|
||||
|
||||
if c.readRemaining > 0 {
|
||||
if _, err := io.CopyN(ioutil.Discard, c.br, c.readRemaining); err != nil {
|
||||
if _, err := io.CopyN(io.Discard, c.br, c.readRemaining); err != nil {
|
||||
return noFrame, err
|
||||
}
|
||||
}
|
||||
@ -817,7 +832,9 @@ func (c *Conn) advanceFrame() (int, error) {
|
||||
rsv2 := p[0]&rsv2Bit != 0
|
||||
rsv3 := p[0]&rsv3Bit != 0
|
||||
mask := p[1]&maskBit != 0
|
||||
c.setReadRemaining(int64(p[1] & 0x7f))
|
||||
if err := c.setReadRemaining(int64(p[1] & 0x7f)); err != nil {
|
||||
return noFrame, err
|
||||
}
|
||||
|
||||
c.readDecompress = false
|
||||
if rsv1 {
|
||||
@ -922,7 +939,9 @@ func (c *Conn) advanceFrame() (int, error) {
|
||||
}
|
||||
|
||||
if c.readLimit > 0 && c.readLength > c.readLimit {
|
||||
c.WriteControl(CloseMessage, FormatCloseMessage(CloseMessageTooBig, ""), time.Now().Add(writeWait))
|
||||
if err := c.WriteControl(CloseMessage, FormatCloseMessage(CloseMessageTooBig, ""), time.Now().Add(writeWait)); err != nil {
|
||||
return noFrame, err
|
||||
}
|
||||
return noFrame, ErrReadLimit
|
||||
}
|
||||
|
||||
@ -934,7 +953,9 @@ func (c *Conn) advanceFrame() (int, error) {
|
||||
var payload []byte
|
||||
if c.readRemaining > 0 {
|
||||
payload, err = c.read(int(c.readRemaining))
|
||||
c.setReadRemaining(0)
|
||||
if err := c.setReadRemaining(0); err != nil {
|
||||
return noFrame, err
|
||||
}
|
||||
if err != nil {
|
||||
return noFrame, err
|
||||
}
|
||||
@ -981,7 +1002,9 @@ func (c *Conn) handleProtocolError(message string) error {
|
||||
if len(data) > maxControlFramePayloadSize {
|
||||
data = data[:maxControlFramePayloadSize]
|
||||
}
|
||||
c.WriteControl(CloseMessage, data, time.Now().Add(writeWait))
|
||||
if err := c.WriteControl(CloseMessage, data, time.Now().Add(writeWait)); err != nil {
|
||||
return err
|
||||
}
|
||||
return errors.New("websocket: " + message)
|
||||
}
|
||||
|
||||
@ -998,7 +1021,9 @@ func (c *Conn) handleProtocolError(message string) error {
|
||||
func (c *Conn) NextReader() (messageType int, r io.Reader, err error) {
|
||||
// Close previous reader, only relevant for decompression.
|
||||
if c.reader != nil {
|
||||
c.reader.Close()
|
||||
if err := c.reader.Close(); err != nil {
|
||||
log.Printf("websocket: discarding reader close error: %v", err)
|
||||
}
|
||||
c.reader = nil
|
||||
}
|
||||
|
||||
@ -1054,7 +1079,9 @@ func (r *messageReader) Read(b []byte) (int, error) {
|
||||
}
|
||||
rem := c.readRemaining
|
||||
rem -= int64(n)
|
||||
c.setReadRemaining(rem)
|
||||
if err := c.setReadRemaining(rem); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if c.readRemaining > 0 && c.readErr == io.EOF {
|
||||
c.readErr = errUnexpectedEOF
|
||||
}
|
||||
@ -1094,7 +1121,7 @@ func (c *Conn) ReadMessage() (messageType int, p []byte, err error) {
|
||||
if err != nil {
|
||||
return messageType, nil, err
|
||||
}
|
||||
p, err = ioutil.ReadAll(r)
|
||||
p, err = io.ReadAll(r)
|
||||
return messageType, p, err
|
||||
}
|
||||
|
||||
@ -1136,7 +1163,9 @@ func (c *Conn) SetCloseHandler(h func(code int, text string) error) {
|
||||
if h == nil {
|
||||
h = func(code int, text string) error {
|
||||
message := FormatCloseMessage(code, "")
|
||||
c.WriteControl(CloseMessage, message, time.Now().Add(writeWait))
|
||||
if err := c.WriteControl(CloseMessage, message, time.Now().Add(writeWait)); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@ -1161,7 +1190,7 @@ func (c *Conn) SetPingHandler(h func(appData string) error) {
|
||||
err := c.WriteControl(PongMessage, []byte(message), time.Now().Add(writeWait))
|
||||
if err == ErrCloseSent {
|
||||
return nil
|
||||
} else if e, ok := err.(net.Error); ok && e.Temporary() {
|
||||
} else if _, ok := err.(net.Error); ok {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
@ -1189,8 +1218,16 @@ func (c *Conn) SetPongHandler(h func(appData string) error) {
|
||||
c.handlePong = h
|
||||
}
|
||||
|
||||
// NetConn returns the underlying connection that is wrapped by c.
|
||||
// Note that writing to or reading from this connection directly will corrupt the
|
||||
// WebSocket connection.
|
||||
func (c *Conn) NetConn() net.Conn {
|
||||
return c.conn
|
||||
}
|
||||
|
||||
// UnderlyingConn returns the internal net.Conn. This can be used to further
|
||||
// modifications to connection specific flags.
|
||||
// Deprecated: Use the NetConn method.
|
||||
func (c *Conn) UnderlyingConn() net.Conn {
|
||||
return c.conn
|
||||
}
|
||||
|
4
vendor/github.com/gorilla/websocket/mask.go
generated
vendored
4
vendor/github.com/gorilla/websocket/mask.go
generated
vendored
@ -9,6 +9,7 @@ package websocket
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// #nosec G103 -- (CWE-242) Has been audited
|
||||
const wordSize = int(unsafe.Sizeof(uintptr(0)))
|
||||
|
||||
func maskBytes(key [4]byte, pos int, b []byte) int {
|
||||
@ -22,6 +23,7 @@ func maskBytes(key [4]byte, pos int, b []byte) int {
|
||||
}
|
||||
|
||||
// Mask one byte at a time to word boundary.
|
||||
//#nosec G103 -- (CWE-242) Has been audited
|
||||
if n := int(uintptr(unsafe.Pointer(&b[0]))) % wordSize; n != 0 {
|
||||
n = wordSize - n
|
||||
for i := range b[:n] {
|
||||
@ -36,11 +38,13 @@ func maskBytes(key [4]byte, pos int, b []byte) int {
|
||||
for i := range k {
|
||||
k[i] = key[(pos+i)&3]
|
||||
}
|
||||
//#nosec G103 -- (CWE-242) Has been audited
|
||||
kw := *(*uintptr)(unsafe.Pointer(&k))
|
||||
|
||||
// Mask one word at a time.
|
||||
n := (len(b) / wordSize) * wordSize
|
||||
for i := 0; i < n; i += wordSize {
|
||||
//#nosec G103 -- (CWE-242) Has been audited
|
||||
*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&b[0])) + uintptr(i))) ^= kw
|
||||
}
|
||||
|
||||
|
17
vendor/github.com/gorilla/websocket/proxy.go
generated
vendored
17
vendor/github.com/gorilla/websocket/proxy.go
generated
vendored
@ -8,10 +8,13 @@ import (
|
||||
"bufio"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/net/proxy"
|
||||
)
|
||||
|
||||
type netDialerFunc func(network, addr string) (net.Conn, error)
|
||||
@ -21,7 +24,7 @@ func (fn netDialerFunc) Dial(network, addr string) (net.Conn, error) {
|
||||
}
|
||||
|
||||
func init() {
|
||||
proxy_RegisterDialerType("http", func(proxyURL *url.URL, forwardDialer proxy_Dialer) (proxy_Dialer, error) {
|
||||
proxy.RegisterDialerType("http", func(proxyURL *url.URL, forwardDialer proxy.Dialer) (proxy.Dialer, error) {
|
||||
return &httpProxyDialer{proxyURL: proxyURL, forwardDial: forwardDialer.Dial}, nil
|
||||
})
|
||||
}
|
||||
@ -55,7 +58,9 @@ func (hpd *httpProxyDialer) Dial(network string, addr string) (net.Conn, error)
|
||||
}
|
||||
|
||||
if err := connectReq.Write(conn); err != nil {
|
||||
conn.Close()
|
||||
if err := conn.Close(); err != nil {
|
||||
log.Printf("httpProxyDialer: failed to close connection: %v", err)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -64,12 +69,16 @@ func (hpd *httpProxyDialer) Dial(network string, addr string) (net.Conn, error)
|
||||
br := bufio.NewReader(conn)
|
||||
resp, err := http.ReadResponse(br, connectReq)
|
||||
if err != nil {
|
||||
conn.Close()
|
||||
if err := conn.Close(); err != nil {
|
||||
log.Printf("httpProxyDialer: failed to close connection: %v", err)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
conn.Close()
|
||||
if err := conn.Close(); err != nil {
|
||||
log.Printf("httpProxyDialer: failed to close connection: %v", err)
|
||||
}
|
||||
f := strings.SplitN(resp.Status, " ", 2)
|
||||
return nil, errors.New(f[1])
|
||||
}
|
||||
|
42
vendor/github.com/gorilla/websocket/server.go
generated
vendored
42
vendor/github.com/gorilla/websocket/server.go
generated
vendored
@ -8,6 +8,7 @@ import (
|
||||
"bufio"
|
||||
"errors"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
@ -154,8 +155,8 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade
|
||||
}
|
||||
|
||||
challengeKey := r.Header.Get("Sec-Websocket-Key")
|
||||
if challengeKey == "" {
|
||||
return u.returnError(w, r, http.StatusBadRequest, "websocket: not a websocket handshake: 'Sec-WebSocket-Key' header is missing or blank")
|
||||
if !isValidChallengeKey(challengeKey) {
|
||||
return u.returnError(w, r, http.StatusBadRequest, "websocket: not a websocket handshake: 'Sec-WebSocket-Key' header must be Base64 encoded value of 16-byte in length")
|
||||
}
|
||||
|
||||
subprotocol := u.selectSubprotocol(r, responseHeader)
|
||||
@ -183,7 +184,9 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade
|
||||
}
|
||||
|
||||
if brw.Reader.Buffered() > 0 {
|
||||
netConn.Close()
|
||||
if err := netConn.Close(); err != nil {
|
||||
log.Printf("websocket: failed to close network connection: %v", err)
|
||||
}
|
||||
return nil, errors.New("websocket: client sent data before handshake is complete")
|
||||
}
|
||||
|
||||
@ -248,17 +251,34 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade
|
||||
p = append(p, "\r\n"...)
|
||||
|
||||
// Clear deadlines set by HTTP server.
|
||||
netConn.SetDeadline(time.Time{})
|
||||
if err := netConn.SetDeadline(time.Time{}); err != nil {
|
||||
if err := netConn.Close(); err != nil {
|
||||
log.Printf("websocket: failed to close network connection: %v", err)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if u.HandshakeTimeout > 0 {
|
||||
netConn.SetWriteDeadline(time.Now().Add(u.HandshakeTimeout))
|
||||
if err := netConn.SetWriteDeadline(time.Now().Add(u.HandshakeTimeout)); err != nil {
|
||||
if err := netConn.Close(); err != nil {
|
||||
log.Printf("websocket: failed to close network connection: %v", err)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if _, err = netConn.Write(p); err != nil {
|
||||
netConn.Close()
|
||||
if err := netConn.Close(); err != nil {
|
||||
log.Printf("websocket: failed to close network connection: %v", err)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
if u.HandshakeTimeout > 0 {
|
||||
netConn.SetWriteDeadline(time.Time{})
|
||||
if err := netConn.SetWriteDeadline(time.Time{}); err != nil {
|
||||
if err := netConn.Close(); err != nil {
|
||||
log.Printf("websocket: failed to close network connection: %v", err)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return c, nil
|
||||
@ -356,8 +376,12 @@ func bufioWriterBuffer(originalWriter io.Writer, bw *bufio.Writer) []byte {
|
||||
// bufio.Writer's underlying writer.
|
||||
var wh writeHook
|
||||
bw.Reset(&wh)
|
||||
bw.WriteByte(0)
|
||||
bw.Flush()
|
||||
if err := bw.WriteByte(0); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if err := bw.Flush(); err != nil {
|
||||
log.Printf("websocket: bufioWriterBuffer: Flush: %v", err)
|
||||
}
|
||||
|
||||
bw.Reset(originalWriter)
|
||||
|
||||
|
3
vendor/github.com/gorilla/websocket/tls_handshake.go
generated
vendored
3
vendor/github.com/gorilla/websocket/tls_handshake.go
generated
vendored
@ -1,6 +1,3 @@
|
||||
//go:build go1.17
|
||||
// +build go1.17
|
||||
|
||||
package websocket
|
||||
|
||||
import (
|
||||
|
21
vendor/github.com/gorilla/websocket/tls_handshake_116.go
generated
vendored
21
vendor/github.com/gorilla/websocket/tls_handshake_116.go
generated
vendored
@ -1,21 +0,0 @@
|
||||
//go:build !go1.17
|
||||
// +build !go1.17
|
||||
|
||||
package websocket
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
)
|
||||
|
||||
func doHandshake(ctx context.Context, tlsConn *tls.Conn, cfg *tls.Config) error {
|
||||
if err := tlsConn.Handshake(); err != nil {
|
||||
return err
|
||||
}
|
||||
if !cfg.InsecureSkipVerify {
|
||||
if err := tlsConn.VerifyHostname(cfg.ServerName); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
19
vendor/github.com/gorilla/websocket/util.go
generated
vendored
19
vendor/github.com/gorilla/websocket/util.go
generated
vendored
@ -6,7 +6,7 @@ package websocket
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"crypto/sha1"
|
||||
"crypto/sha1" //#nosec G505 -- (CWE-327) https://datatracker.ietf.org/doc/html/rfc6455#page-54
|
||||
"encoding/base64"
|
||||
"io"
|
||||
"net/http"
|
||||
@ -17,7 +17,7 @@ import (
|
||||
var keyGUID = []byte("258EAFA5-E914-47DA-95CA-C5AB0DC85B11")
|
||||
|
||||
func computeAcceptKey(challengeKey string) string {
|
||||
h := sha1.New()
|
||||
h := sha1.New() //#nosec G401 -- (CWE-326) https://datatracker.ietf.org/doc/html/rfc6455#page-54
|
||||
h.Write([]byte(challengeKey))
|
||||
h.Write(keyGUID)
|
||||
return base64.StdEncoding.EncodeToString(h.Sum(nil))
|
||||
@ -281,3 +281,18 @@ headers:
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// isValidChallengeKey checks if the argument meets RFC6455 specification.
|
||||
func isValidChallengeKey(s string) bool {
|
||||
// From RFC6455:
|
||||
//
|
||||
// A |Sec-WebSocket-Key| header field with a base64-encoded (see
|
||||
// Section 4 of [RFC4648]) value that, when decoded, is 16 bytes in
|
||||
// length.
|
||||
|
||||
if s == "" {
|
||||
return false
|
||||
}
|
||||
decoded, err := base64.StdEncoding.DecodeString(s)
|
||||
return err == nil && len(decoded) == 16
|
||||
}
|
||||
|
473
vendor/github.com/gorilla/websocket/x_net_proxy.go
generated
vendored
473
vendor/github.com/gorilla/websocket/x_net_proxy.go
generated
vendored
@ -1,473 +0,0 @@
|
||||
// Code generated by golang.org/x/tools/cmd/bundle. DO NOT EDIT.
|
||||
//go:generate bundle -o x_net_proxy.go golang.org/x/net/proxy
|
||||
|
||||
// Package proxy provides support for a variety of protocols to proxy network
|
||||
// data.
|
||||
//
|
||||
|
||||
package websocket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"net"
|
||||
"net/url"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type proxy_direct struct{}
|
||||
|
||||
// Direct is a direct proxy: one that makes network connections directly.
|
||||
var proxy_Direct = proxy_direct{}
|
||||
|
||||
func (proxy_direct) Dial(network, addr string) (net.Conn, error) {
|
||||
return net.Dial(network, addr)
|
||||
}
|
||||
|
||||
// A PerHost directs connections to a default Dialer unless the host name
|
||||
// requested matches one of a number of exceptions.
|
||||
type proxy_PerHost struct {
|
||||
def, bypass proxy_Dialer
|
||||
|
||||
bypassNetworks []*net.IPNet
|
||||
bypassIPs []net.IP
|
||||
bypassZones []string
|
||||
bypassHosts []string
|
||||
}
|
||||
|
||||
// NewPerHost returns a PerHost Dialer that directs connections to either
|
||||
// defaultDialer or bypass, depending on whether the connection matches one of
|
||||
// the configured rules.
|
||||
func proxy_NewPerHost(defaultDialer, bypass proxy_Dialer) *proxy_PerHost {
|
||||
return &proxy_PerHost{
|
||||
def: defaultDialer,
|
||||
bypass: bypass,
|
||||
}
|
||||
}
|
||||
|
||||
// Dial connects to the address addr on the given network through either
|
||||
// defaultDialer or bypass.
|
||||
func (p *proxy_PerHost) Dial(network, addr string) (c net.Conn, err error) {
|
||||
host, _, err := net.SplitHostPort(addr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return p.dialerForRequest(host).Dial(network, addr)
|
||||
}
|
||||
|
||||
func (p *proxy_PerHost) dialerForRequest(host string) proxy_Dialer {
|
||||
if ip := net.ParseIP(host); ip != nil {
|
||||
for _, net := range p.bypassNetworks {
|
||||
if net.Contains(ip) {
|
||||
return p.bypass
|
||||
}
|
||||
}
|
||||
for _, bypassIP := range p.bypassIPs {
|
||||
if bypassIP.Equal(ip) {
|
||||
return p.bypass
|
||||
}
|
||||
}
|
||||
return p.def
|
||||
}
|
||||
|
||||
for _, zone := range p.bypassZones {
|
||||
if strings.HasSuffix(host, zone) {
|
||||
return p.bypass
|
||||
}
|
||||
if host == zone[1:] {
|
||||
// For a zone ".example.com", we match "example.com"
|
||||
// too.
|
||||
return p.bypass
|
||||
}
|
||||
}
|
||||
for _, bypassHost := range p.bypassHosts {
|
||||
if bypassHost == host {
|
||||
return p.bypass
|
||||
}
|
||||
}
|
||||
return p.def
|
||||
}
|
||||
|
||||
// AddFromString parses a string that contains comma-separated values
|
||||
// specifying hosts that should use the bypass proxy. Each value is either an
|
||||
// IP address, a CIDR range, a zone (*.example.com) or a host name
|
||||
// (localhost). A best effort is made to parse the string and errors are
|
||||
// ignored.
|
||||
func (p *proxy_PerHost) AddFromString(s string) {
|
||||
hosts := strings.Split(s, ",")
|
||||
for _, host := range hosts {
|
||||
host = strings.TrimSpace(host)
|
||||
if len(host) == 0 {
|
||||
continue
|
||||
}
|
||||
if strings.Contains(host, "/") {
|
||||
// We assume that it's a CIDR address like 127.0.0.0/8
|
||||
if _, net, err := net.ParseCIDR(host); err == nil {
|
||||
p.AddNetwork(net)
|
||||
}
|
||||
continue
|
||||
}
|
||||
if ip := net.ParseIP(host); ip != nil {
|
||||
p.AddIP(ip)
|
||||
continue
|
||||
}
|
||||
if strings.HasPrefix(host, "*.") {
|
||||
p.AddZone(host[1:])
|
||||
continue
|
||||
}
|
||||
p.AddHost(host)
|
||||
}
|
||||
}
|
||||
|
||||
// AddIP specifies an IP address that will use the bypass proxy. Note that
|
||||
// this will only take effect if a literal IP address is dialed. A connection
|
||||
// to a named host will never match an IP.
|
||||
func (p *proxy_PerHost) AddIP(ip net.IP) {
|
||||
p.bypassIPs = append(p.bypassIPs, ip)
|
||||
}
|
||||
|
||||
// AddNetwork specifies an IP range that will use the bypass proxy. Note that
|
||||
// this will only take effect if a literal IP address is dialed. A connection
|
||||
// to a named host will never match.
|
||||
func (p *proxy_PerHost) AddNetwork(net *net.IPNet) {
|
||||
p.bypassNetworks = append(p.bypassNetworks, net)
|
||||
}
|
||||
|
||||
// AddZone specifies a DNS suffix that will use the bypass proxy. A zone of
|
||||
// "example.com" matches "example.com" and all of its subdomains.
|
||||
func (p *proxy_PerHost) AddZone(zone string) {
|
||||
if strings.HasSuffix(zone, ".") {
|
||||
zone = zone[:len(zone)-1]
|
||||
}
|
||||
if !strings.HasPrefix(zone, ".") {
|
||||
zone = "." + zone
|
||||
}
|
||||
p.bypassZones = append(p.bypassZones, zone)
|
||||
}
|
||||
|
||||
// AddHost specifies a host name that will use the bypass proxy.
|
||||
func (p *proxy_PerHost) AddHost(host string) {
|
||||
if strings.HasSuffix(host, ".") {
|
||||
host = host[:len(host)-1]
|
||||
}
|
||||
p.bypassHosts = append(p.bypassHosts, host)
|
||||
}
|
||||
|
||||
// A Dialer is a means to establish a connection.
|
||||
type proxy_Dialer interface {
|
||||
// Dial connects to the given address via the proxy.
|
||||
Dial(network, addr string) (c net.Conn, err error)
|
||||
}
|
||||
|
||||
// Auth contains authentication parameters that specific Dialers may require.
|
||||
type proxy_Auth struct {
|
||||
User, Password string
|
||||
}
|
||||
|
||||
// FromEnvironment returns the dialer specified by the proxy related variables in
|
||||
// the environment.
|
||||
func proxy_FromEnvironment() proxy_Dialer {
|
||||
allProxy := proxy_allProxyEnv.Get()
|
||||
if len(allProxy) == 0 {
|
||||
return proxy_Direct
|
||||
}
|
||||
|
||||
proxyURL, err := url.Parse(allProxy)
|
||||
if err != nil {
|
||||
return proxy_Direct
|
||||
}
|
||||
proxy, err := proxy_FromURL(proxyURL, proxy_Direct)
|
||||
if err != nil {
|
||||
return proxy_Direct
|
||||
}
|
||||
|
||||
noProxy := proxy_noProxyEnv.Get()
|
||||
if len(noProxy) == 0 {
|
||||
return proxy
|
||||
}
|
||||
|
||||
perHost := proxy_NewPerHost(proxy, proxy_Direct)
|
||||
perHost.AddFromString(noProxy)
|
||||
return perHost
|
||||
}
|
||||
|
||||
// proxySchemes is a map from URL schemes to a function that creates a Dialer
|
||||
// from a URL with such a scheme.
|
||||
var proxy_proxySchemes map[string]func(*url.URL, proxy_Dialer) (proxy_Dialer, error)
|
||||
|
||||
// RegisterDialerType takes a URL scheme and a function to generate Dialers from
|
||||
// a URL with that scheme and a forwarding Dialer. Registered schemes are used
|
||||
// by FromURL.
|
||||
func proxy_RegisterDialerType(scheme string, f func(*url.URL, proxy_Dialer) (proxy_Dialer, error)) {
|
||||
if proxy_proxySchemes == nil {
|
||||
proxy_proxySchemes = make(map[string]func(*url.URL, proxy_Dialer) (proxy_Dialer, error))
|
||||
}
|
||||
proxy_proxySchemes[scheme] = f
|
||||
}
|
||||
|
||||
// FromURL returns a Dialer given a URL specification and an underlying
|
||||
// Dialer for it to make network requests.
|
||||
func proxy_FromURL(u *url.URL, forward proxy_Dialer) (proxy_Dialer, error) {
|
||||
var auth *proxy_Auth
|
||||
if u.User != nil {
|
||||
auth = new(proxy_Auth)
|
||||
auth.User = u.User.Username()
|
||||
if p, ok := u.User.Password(); ok {
|
||||
auth.Password = p
|
||||
}
|
||||
}
|
||||
|
||||
switch u.Scheme {
|
||||
case "socks5":
|
||||
return proxy_SOCKS5("tcp", u.Host, auth, forward)
|
||||
}
|
||||
|
||||
// If the scheme doesn't match any of the built-in schemes, see if it
|
||||
// was registered by another package.
|
||||
if proxy_proxySchemes != nil {
|
||||
if f, ok := proxy_proxySchemes[u.Scheme]; ok {
|
||||
return f(u, forward)
|
||||
}
|
||||
}
|
||||
|
||||
return nil, errors.New("proxy: unknown scheme: " + u.Scheme)
|
||||
}
|
||||
|
||||
var (
|
||||
proxy_allProxyEnv = &proxy_envOnce{
|
||||
names: []string{"ALL_PROXY", "all_proxy"},
|
||||
}
|
||||
proxy_noProxyEnv = &proxy_envOnce{
|
||||
names: []string{"NO_PROXY", "no_proxy"},
|
||||
}
|
||||
)
|
||||
|
||||
// envOnce looks up an environment variable (optionally by multiple
|
||||
// names) once. It mitigates expensive lookups on some platforms
|
||||
// (e.g. Windows).
|
||||
// (Borrowed from net/http/transport.go)
|
||||
type proxy_envOnce struct {
|
||||
names []string
|
||||
once sync.Once
|
||||
val string
|
||||
}
|
||||
|
||||
func (e *proxy_envOnce) Get() string {
|
||||
e.once.Do(e.init)
|
||||
return e.val
|
||||
}
|
||||
|
||||
func (e *proxy_envOnce) init() {
|
||||
for _, n := range e.names {
|
||||
e.val = os.Getenv(n)
|
||||
if e.val != "" {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SOCKS5 returns a Dialer that makes SOCKSv5 connections to the given address
|
||||
// with an optional username and password. See RFC 1928 and RFC 1929.
|
||||
func proxy_SOCKS5(network, addr string, auth *proxy_Auth, forward proxy_Dialer) (proxy_Dialer, error) {
|
||||
s := &proxy_socks5{
|
||||
network: network,
|
||||
addr: addr,
|
||||
forward: forward,
|
||||
}
|
||||
if auth != nil {
|
||||
s.user = auth.User
|
||||
s.password = auth.Password
|
||||
}
|
||||
|
||||
return s, nil
|
||||
}
|
||||
|
||||
type proxy_socks5 struct {
|
||||
user, password string
|
||||
network, addr string
|
||||
forward proxy_Dialer
|
||||
}
|
||||
|
||||
const proxy_socks5Version = 5
|
||||
|
||||
const (
|
||||
proxy_socks5AuthNone = 0
|
||||
proxy_socks5AuthPassword = 2
|
||||
)
|
||||
|
||||
const proxy_socks5Connect = 1
|
||||
|
||||
const (
|
||||
proxy_socks5IP4 = 1
|
||||
proxy_socks5Domain = 3
|
||||
proxy_socks5IP6 = 4
|
||||
)
|
||||
|
||||
var proxy_socks5Errors = []string{
|
||||
"",
|
||||
"general failure",
|
||||
"connection forbidden",
|
||||
"network unreachable",
|
||||
"host unreachable",
|
||||
"connection refused",
|
||||
"TTL expired",
|
||||
"command not supported",
|
||||
"address type not supported",
|
||||
}
|
||||
|
||||
// Dial connects to the address addr on the given network via the SOCKS5 proxy.
|
||||
func (s *proxy_socks5) Dial(network, addr string) (net.Conn, error) {
|
||||
switch network {
|
||||
case "tcp", "tcp6", "tcp4":
|
||||
default:
|
||||
return nil, errors.New("proxy: no support for SOCKS5 proxy connections of type " + network)
|
||||
}
|
||||
|
||||
conn, err := s.forward.Dial(s.network, s.addr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := s.connect(conn, addr); err != nil {
|
||||
conn.Close()
|
||||
return nil, err
|
||||
}
|
||||
return conn, nil
|
||||
}
|
||||
|
||||
// connect takes an existing connection to a socks5 proxy server,
|
||||
// and commands the server to extend that connection to target,
|
||||
// which must be a canonical address with a host and port.
|
||||
func (s *proxy_socks5) connect(conn net.Conn, target string) error {
|
||||
host, portStr, err := net.SplitHostPort(target)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
port, err := strconv.Atoi(portStr)
|
||||
if err != nil {
|
||||
return errors.New("proxy: failed to parse port number: " + portStr)
|
||||
}
|
||||
if port < 1 || port > 0xffff {
|
||||
return errors.New("proxy: port number out of range: " + portStr)
|
||||
}
|
||||
|
||||
// the size here is just an estimate
|
||||
buf := make([]byte, 0, 6+len(host))
|
||||
|
||||
buf = append(buf, proxy_socks5Version)
|
||||
if len(s.user) > 0 && len(s.user) < 256 && len(s.password) < 256 {
|
||||
buf = append(buf, 2 /* num auth methods */, proxy_socks5AuthNone, proxy_socks5AuthPassword)
|
||||
} else {
|
||||
buf = append(buf, 1 /* num auth methods */, proxy_socks5AuthNone)
|
||||
}
|
||||
|
||||
if _, err := conn.Write(buf); err != nil {
|
||||
return errors.New("proxy: failed to write greeting to SOCKS5 proxy at " + s.addr + ": " + err.Error())
|
||||
}
|
||||
|
||||
if _, err := io.ReadFull(conn, buf[:2]); err != nil {
|
||||
return errors.New("proxy: failed to read greeting from SOCKS5 proxy at " + s.addr + ": " + err.Error())
|
||||
}
|
||||
if buf[0] != 5 {
|
||||
return errors.New("proxy: SOCKS5 proxy at " + s.addr + " has unexpected version " + strconv.Itoa(int(buf[0])))
|
||||
}
|
||||
if buf[1] == 0xff {
|
||||
return errors.New("proxy: SOCKS5 proxy at " + s.addr + " requires authentication")
|
||||
}
|
||||
|
||||
// See RFC 1929
|
||||
if buf[1] == proxy_socks5AuthPassword {
|
||||
buf = buf[:0]
|
||||
buf = append(buf, 1 /* password protocol version */)
|
||||
buf = append(buf, uint8(len(s.user)))
|
||||
buf = append(buf, s.user...)
|
||||
buf = append(buf, uint8(len(s.password)))
|
||||
buf = append(buf, s.password...)
|
||||
|
||||
if _, err := conn.Write(buf); err != nil {
|
||||
return errors.New("proxy: failed to write authentication request to SOCKS5 proxy at " + s.addr + ": " + err.Error())
|
||||
}
|
||||
|
||||
if _, err := io.ReadFull(conn, buf[:2]); err != nil {
|
||||
return errors.New("proxy: failed to read authentication reply from SOCKS5 proxy at " + s.addr + ": " + err.Error())
|
||||
}
|
||||
|
||||
if buf[1] != 0 {
|
||||
return errors.New("proxy: SOCKS5 proxy at " + s.addr + " rejected username/password")
|
||||
}
|
||||
}
|
||||
|
||||
buf = buf[:0]
|
||||
buf = append(buf, proxy_socks5Version, proxy_socks5Connect, 0 /* reserved */)
|
||||
|
||||
if ip := net.ParseIP(host); ip != nil {
|
||||
if ip4 := ip.To4(); ip4 != nil {
|
||||
buf = append(buf, proxy_socks5IP4)
|
||||
ip = ip4
|
||||
} else {
|
||||
buf = append(buf, proxy_socks5IP6)
|
||||
}
|
||||
buf = append(buf, ip...)
|
||||
} else {
|
||||
if len(host) > 255 {
|
||||
return errors.New("proxy: destination host name too long: " + host)
|
||||
}
|
||||
buf = append(buf, proxy_socks5Domain)
|
||||
buf = append(buf, byte(len(host)))
|
||||
buf = append(buf, host...)
|
||||
}
|
||||
buf = append(buf, byte(port>>8), byte(port))
|
||||
|
||||
if _, err := conn.Write(buf); err != nil {
|
||||
return errors.New("proxy: failed to write connect request to SOCKS5 proxy at " + s.addr + ": " + err.Error())
|
||||
}
|
||||
|
||||
if _, err := io.ReadFull(conn, buf[:4]); err != nil {
|
||||
return errors.New("proxy: failed to read connect reply from SOCKS5 proxy at " + s.addr + ": " + err.Error())
|
||||
}
|
||||
|
||||
failure := "unknown error"
|
||||
if int(buf[1]) < len(proxy_socks5Errors) {
|
||||
failure = proxy_socks5Errors[buf[1]]
|
||||
}
|
||||
|
||||
if len(failure) > 0 {
|
||||
return errors.New("proxy: SOCKS5 proxy at " + s.addr + " failed to connect: " + failure)
|
||||
}
|
||||
|
||||
bytesToDiscard := 0
|
||||
switch buf[3] {
|
||||
case proxy_socks5IP4:
|
||||
bytesToDiscard = net.IPv4len
|
||||
case proxy_socks5IP6:
|
||||
bytesToDiscard = net.IPv6len
|
||||
case proxy_socks5Domain:
|
||||
_, err := io.ReadFull(conn, buf[:1])
|
||||
if err != nil {
|
||||
return errors.New("proxy: failed to read domain length from SOCKS5 proxy at " + s.addr + ": " + err.Error())
|
||||
}
|
||||
bytesToDiscard = int(buf[0])
|
||||
default:
|
||||
return errors.New("proxy: got unknown address type " + strconv.Itoa(int(buf[3])) + " from SOCKS5 proxy at " + s.addr)
|
||||
}
|
||||
|
||||
if cap(buf) < bytesToDiscard {
|
||||
buf = make([]byte, bytesToDiscard)
|
||||
} else {
|
||||
buf = buf[:bytesToDiscard]
|
||||
}
|
||||
if _, err := io.ReadFull(conn, buf); err != nil {
|
||||
return errors.New("proxy: failed to read address from SOCKS5 proxy at " + s.addr + ": " + err.Error())
|
||||
}
|
||||
|
||||
// Also need to discard the port number
|
||||
if _, err := io.ReadFull(conn, buf[:2]); err != nil {
|
||||
return errors.New("proxy: failed to read port from SOCKS5 proxy at " + s.addr + ": " + err.Error())
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
7
vendor/go.uber.org/multierr/CHANGELOG.md
generated
vendored
7
vendor/go.uber.org/multierr/CHANGELOG.md
generated
vendored
@ -1,6 +1,13 @@
|
||||
Releases
|
||||
========
|
||||
|
||||
v1.11.0 (2023-03-28)
|
||||
====================
|
||||
- `Errors` now supports any error that implements multiple-error
|
||||
interface.
|
||||
- Add `Every` function to allow checking if all errors in the chain
|
||||
satisfies `errors.Is` against the target error.
|
||||
|
||||
v1.10.0 (2023-03-08)
|
||||
====================
|
||||
|
||||
|
32
vendor/go.uber.org/multierr/error.go
generated
vendored
32
vendor/go.uber.org/multierr/error.go
generated
vendored
@ -142,6 +142,7 @@ package multierr // import "go.uber.org/multierr"
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
@ -194,23 +195,7 @@ type errorGroup interface {
|
||||
//
|
||||
// Callers of this function are free to modify the returned slice.
|
||||
func Errors(err error) []error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Note that we're casting to multiError, not errorGroup. Our contract is
|
||||
// that returned errors MAY implement errorGroup. Errors, however, only
|
||||
// has special behavior for multierr-specific error objects.
|
||||
//
|
||||
// This behavior can be expanded in the future but I think it's prudent to
|
||||
// start with as little as possible in terms of contract and possibility
|
||||
// of misuse.
|
||||
eg, ok := err.(*multiError)
|
||||
if !ok {
|
||||
return []error{err}
|
||||
}
|
||||
|
||||
return append(([]error)(nil), eg.Errors()...)
|
||||
return extractErrors(err)
|
||||
}
|
||||
|
||||
// multiError is an error that holds one or more errors.
|
||||
@ -225,8 +210,6 @@ type multiError struct {
|
||||
errors []error
|
||||
}
|
||||
|
||||
var _ errorGroup = (*multiError)(nil)
|
||||
|
||||
// Errors returns the list of underlying errors.
|
||||
//
|
||||
// This slice MUST NOT be modified.
|
||||
@ -252,6 +235,17 @@ func (merr *multiError) Error() string {
|
||||
return result
|
||||
}
|
||||
|
||||
// Every compares every error in the given err against the given target error
|
||||
// using [errors.Is], and returns true only if every comparison returned true.
|
||||
func Every(err error, target error) bool {
|
||||
for _, e := range extractErrors(err) {
|
||||
if !errors.Is(e, target) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (merr *multiError) Format(f fmt.State, c rune) {
|
||||
if c == 'v' && f.Flag('+') {
|
||||
merr.writeMultiline(f)
|
||||
|
19
vendor/go.uber.org/multierr/error_post_go120.go
generated
vendored
19
vendor/go.uber.org/multierr/error_post_go120.go
generated
vendored
@ -27,3 +27,22 @@ package multierr
|
||||
func (merr *multiError) Unwrap() []error {
|
||||
return merr.Errors()
|
||||
}
|
||||
|
||||
type multipleErrors interface {
|
||||
Unwrap() []error
|
||||
}
|
||||
|
||||
func extractErrors(err error) []error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// check if the given err is an Unwrapable error that
|
||||
// implements multipleErrors interface.
|
||||
eg, ok := err.(multipleErrors)
|
||||
if !ok {
|
||||
return []error{err}
|
||||
}
|
||||
|
||||
return append(([]error)(nil), eg.Unwrap()...)
|
||||
}
|
||||
|
20
vendor/go.uber.org/multierr/error_pre_go120.go
generated
vendored
20
vendor/go.uber.org/multierr/error_pre_go120.go
generated
vendored
@ -57,3 +57,23 @@ func (merr *multiError) Is(target error) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func extractErrors(err error) []error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Note that we're casting to multiError, not errorGroup. Our contract is
|
||||
// that returned errors MAY implement errorGroup. Errors, however, only
|
||||
// has special behavior for multierr-specific error objects.
|
||||
//
|
||||
// This behavior can be expanded in the future but I think it's prudent to
|
||||
// start with as little as possible in terms of contract and possibility
|
||||
// of misuse.
|
||||
eg, ok := err.(*multiError)
|
||||
if !ok {
|
||||
return []error{err}
|
||||
}
|
||||
|
||||
return append(([]error)(nil), eg.Errors()...)
|
||||
}
|
||||
|
2
vendor/go.uber.org/zap/.golangci.yml
generated
vendored
2
vendor/go.uber.org/zap/.golangci.yml
generated
vendored
@ -17,7 +17,7 @@ linters:
|
||||
- unused
|
||||
|
||||
# Our own extras:
|
||||
- gofmt
|
||||
- gofumpt
|
||||
- nolintlint # lints nolint directives
|
||||
- revive
|
||||
|
||||
|
10
vendor/go.uber.org/zap/.readme.tmpl
generated
vendored
10
vendor/go.uber.org/zap/.readme.tmpl
generated
vendored
@ -1,7 +1,15 @@
|
||||
# :zap: zap [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov]
|
||||
|
||||
<div align="center">
|
||||
|
||||
Blazing fast, structured, leveled logging in Go.
|
||||
|
||||

|
||||
|
||||
[![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov]
|
||||
|
||||
</div>
|
||||
|
||||
## Installation
|
||||
|
||||
`go get -u go.uber.org/zap`
|
||||
@ -92,7 +100,7 @@ standard.
|
||||
|
||||
<hr>
|
||||
|
||||
Released under the [MIT License](LICENSE.txt).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
<sup id="footnote-versions">1</sup> In particular, keep in mind that we may be
|
||||
benchmarking against slightly older versions of other packages. Versions are
|
||||
|
54
vendor/go.uber.org/zap/CHANGELOG.md
generated
vendored
54
vendor/go.uber.org/zap/CHANGELOG.md
generated
vendored
@ -3,14 +3,30 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## 1.27.0 (20 Feb 2024)
|
||||
Enhancements:
|
||||
* [#1378][]: Add `WithLazy` method for `SugaredLogger`.
|
||||
* [#1399][]: zaptest: Add `NewTestingWriter` for customizing TestingWriter with more flexibility than `NewLogger`.
|
||||
* [#1406][]: Add `Log`, `Logw`, `Logln` methods for `SugaredLogger`.
|
||||
* [#1416][]: Add `WithPanicHook` option for testing panic logs.
|
||||
|
||||
Thanks to @defval, @dimmo, @arxeiss, and @MKrupauskas for their contributions to this release.
|
||||
|
||||
[#1378]: https://github.com/uber-go/zap/pull/1378
|
||||
[#1399]: https://github.com/uber-go/zap/pull/1399
|
||||
[#1406]: https://github.com/uber-go/zap/pull/1406
|
||||
[#1416]: https://github.com/uber-go/zap/pull/1416
|
||||
|
||||
## 1.26.0 (14 Sep 2023)
|
||||
Enhancements:
|
||||
* [#1297][]: Add Dict as a Field.
|
||||
* [#1319][]: Add `WithLazy` method to `Logger` which lazily evaluates the structured
|
||||
context.
|
||||
* [#1350][]: String encoding is much (~50%) faster now.
|
||||
|
||||
Thanks to @jquirke, @cdvr1993 for their contributions to this release.
|
||||
Thanks to @hhk7734, @jquirke, and @cdvr1993 for their contributions to this release.
|
||||
|
||||
[#1297]: https://github.com/uber-go/zap/pull/1297
|
||||
[#1319]: https://github.com/uber-go/zap/pull/1319
|
||||
[#1350]: https://github.com/uber-go/zap/pull/1350
|
||||
|
||||
@ -25,7 +41,7 @@ Enhancements:
|
||||
* [#1273][]: Add `Name` to `Logger` which returns the Logger's name if one is set.
|
||||
* [#1281][]: Add `zap/exp/expfield` package which contains helper methods
|
||||
`Str` and `Strs` for constructing String-like zap.Fields.
|
||||
* [#1310][]: Reduce stack size on `Any`.
|
||||
* [#1310][]: Reduce stack size on `Any`.
|
||||
|
||||
Thanks to @knight42, @dzakaammar, @bcspragu, and @rexywork for their contributions
|
||||
to this release.
|
||||
@ -352,7 +368,7 @@ to this release.
|
||||
[#675]: https://github.com/uber-go/zap/pull/675
|
||||
[#704]: https://github.com/uber-go/zap/pull/704
|
||||
|
||||
## v1.9.1 (06 Aug 2018)
|
||||
## 1.9.1 (06 Aug 2018)
|
||||
|
||||
Bugfixes:
|
||||
|
||||
@ -360,7 +376,7 @@ Bugfixes:
|
||||
|
||||
[#614]: https://github.com/uber-go/zap/pull/614
|
||||
|
||||
## v1.9.0 (19 Jul 2018)
|
||||
## 1.9.0 (19 Jul 2018)
|
||||
|
||||
Enhancements:
|
||||
* [#602][]: Reduce number of allocations when logging with reflection.
|
||||
@ -373,7 +389,7 @@ Thanks to @nfarah86, @AlekSi, @JeanMertz, @philippgille, @etsangsplk, and
|
||||
[#572]: https://github.com/uber-go/zap/pull/572
|
||||
[#606]: https://github.com/uber-go/zap/pull/606
|
||||
|
||||
## v1.8.0 (13 Apr 2018)
|
||||
## 1.8.0 (13 Apr 2018)
|
||||
|
||||
Enhancements:
|
||||
* [#508][]: Make log level configurable when redirecting the standard
|
||||
@ -391,14 +407,14 @@ Thanks to @DiSiqueira and @djui for their contributions to this release.
|
||||
[#577]: https://github.com/uber-go/zap/pull/577
|
||||
[#574]: https://github.com/uber-go/zap/pull/574
|
||||
|
||||
## v1.7.1 (25 Sep 2017)
|
||||
## 1.7.1 (25 Sep 2017)
|
||||
|
||||
Bugfixes:
|
||||
* [#504][]: Store strings when using AddByteString with the map encoder.
|
||||
|
||||
[#504]: https://github.com/uber-go/zap/pull/504
|
||||
|
||||
## v1.7.0 (21 Sep 2017)
|
||||
## 1.7.0 (21 Sep 2017)
|
||||
|
||||
Enhancements:
|
||||
|
||||
@ -407,7 +423,7 @@ Enhancements:
|
||||
|
||||
[#487]: https://github.com/uber-go/zap/pull/487
|
||||
|
||||
## v1.6.0 (30 Aug 2017)
|
||||
## 1.6.0 (30 Aug 2017)
|
||||
|
||||
Enhancements:
|
||||
|
||||
@ -418,7 +434,7 @@ Enhancements:
|
||||
[#490]: https://github.com/uber-go/zap/pull/490
|
||||
[#491]: https://github.com/uber-go/zap/pull/491
|
||||
|
||||
## v1.5.0 (22 Jul 2017)
|
||||
## 1.5.0 (22 Jul 2017)
|
||||
|
||||
Enhancements:
|
||||
|
||||
@ -436,7 +452,7 @@ Thanks to @richard-tunein and @pavius for their contributions to this release.
|
||||
[#460]: https://github.com/uber-go/zap/pull/460
|
||||
[#470]: https://github.com/uber-go/zap/pull/470
|
||||
|
||||
## v1.4.1 (08 Jun 2017)
|
||||
## 1.4.1 (08 Jun 2017)
|
||||
|
||||
This release fixes two bugs.
|
||||
|
||||
@ -448,7 +464,7 @@ Bugfixes:
|
||||
[#435]: https://github.com/uber-go/zap/pull/435
|
||||
[#444]: https://github.com/uber-go/zap/pull/444
|
||||
|
||||
## v1.4.0 (12 May 2017)
|
||||
## 1.4.0 (12 May 2017)
|
||||
|
||||
This release adds a few small features and is fully backward-compatible.
|
||||
|
||||
@ -464,7 +480,7 @@ Enhancements:
|
||||
[#425]: https://github.com/uber-go/zap/pull/425
|
||||
[#431]: https://github.com/uber-go/zap/pull/431
|
||||
|
||||
## v1.3.0 (25 Apr 2017)
|
||||
## 1.3.0 (25 Apr 2017)
|
||||
|
||||
This release adds an enhancement to zap's testing helpers as well as the
|
||||
ability to marshal an AtomicLevel. It is fully backward-compatible.
|
||||
@ -478,7 +494,7 @@ Enhancements:
|
||||
[#415]: https://github.com/uber-go/zap/pull/415
|
||||
[#416]: https://github.com/uber-go/zap/pull/416
|
||||
|
||||
## v1.2.0 (13 Apr 2017)
|
||||
## 1.2.0 (13 Apr 2017)
|
||||
|
||||
This release adds a gRPC compatibility wrapper. It is fully backward-compatible.
|
||||
|
||||
@ -489,7 +505,7 @@ Enhancements:
|
||||
|
||||
[#402]: https://github.com/uber-go/zap/pull/402
|
||||
|
||||
## v1.1.0 (31 Mar 2017)
|
||||
## 1.1.0 (31 Mar 2017)
|
||||
|
||||
This release fixes two bugs and adds some enhancements to zap's testing helpers.
|
||||
It is fully backward-compatible.
|
||||
@ -510,7 +526,7 @@ Thanks to @moitias for contributing to this release.
|
||||
[#396]: https://github.com/uber-go/zap/pull/396
|
||||
[#386]: https://github.com/uber-go/zap/pull/386
|
||||
|
||||
## v1.0.0 (14 Mar 2017)
|
||||
## 1.0.0 (14 Mar 2017)
|
||||
|
||||
This is zap's first stable release. All exported APIs are now final, and no
|
||||
further breaking changes will be made in the 1.x release series. Anyone using a
|
||||
@ -569,7 +585,7 @@ contributions to this release.
|
||||
[#365]: https://github.com/uber-go/zap/pull/365
|
||||
[#372]: https://github.com/uber-go/zap/pull/372
|
||||
|
||||
## v1.0.0-rc.3 (7 Mar 2017)
|
||||
## 1.0.0-rc.3 (7 Mar 2017)
|
||||
|
||||
This is the third release candidate for zap's stable release. There are no
|
||||
breaking changes.
|
||||
@ -595,7 +611,7 @@ Thanks to @ansel1 and @suyash for their contributions to this release.
|
||||
[#353]: https://github.com/uber-go/zap/pull/353
|
||||
[#311]: https://github.com/uber-go/zap/pull/311
|
||||
|
||||
## v1.0.0-rc.2 (21 Feb 2017)
|
||||
## 1.0.0-rc.2 (21 Feb 2017)
|
||||
|
||||
This is the second release candidate for zap's stable release. It includes two
|
||||
breaking changes.
|
||||
@ -641,7 +657,7 @@ Thanks to @skipor and @chapsuk for their contributions to this release.
|
||||
[#326]: https://github.com/uber-go/zap/pull/326
|
||||
[#300]: https://github.com/uber-go/zap/pull/300
|
||||
|
||||
## v1.0.0-rc.1 (14 Feb 2017)
|
||||
## 1.0.0-rc.1 (14 Feb 2017)
|
||||
|
||||
This is the first release candidate for zap's stable release. There are multiple
|
||||
breaking changes and improvements from the pre-release version. Most notably:
|
||||
@ -661,7 +677,7 @@ breaking changes and improvements from the pre-release version. Most notably:
|
||||
* Sampling is more accurate, and doesn't depend on the standard library's shared
|
||||
timer heap.
|
||||
|
||||
## v0.1.0-beta.1 (6 Feb 2017)
|
||||
## 0.1.0-beta.1 (6 Feb 2017)
|
||||
|
||||
This is a minor version, tagged to allow users to pin to the pre-1.0 APIs and
|
||||
upgrade at their leisure. Since this is the first tagged release, there are no
|
||||
|
0
vendor/go.uber.org/zap/LICENSE.txt → vendor/go.uber.org/zap/LICENSE
generated
vendored
0
vendor/go.uber.org/zap/LICENSE.txt → vendor/go.uber.org/zap/LICENSE
generated
vendored
66
vendor/go.uber.org/zap/README.md
generated
vendored
66
vendor/go.uber.org/zap/README.md
generated
vendored
@ -1,7 +1,16 @@
|
||||
# :zap: zap [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov]
|
||||
# :zap: zap
|
||||
|
||||
|
||||
<div align="center">
|
||||
|
||||
Blazing fast, structured, leveled logging in Go.
|
||||
|
||||

|
||||
|
||||
[![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov]
|
||||
|
||||
</div>
|
||||
|
||||
## Installation
|
||||
|
||||
`go get -u go.uber.org/zap`
|
||||
@ -66,41 +75,44 @@ Log a message and 10 fields:
|
||||
|
||||
| Package | Time | Time % to zap | Objects Allocated |
|
||||
| :------ | :--: | :-----------: | :---------------: |
|
||||
| :zap: zap | 1744 ns/op | +0% | 5 allocs/op
|
||||
| :zap: zap (sugared) | 2483 ns/op | +42% | 10 allocs/op
|
||||
| zerolog | 918 ns/op | -47% | 1 allocs/op
|
||||
| go-kit | 5590 ns/op | +221% | 57 allocs/op
|
||||
| slog | 5640 ns/op | +223% | 40 allocs/op
|
||||
| apex/log | 21184 ns/op | +1115% | 63 allocs/op
|
||||
| logrus | 24338 ns/op | +1296% | 79 allocs/op
|
||||
| log15 | 26054 ns/op | +1394% | 74 allocs/op
|
||||
| :zap: zap | 656 ns/op | +0% | 5 allocs/op
|
||||
| :zap: zap (sugared) | 935 ns/op | +43% | 10 allocs/op
|
||||
| zerolog | 380 ns/op | -42% | 1 allocs/op
|
||||
| go-kit | 2249 ns/op | +243% | 57 allocs/op
|
||||
| slog (LogAttrs) | 2479 ns/op | +278% | 40 allocs/op
|
||||
| slog | 2481 ns/op | +278% | 42 allocs/op
|
||||
| apex/log | 9591 ns/op | +1362% | 63 allocs/op
|
||||
| log15 | 11393 ns/op | +1637% | 75 allocs/op
|
||||
| logrus | 11654 ns/op | +1677% | 79 allocs/op
|
||||
|
||||
Log a message with a logger that already has 10 fields of context:
|
||||
|
||||
| Package | Time | Time % to zap | Objects Allocated |
|
||||
| :------ | :--: | :-----------: | :---------------: |
|
||||
| :zap: zap | 193 ns/op | +0% | 0 allocs/op
|
||||
| :zap: zap (sugared) | 227 ns/op | +18% | 1 allocs/op
|
||||
| zerolog | 81 ns/op | -58% | 0 allocs/op
|
||||
| slog | 322 ns/op | +67% | 0 allocs/op
|
||||
| go-kit | 5377 ns/op | +2686% | 56 allocs/op
|
||||
| apex/log | 19518 ns/op | +10013% | 53 allocs/op
|
||||
| log15 | 19812 ns/op | +10165% | 70 allocs/op
|
||||
| logrus | 21997 ns/op | +11297% | 68 allocs/op
|
||||
| :zap: zap | 67 ns/op | +0% | 0 allocs/op
|
||||
| :zap: zap (sugared) | 84 ns/op | +25% | 1 allocs/op
|
||||
| zerolog | 35 ns/op | -48% | 0 allocs/op
|
||||
| slog | 193 ns/op | +188% | 0 allocs/op
|
||||
| slog (LogAttrs) | 200 ns/op | +199% | 0 allocs/op
|
||||
| go-kit | 2460 ns/op | +3572% | 56 allocs/op
|
||||
| log15 | 9038 ns/op | +13390% | 70 allocs/op
|
||||
| apex/log | 9068 ns/op | +13434% | 53 allocs/op
|
||||
| logrus | 10521 ns/op | +15603% | 68 allocs/op
|
||||
|
||||
Log a static string, without any context or `printf`-style templating:
|
||||
|
||||
| Package | Time | Time % to zap | Objects Allocated |
|
||||
| :------ | :--: | :-----------: | :---------------: |
|
||||
| :zap: zap | 165 ns/op | +0% | 0 allocs/op
|
||||
| :zap: zap (sugared) | 212 ns/op | +28% | 1 allocs/op
|
||||
| zerolog | 95 ns/op | -42% | 0 allocs/op
|
||||
| slog | 296 ns/op | +79% | 0 allocs/op
|
||||
| go-kit | 415 ns/op | +152% | 9 allocs/op
|
||||
| standard library | 422 ns/op | +156% | 2 allocs/op
|
||||
| apex/log | 1601 ns/op | +870% | 5 allocs/op
|
||||
| logrus | 3017 ns/op | +1728% | 23 allocs/op
|
||||
| log15 | 3469 ns/op | +2002% | 20 allocs/op
|
||||
| :zap: zap | 63 ns/op | +0% | 0 allocs/op
|
||||
| :zap: zap (sugared) | 81 ns/op | +29% | 1 allocs/op
|
||||
| zerolog | 32 ns/op | -49% | 0 allocs/op
|
||||
| standard library | 124 ns/op | +97% | 1 allocs/op
|
||||
| slog | 196 ns/op | +211% | 0 allocs/op
|
||||
| slog (LogAttrs) | 200 ns/op | +217% | 0 allocs/op
|
||||
| go-kit | 213 ns/op | +238% | 9 allocs/op
|
||||
| apex/log | 771 ns/op | +1124% | 5 allocs/op
|
||||
| logrus | 1439 ns/op | +2184% | 23 allocs/op
|
||||
| log15 | 2069 ns/op | +3184% | 20 allocs/op
|
||||
|
||||
## Development Status: Stable
|
||||
|
||||
@ -120,7 +132,7 @@ standard.
|
||||
|
||||
<hr>
|
||||
|
||||
Released under the [MIT License](LICENSE.txt).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
<sup id="footnote-versions">1</sup> In particular, keep in mind that we may be
|
||||
benchmarking against slightly older versions of other packages. Versions are
|
||||
|
2
vendor/go.uber.org/zap/buffer/buffer.go
generated
vendored
2
vendor/go.uber.org/zap/buffer/buffer.go
generated
vendored
@ -42,7 +42,7 @@ func (b *Buffer) AppendByte(v byte) {
|
||||
b.bs = append(b.bs, v)
|
||||
}
|
||||
|
||||
// AppendBytes writes a single byte to the Buffer.
|
||||
// AppendBytes writes the given slice of bytes to the Buffer.
|
||||
func (b *Buffer) AppendBytes(v []byte) {
|
||||
b.bs = append(b.bs, v...)
|
||||
}
|
||||
|
2
vendor/go.uber.org/zap/field.go
generated
vendored
2
vendor/go.uber.org/zap/field.go
generated
vendored
@ -460,6 +460,8 @@ func (d dictObject) MarshalLogObject(enc zapcore.ObjectEncoder) error {
|
||||
// - https://github.com/uber-go/zap/pull/1304
|
||||
// - https://github.com/uber-go/zap/pull/1305
|
||||
// - https://github.com/uber-go/zap/pull/1308
|
||||
//
|
||||
// See https://github.com/golang/go/issues/62077 for upstream issue.
|
||||
type anyFieldC[T any] func(string, T) Field
|
||||
|
||||
func (f anyFieldC[T]) Any(key string, val any) Field {
|
||||
|
39
vendor/go.uber.org/zap/logger.go
generated
vendored
39
vendor/go.uber.org/zap/logger.go
generated
vendored
@ -43,6 +43,7 @@ type Logger struct {
|
||||
|
||||
development bool
|
||||
addCaller bool
|
||||
onPanic zapcore.CheckWriteHook // default is WriteThenPanic
|
||||
onFatal zapcore.CheckWriteHook // default is WriteThenFatal
|
||||
|
||||
name string
|
||||
@ -345,27 +346,12 @@ func (log *Logger) check(lvl zapcore.Level, msg string) *zapcore.CheckedEntry {
|
||||
// Set up any required terminal behavior.
|
||||
switch ent.Level {
|
||||
case zapcore.PanicLevel:
|
||||
ce = ce.After(ent, zapcore.WriteThenPanic)
|
||||
ce = ce.After(ent, terminalHookOverride(zapcore.WriteThenPanic, log.onPanic))
|
||||
case zapcore.FatalLevel:
|
||||
onFatal := log.onFatal
|
||||
// nil or WriteThenNoop will lead to continued execution after
|
||||
// a Fatal log entry, which is unexpected. For example,
|
||||
//
|
||||
// f, err := os.Open(..)
|
||||
// if err != nil {
|
||||
// log.Fatal("cannot open", zap.Error(err))
|
||||
// }
|
||||
// fmt.Println(f.Name())
|
||||
//
|
||||
// The f.Name() will panic if we continue execution after the
|
||||
// log.Fatal.
|
||||
if onFatal == nil || onFatal == zapcore.WriteThenNoop {
|
||||
onFatal = zapcore.WriteThenFatal
|
||||
}
|
||||
ce = ce.After(ent, onFatal)
|
||||
ce = ce.After(ent, terminalHookOverride(zapcore.WriteThenFatal, log.onFatal))
|
||||
case zapcore.DPanicLevel:
|
||||
if log.development {
|
||||
ce = ce.After(ent, zapcore.WriteThenPanic)
|
||||
ce = ce.After(ent, terminalHookOverride(zapcore.WriteThenPanic, log.onPanic))
|
||||
}
|
||||
}
|
||||
|
||||
@ -430,3 +416,20 @@ func (log *Logger) check(lvl zapcore.Level, msg string) *zapcore.CheckedEntry {
|
||||
|
||||
return ce
|
||||
}
|
||||
|
||||
func terminalHookOverride(defaultHook, override zapcore.CheckWriteHook) zapcore.CheckWriteHook {
|
||||
// A nil or WriteThenNoop hook will lead to continued execution after
|
||||
// a Panic or Fatal log entry, which is unexpected. For example,
|
||||
//
|
||||
// f, err := os.Open(..)
|
||||
// if err != nil {
|
||||
// log.Fatal("cannot open", zap.Error(err))
|
||||
// }
|
||||
// fmt.Println(f.Name())
|
||||
//
|
||||
// The f.Name() will panic if we continue execution after the log.Fatal.
|
||||
if override == nil || override == zapcore.WriteThenNoop {
|
||||
return defaultHook
|
||||
}
|
||||
return override
|
||||
}
|
||||
|
15
vendor/go.uber.org/zap/options.go
generated
vendored
15
vendor/go.uber.org/zap/options.go
generated
vendored
@ -132,6 +132,21 @@ func IncreaseLevel(lvl zapcore.LevelEnabler) Option {
|
||||
})
|
||||
}
|
||||
|
||||
// WithPanicHook sets a CheckWriteHook to run on Panic/DPanic logs.
|
||||
// Zap will call this hook after writing a log statement with a Panic/DPanic level.
|
||||
//
|
||||
// For example, the following builds a logger that will exit the current
|
||||
// goroutine after writing a Panic/DPanic log message, but it will not start a panic.
|
||||
//
|
||||
// zap.New(core, zap.WithPanicHook(zapcore.WriteThenGoexit))
|
||||
//
|
||||
// This is useful for testing Panic/DPanic log output.
|
||||
func WithPanicHook(hook zapcore.CheckWriteHook) Option {
|
||||
return optionFunc(func(log *Logger) {
|
||||
log.onPanic = hook
|
||||
})
|
||||
}
|
||||
|
||||
// OnFatal sets the action to take on fatal logs.
|
||||
//
|
||||
// Deprecated: Use [WithFatalHook] instead.
|
||||
|
39
vendor/go.uber.org/zap/sugar.go
generated
vendored
39
vendor/go.uber.org/zap/sugar.go
generated
vendored
@ -115,6 +115,21 @@ func (s *SugaredLogger) With(args ...interface{}) *SugaredLogger {
|
||||
return &SugaredLogger{base: s.base.With(s.sweetenFields(args)...)}
|
||||
}
|
||||
|
||||
// WithLazy adds a variadic number of fields to the logging context lazily.
|
||||
// The fields are evaluated only if the logger is further chained with [With]
|
||||
// or is written to with any of the log level methods.
|
||||
// Until that occurs, the logger may retain references to objects inside the fields,
|
||||
// and logging will reflect the state of an object at the time of logging,
|
||||
// not the time of WithLazy().
|
||||
//
|
||||
// Similar to [With], fields added to the child don't affect the parent,
|
||||
// and vice versa. Also, the keys in key-value pairs should be strings. In development,
|
||||
// passing a non-string key panics, while in production it logs an error and skips the pair.
|
||||
// Passing an orphaned key has the same behavior.
|
||||
func (s *SugaredLogger) WithLazy(args ...interface{}) *SugaredLogger {
|
||||
return &SugaredLogger{base: s.base.WithLazy(s.sweetenFields(args)...)}
|
||||
}
|
||||
|
||||
// Level reports the minimum enabled level for this logger.
|
||||
//
|
||||
// For NopLoggers, this is [zapcore.InvalidLevel].
|
||||
@ -122,6 +137,12 @@ func (s *SugaredLogger) Level() zapcore.Level {
|
||||
return zapcore.LevelOf(s.base.core)
|
||||
}
|
||||
|
||||
// Log logs the provided arguments at provided level.
|
||||
// Spaces are added between arguments when neither is a string.
|
||||
func (s *SugaredLogger) Log(lvl zapcore.Level, args ...interface{}) {
|
||||
s.log(lvl, "", args, nil)
|
||||
}
|
||||
|
||||
// Debug logs the provided arguments at [DebugLevel].
|
||||
// Spaces are added between arguments when neither is a string.
|
||||
func (s *SugaredLogger) Debug(args ...interface{}) {
|
||||
@ -165,6 +186,12 @@ func (s *SugaredLogger) Fatal(args ...interface{}) {
|
||||
s.log(FatalLevel, "", args, nil)
|
||||
}
|
||||
|
||||
// Logf formats the message according to the format specifier
|
||||
// and logs it at provided level.
|
||||
func (s *SugaredLogger) Logf(lvl zapcore.Level, template string, args ...interface{}) {
|
||||
s.log(lvl, template, args, nil)
|
||||
}
|
||||
|
||||
// Debugf formats the message according to the format specifier
|
||||
// and logs it at [DebugLevel].
|
||||
func (s *SugaredLogger) Debugf(template string, args ...interface{}) {
|
||||
@ -208,6 +235,12 @@ func (s *SugaredLogger) Fatalf(template string, args ...interface{}) {
|
||||
s.log(FatalLevel, template, args, nil)
|
||||
}
|
||||
|
||||
// Logw logs a message with some additional context. The variadic key-value
|
||||
// pairs are treated as they are in With.
|
||||
func (s *SugaredLogger) Logw(lvl zapcore.Level, msg string, keysAndValues ...interface{}) {
|
||||
s.log(lvl, msg, nil, keysAndValues)
|
||||
}
|
||||
|
||||
// Debugw logs a message with some additional context. The variadic key-value
|
||||
// pairs are treated as they are in With.
|
||||
//
|
||||
@ -255,6 +288,12 @@ func (s *SugaredLogger) Fatalw(msg string, keysAndValues ...interface{}) {
|
||||
s.log(FatalLevel, msg, nil, keysAndValues)
|
||||
}
|
||||
|
||||
// Logln logs a message at provided level.
|
||||
// Spaces are always added between arguments.
|
||||
func (s *SugaredLogger) Logln(lvl zapcore.Level, args ...interface{}) {
|
||||
s.logln(lvl, args, nil)
|
||||
}
|
||||
|
||||
// Debugln logs a message at [DebugLevel].
|
||||
// Spaces are always added between arguments.
|
||||
func (s *SugaredLogger) Debugln(args ...interface{}) {
|
||||
|
2
vendor/go.uber.org/zap/zapcore/console_encoder.go
generated
vendored
2
vendor/go.uber.org/zap/zapcore/console_encoder.go
generated
vendored
@ -77,7 +77,7 @@ func (c consoleEncoder) EncodeEntry(ent Entry, fields []Field) (*buffer.Buffer,
|
||||
// If this ever becomes a performance bottleneck, we can implement
|
||||
// ArrayEncoder for our plain-text format.
|
||||
arr := getSliceEncoder()
|
||||
if c.TimeKey != "" && c.EncodeTime != nil {
|
||||
if c.TimeKey != "" && c.EncodeTime != nil && !ent.Time.IsZero() {
|
||||
c.EncodeTime(ent.Time, arr)
|
||||
}
|
||||
if c.LevelKey != "" && c.EncodeLevel != nil {
|
||||
|
15
vendor/go.uber.org/zap/zapcore/encoder.go
generated
vendored
15
vendor/go.uber.org/zap/zapcore/encoder.go
generated
vendored
@ -37,6 +37,9 @@ const DefaultLineEnding = "\n"
|
||||
const OmitKey = ""
|
||||
|
||||
// A LevelEncoder serializes a Level to a primitive type.
|
||||
//
|
||||
// This function must make exactly one call
|
||||
// to a PrimitiveArrayEncoder's Append* method.
|
||||
type LevelEncoder func(Level, PrimitiveArrayEncoder)
|
||||
|
||||
// LowercaseLevelEncoder serializes a Level to a lowercase string. For example,
|
||||
@ -90,6 +93,9 @@ func (e *LevelEncoder) UnmarshalText(text []byte) error {
|
||||
}
|
||||
|
||||
// A TimeEncoder serializes a time.Time to a primitive type.
|
||||
//
|
||||
// This function must make exactly one call
|
||||
// to a PrimitiveArrayEncoder's Append* method.
|
||||
type TimeEncoder func(time.Time, PrimitiveArrayEncoder)
|
||||
|
||||
// EpochTimeEncoder serializes a time.Time to a floating-point number of seconds
|
||||
@ -219,6 +225,9 @@ func (e *TimeEncoder) UnmarshalJSON(data []byte) error {
|
||||
}
|
||||
|
||||
// A DurationEncoder serializes a time.Duration to a primitive type.
|
||||
//
|
||||
// This function must make exactly one call
|
||||
// to a PrimitiveArrayEncoder's Append* method.
|
||||
type DurationEncoder func(time.Duration, PrimitiveArrayEncoder)
|
||||
|
||||
// SecondsDurationEncoder serializes a time.Duration to a floating-point number of seconds elapsed.
|
||||
@ -262,6 +271,9 @@ func (e *DurationEncoder) UnmarshalText(text []byte) error {
|
||||
}
|
||||
|
||||
// A CallerEncoder serializes an EntryCaller to a primitive type.
|
||||
//
|
||||
// This function must make exactly one call
|
||||
// to a PrimitiveArrayEncoder's Append* method.
|
||||
type CallerEncoder func(EntryCaller, PrimitiveArrayEncoder)
|
||||
|
||||
// FullCallerEncoder serializes a caller in /full/path/to/package/file:line
|
||||
@ -292,6 +304,9 @@ func (e *CallerEncoder) UnmarshalText(text []byte) error {
|
||||
|
||||
// A NameEncoder serializes a period-separated logger name to a primitive
|
||||
// type.
|
||||
//
|
||||
// This function must make exactly one call
|
||||
// to a PrimitiveArrayEncoder's Append* method.
|
||||
type NameEncoder func(string, PrimitiveArrayEncoder)
|
||||
|
||||
// FullNameEncoder serializes the logger name as-is.
|
||||
|
2
vendor/go.uber.org/zap/zapcore/field.go
generated
vendored
2
vendor/go.uber.org/zap/zapcore/field.go
generated
vendored
@ -47,7 +47,7 @@ const (
|
||||
ByteStringType
|
||||
// Complex128Type indicates that the field carries a complex128.
|
||||
Complex128Type
|
||||
// Complex64Type indicates that the field carries a complex128.
|
||||
// Complex64Type indicates that the field carries a complex64.
|
||||
Complex64Type
|
||||
// DurationType indicates that the field carries a time.Duration.
|
||||
DurationType
|
||||
|
2
vendor/go.uber.org/zap/zapcore/json_encoder.go
generated
vendored
2
vendor/go.uber.org/zap/zapcore/json_encoder.go
generated
vendored
@ -372,7 +372,7 @@ func (enc *jsonEncoder) EncodeEntry(ent Entry, fields []Field) (*buffer.Buffer,
|
||||
final.AppendString(ent.Level.String())
|
||||
}
|
||||
}
|
||||
if final.TimeKey != "" {
|
||||
if final.TimeKey != "" && !ent.Time.IsZero() {
|
||||
final.AddTime(final.TimeKey, ent.Time)
|
||||
}
|
||||
if ent.LoggerName != "" && final.NameKey != "" {
|
||||
|
28
vendor/gocv.io/x/gocv/.astylerc
generated
vendored
28
vendor/gocv.io/x/gocv/.astylerc
generated
vendored
@ -1,28 +0,0 @@
|
||||
--lineend=linux
|
||||
|
||||
--style=google
|
||||
|
||||
--indent=spaces=4
|
||||
--indent-col1-comments
|
||||
--convert-tabs
|
||||
|
||||
--attach-return-type
|
||||
--attach-namespaces
|
||||
--attach-classes
|
||||
--attach-inlines
|
||||
|
||||
--add-brackets
|
||||
--add-braces
|
||||
|
||||
--align-pointer=type
|
||||
--align-reference=type
|
||||
|
||||
--max-code-length=100
|
||||
--break-after-logical
|
||||
|
||||
--pad-comma
|
||||
--pad-oper
|
||||
--unpad-paren
|
||||
|
||||
--break-blocks
|
||||
--pad-header
|
12
vendor/gocv.io/x/gocv/.gitignore
generated
vendored
12
vendor/gocv.io/x/gocv/.gitignore
generated
vendored
@ -1,12 +0,0 @@
|
||||
profile.cov
|
||||
count.out
|
||||
*.swp
|
||||
*.snap
|
||||
/parts
|
||||
/prime
|
||||
/stage
|
||||
.vscode/
|
||||
/build
|
||||
.idea/
|
||||
contrib/data.yaml
|
||||
contrib/testOilPainting.png
|
1019
vendor/gocv.io/x/gocv/CHANGELOG.md
generated
vendored
1019
vendor/gocv.io/x/gocv/CHANGELOG.md
generated
vendored
File diff suppressed because it is too large
Load Diff
76
vendor/gocv.io/x/gocv/CODE_OF_CONDUCT.md
generated
vendored
76
vendor/gocv.io/x/gocv/CODE_OF_CONDUCT.md
generated
vendored
@ -1,76 +0,0 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at info@hybridgroup.com. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see
|
||||
https://www.contributor-covenant.org/faq
|
136
vendor/gocv.io/x/gocv/CONTRIBUTING.md
generated
vendored
136
vendor/gocv.io/x/gocv/CONTRIBUTING.md
generated
vendored
@ -1,136 +0,0 @@
|
||||
# How to contribute
|
||||
|
||||
Thank you for your interest in improving GoCV.
|
||||
|
||||
We would like your help to make this project better, so we appreciate any contributions. See if one of the following descriptions matches your situation:
|
||||
|
||||
### Newcomer to GoCV, to OpenCV, or to computer vision in general
|
||||
|
||||
We'd love to get your feedback on getting started with GoCV. Run into any difficulty, confusion, or anything else? You are not alone. We want to know about your experience, so we can help the next people. Please open a Github issue with your questions, or get in touch directly with us.
|
||||
|
||||
### Something in GoCV is not working as you expect
|
||||
|
||||
Please open a Github issue with your problem, and we will be happy to assist.
|
||||
|
||||
### Something you want/need from OpenCV does not appear to be in GoCV
|
||||
|
||||
We probably have not implemented it yet. Please take a look at our [ROADMAP.md](ROADMAP.md). Your pull request adding the functionality to GoCV would be greatly appreciated.
|
||||
|
||||
### You found some Python code on the Internet that performs some computer vision task, and you want to do it using GoCV
|
||||
|
||||
Please open a Github issue with your needs, and we can see what we can do.
|
||||
|
||||
## How to use our Github repository
|
||||
|
||||
The `release` branch of this repo will always have the latest released version of GoCV. All of the active development work for the next release will take place in the `dev` branch. GoCV will use semantic versioning and will create a tag/release for each release.
|
||||
|
||||
Here is how to contribute back some code or documentation:
|
||||
|
||||
- Fork repo
|
||||
- Create a feature branch off of the `dev` branch
|
||||
- Make some useful change
|
||||
- Submit a pull request against the `dev` branch.
|
||||
- Be kind
|
||||
|
||||
## How to add a function from OpenCV to GoCV
|
||||
|
||||
Here are a few basic guidelines on how to add a function from OpenCV to GoCV:
|
||||
|
||||
- Please open a Github issue. We want to help, and also make sure that there is no duplications of efforts. Sometimes what you need is already being worked on by someone else.
|
||||
- Use the proper Go style naming `MissingFunction()` for the Go wrapper.
|
||||
- Make any output parameters `Mat*` to indicate to developers that the underlying OpenCV data will be changed by the function.
|
||||
- Use Go types when possible as parameters for example `image.Point` and then convert to the appropriate OpenCV struct. Also define a new type based on `int` and `const` values instead of just passing "magic numbers" as params. For example, the `VideoCaptureProperties` type used in `videoio.go`.
|
||||
- Always add the function to the GoCV file named the same as the OpenCV module to which the function belongs.
|
||||
- If the new function is in a module that is not yet implemented by GoCV, a new set of files for that module will need to be added.
|
||||
- Always add a "smoke" test for the new function being added. We are not testing OpenCV itself, but just the GoCV wrapper, so all that is needed generally is just exercising the new function.
|
||||
- If OpenCV has any default params for a function, we have been implementing 2 versions of the function since Go does not support overloading. For example, with a OpenCV function:
|
||||
|
||||
```c
|
||||
opencv::xYZ(int p1, int p2, int p3=2, int p4=3);
|
||||
```
|
||||
|
||||
We would define 2 functions in GoCV:
|
||||
|
||||
```go
|
||||
// uses default param values
|
||||
XYZ(p1, p2)
|
||||
|
||||
// sets each param
|
||||
XYZWithParams(p2, p2, p3, p4)
|
||||
```
|
||||
|
||||
## How to run tests
|
||||
|
||||
To run the tests:
|
||||
|
||||
```
|
||||
go test .
|
||||
go test ./contrib/.
|
||||
```
|
||||
|
||||
If you want to run an individual test, you can provide a RegExp to the `-run` argument:
|
||||
```
|
||||
go test -run TestMat
|
||||
```
|
||||
|
||||
If you are using Intel OpenVINO, you can run those tests using:
|
||||
|
||||
```
|
||||
go test ./openvino/...
|
||||
```
|
||||
|
||||
## Contributing workflow
|
||||
|
||||
This section provides a short description of one of many possible workflows you can follow to contribute to `GoCV`. This workflow is based on multiple [git remotes](https://git-scm.com/docs/git-remote) and it's by no means the only workflow you can use to contribute to `GoCV`. However, it's an option that might help you get started quickly without too much hassle as this workflow lets you work off the `gocv` repo directory path!
|
||||
|
||||
Assuming you have already forked the `gocv` repo, you need to add a new `git remote` which will point to your GitHub fork. Notice below that you **must** `cd` to `gocv` repo directory before you add the new `git remote`:
|
||||
|
||||
```shell
|
||||
cd $GOPATH/src/gocv.io/x/gocv
|
||||
git remote add gocv-fork https://github.com/YOUR_GH_HANDLE/gocv.git
|
||||
```
|
||||
|
||||
Note, that in the command above we called our new `git remote`, **gocv-fork** for convenience so we can easily recognize it. You are free to choose any remote name of your liking.
|
||||
|
||||
You should now see your new `git remote` when running the command below:
|
||||
|
||||
```shell
|
||||
git remote -v
|
||||
|
||||
gocv-fork https://github.com/YOUR_GH_HANDLE/gocv.git (fetch)
|
||||
gocv-fork https://github.com/YOUR_GH_HANDLE/gocv.git (push)
|
||||
origin https://github.com/hybridgroup/gocv (fetch)
|
||||
origin https://github.com/hybridgroup/gocv (push)
|
||||
```
|
||||
|
||||
Before you create a new branch from `dev` you should fetch the latests commits from the `dev` branch:
|
||||
|
||||
```shell
|
||||
git fetch origin dev
|
||||
```
|
||||
|
||||
You want the `dev` branch in your `gocv` fork to be in sync with the `dev` branch of `gocv`, so push the earlier fetched commits to your GitHub fork as shown below. Note, the `-f` force switch might not be needed:
|
||||
|
||||
```shell
|
||||
git push gocv-fork dev -f
|
||||
```
|
||||
|
||||
Create a new feature branch from `dev`:
|
||||
|
||||
```shell
|
||||
git checkout -b new-feature
|
||||
```
|
||||
|
||||
After you've made your changes you can run the tests using the `make` command listed below. Note, you're still working off the `gocv` project root directory, hence running the command below does not require complicated `$GOPATH` rewrites or whatnot:
|
||||
|
||||
```shell
|
||||
make test
|
||||
```
|
||||
|
||||
Once the tests have passed, commit your new code to the `new-feature` branch and push it to your fork running the command below:
|
||||
|
||||
```shell
|
||||
git push gocv-fork new-feature
|
||||
```
|
||||
|
||||
You can now open a new PR from `new-feature` branch in your forked repo against the `dev` branch of `gocv`.
|
12
vendor/gocv.io/x/gocv/Dockerfile
generated
vendored
12
vendor/gocv.io/x/gocv/Dockerfile
generated
vendored
@ -1,12 +0,0 @@
|
||||
# to build this docker image:
|
||||
# docker build .
|
||||
FROM gocv/opencv:4.6.0
|
||||
|
||||
ENV GOPATH /go
|
||||
|
||||
COPY . /go/src/gocv.io/x/gocv/
|
||||
|
||||
WORKDIR /go/src/gocv.io/x/gocv
|
||||
RUN go build -tags example -o /build/gocv_version -i ./cmd/version/
|
||||
|
||||
CMD ["/build/gocv_version"]
|
19
vendor/gocv.io/x/gocv/Dockerfile-test
generated
vendored
19
vendor/gocv.io/x/gocv/Dockerfile-test
generated
vendored
@ -1,19 +0,0 @@
|
||||
# To build:
|
||||
# docker build -f Dockerfile-test -t gocv-test .
|
||||
#
|
||||
# To run tests:
|
||||
# xhost +
|
||||
# docker run -it --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix gocv-test
|
||||
# xhost -
|
||||
#
|
||||
FROM gocv/opencv:4.6.0 AS gocv-test
|
||||
|
||||
ENV GOPATH /go
|
||||
|
||||
COPY . /go/src/gocv.io/x/gocv/
|
||||
|
||||
WORKDIR /go/src/gocv.io/x/gocv
|
||||
|
||||
RUN go get -u github.com/rakyll/gotest
|
||||
|
||||
ENTRYPOINT ["gotest", "-v", ".", "./contrib/..."]
|
18
vendor/gocv.io/x/gocv/Dockerfile-test.gpu-cuda-10
generated
vendored
18
vendor/gocv.io/x/gocv/Dockerfile-test.gpu-cuda-10
generated
vendored
@ -1,18 +0,0 @@
|
||||
# To build:
|
||||
# docker build -f Dockerfile-test.gpu-cuda-10 -t gocv-test-gpu-cuda-10 .
|
||||
#
|
||||
# To run tests:
|
||||
# docker run -it --rm --gpus all gocv-test-gpu-cuda-10
|
||||
#
|
||||
FROM gocv/opencv:4.6.0-gpu-cuda-10 AS gocv-gpu-test-cuda-10
|
||||
|
||||
ENV GOPATH /go
|
||||
ENV PATH="${PATH}:/go/bin"
|
||||
|
||||
COPY . /go/src/gocv.io/x/gocv/
|
||||
|
||||
WORKDIR /go/src/gocv.io/x/gocv
|
||||
|
||||
RUN go get -u github.com/rakyll/gotest
|
||||
|
||||
ENTRYPOINT ["gotest", "-v", "./cuda/..."]
|
18
vendor/gocv.io/x/gocv/Dockerfile-test.gpu-cuda-11
generated
vendored
18
vendor/gocv.io/x/gocv/Dockerfile-test.gpu-cuda-11
generated
vendored
@ -1,18 +0,0 @@
|
||||
# To build:
|
||||
# docker build -f Dockerfile-test.gpu-cuda-11 -t gocv-test-gpu-cuda-11 .
|
||||
#
|
||||
# To run tests:
|
||||
# docker run -it --rm --gpus all gocv-test-gpu-cuda-11
|
||||
#
|
||||
FROM gocv/opencv:4.6.0-gpu-cuda-11 AS gocv-gpu-test-cuda-11
|
||||
|
||||
ENV GOPATH /go
|
||||
ENV PATH="${PATH}:/go/bin"
|
||||
|
||||
COPY . /go/src/gocv.io/x/gocv/
|
||||
|
||||
WORKDIR /go/src/gocv.io/x/gocv
|
||||
|
||||
RUN go get -u github.com/rakyll/gotest
|
||||
|
||||
ENTRYPOINT ["gotest", "-v", "./cuda/..."]
|
12
vendor/gocv.io/x/gocv/Dockerfile.gpu
generated
vendored
12
vendor/gocv.io/x/gocv/Dockerfile.gpu
generated
vendored
@ -1,12 +0,0 @@
|
||||
# to build this docker image:
|
||||
# docker build -f Dockerfile.gpu .
|
||||
FROM gocv/opencv:4.6.0-gpu-cuda-11 AS gocv-gpu
|
||||
|
||||
ENV GOPATH /go
|
||||
|
||||
COPY . /go/src/gocv.io/x/gocv/
|
||||
|
||||
WORKDIR /go/src/gocv.io/x/gocv
|
||||
RUN go build -tags cuda -o /build/gocv_cuda_version ./cmd/cuda/
|
||||
|
||||
CMD ["/build/gocv_cuda_version"]
|
45
vendor/gocv.io/x/gocv/Dockerfile.opencv
generated
vendored
45
vendor/gocv.io/x/gocv/Dockerfile.opencv
generated
vendored
@ -1,45 +0,0 @@
|
||||
# to build this docker image:
|
||||
# docker build -f Dockerfile.opencv -t gocv/opencv:4.6.0 .
|
||||
FROM golang:1.18-buster AS opencv
|
||||
LABEL maintainer="hybridgroup"
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
git build-essential cmake pkg-config unzip libgtk2.0-dev \
|
||||
curl ca-certificates libcurl4-openssl-dev libssl-dev \
|
||||
libavcodec-dev libavformat-dev libswscale-dev libtbb2 libtbb-dev \
|
||||
libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ARG OPENCV_VERSION="4.6.0"
|
||||
ENV OPENCV_VERSION $OPENCV_VERSION
|
||||
|
||||
RUN curl -Lo opencv.zip https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \
|
||||
unzip -q opencv.zip && \
|
||||
curl -Lo opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip && \
|
||||
unzip -q opencv_contrib.zip && \
|
||||
rm opencv.zip opencv_contrib.zip && \
|
||||
cd opencv-${OPENCV_VERSION} && \
|
||||
mkdir build && cd build && \
|
||||
cmake -D CMAKE_BUILD_TYPE=RELEASE \
|
||||
-D WITH_IPP=OFF \
|
||||
-D WITH_OPENGL=OFF \
|
||||
-D WITH_QT=OFF \
|
||||
-D CMAKE_INSTALL_PREFIX=/usr/local \
|
||||
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-${OPENCV_VERSION}/modules \
|
||||
-D OPENCV_ENABLE_NONFREE=ON \
|
||||
-D WITH_JASPER=OFF \
|
||||
-D WITH_TBB=ON \
|
||||
-D BUILD_DOCS=OFF \
|
||||
-D BUILD_EXAMPLES=OFF \
|
||||
-D BUILD_TESTS=OFF \
|
||||
-D BUILD_PERF_TESTS=OFF \
|
||||
-D BUILD_opencv_java=NO \
|
||||
-D BUILD_opencv_python=NO \
|
||||
-D BUILD_opencv_python2=NO \
|
||||
-D BUILD_opencv_python3=NO \
|
||||
-D OPENCV_GENERATE_PKGCONFIG=ON .. && \
|
||||
make -j $(nproc --all) && \
|
||||
make preinstall && make install && ldconfig && \
|
||||
cd / && rm -rf opencv*
|
||||
|
||||
CMD ["go version"]
|
68
vendor/gocv.io/x/gocv/Dockerfile.opencv-gpu-cuda-10
generated
vendored
68
vendor/gocv.io/x/gocv/Dockerfile.opencv-gpu-cuda-10
generated
vendored
@ -1,68 +0,0 @@
|
||||
# to build this docker image:
|
||||
# docker build -f Dockerfile.opencv-gpu-cuda-10 -t gocv/opencv:4.6.0-gpu-cuda-10 .
|
||||
FROM nvidia/cuda:10.2-cudnn8-devel AS opencv-gpu-base
|
||||
LABEL maintainer="hybridgroup"
|
||||
|
||||
# needed for cuda repo key rotation. see:
|
||||
# https://forums.developer.nvidia.com/t/notice-cuda-linux-repository-key-rotation/212771
|
||||
#
|
||||
RUN apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
git build-essential cmake pkg-config unzip libgtk2.0-dev \
|
||||
wget curl ca-certificates libcurl4-openssl-dev libssl-dev \
|
||||
libavcodec-dev libavformat-dev libswscale-dev libtbb2 libtbb-dev \
|
||||
libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ARG OPENCV_VERSION="4.6.0"
|
||||
ENV OPENCV_VERSION $OPENCV_VERSION
|
||||
|
||||
RUN curl -Lo opencv.zip https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \
|
||||
unzip -q opencv.zip && \
|
||||
curl -Lo opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip && \
|
||||
unzip -q opencv_contrib.zip && \
|
||||
rm opencv.zip opencv_contrib.zip && \
|
||||
cd opencv-${OPENCV_VERSION} && \
|
||||
mkdir build && cd build && \
|
||||
cmake -D CMAKE_BUILD_TYPE=RELEASE \
|
||||
-D WITH_IPP=OFF \
|
||||
-D WITH_OPENGL=OFF \
|
||||
-D WITH_QT=OFF \
|
||||
-D CMAKE_INSTALL_PREFIX=/usr/local \
|
||||
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-${OPENCV_VERSION}/modules \
|
||||
-D OPENCV_ENABLE_NONFREE=ON \
|
||||
-D WITH_JASPER=OFF \
|
||||
-D BUILD_DOCS=OFF \
|
||||
-D BUILD_EXAMPLES=OFF \
|
||||
-D BUILD_TESTS=OFF \
|
||||
-D BUILD_PERF_TESTS=OFF \
|
||||
-D BUILD_opencv_java=NO \
|
||||
-D BUILD_opencv_python=NO \
|
||||
-D BUILD_opencv_python2=NO \
|
||||
-D BUILD_opencv_python3=NO \
|
||||
-D WITH_TBB=ON \
|
||||
-D WITH_CUDA=ON \
|
||||
-D ENABLE_FAST_MATH=1 \
|
||||
-D CUDA_FAST_MATH=1 \
|
||||
-D WITH_CUBLAS=1 \
|
||||
-D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda/ \
|
||||
-D BUILD_opencv_cudacodec=OFF \
|
||||
-D WITH_CUDNN=ON \
|
||||
-D OPENCV_DNN_CUDA=ON \
|
||||
-D CUDA_GENERATION=Auto \
|
||||
-D OPENCV_GENERATE_PKGCONFIG=ON .. && \
|
||||
make -j $(nproc --all) && \
|
||||
make preinstall && make install && ldconfig && \
|
||||
cd / && rm -rf opencv*
|
||||
|
||||
# install golang here
|
||||
FROM opencv-gpu-base AS opencv-gpu-golang
|
||||
|
||||
ENV GO_RELEASE=1.18.3
|
||||
RUN wget https://dl.google.com/go/go${GO_RELEASE}.linux-amd64.tar.gz && \
|
||||
tar xfv go${GO_RELEASE}.linux-amd64.tar.gz -C /usr/local && \
|
||||
rm go${GO_RELEASE}.linux-amd64.tar.gz
|
||||
ENV PATH="${PATH}:/usr/local/go/bin"
|
||||
|
||||
CMD ["go version"]
|
64
vendor/gocv.io/x/gocv/Dockerfile.opencv-gpu-cuda-11
generated
vendored
64
vendor/gocv.io/x/gocv/Dockerfile.opencv-gpu-cuda-11
generated
vendored
@ -1,64 +0,0 @@
|
||||
# to build this docker image:
|
||||
# docker build -f Dockerfile.opencv-gpu-cuda-11 -t gocv/opencv:4.6.0-gpu-cuda-11 .
|
||||
FROM nvidia/cuda:11.5.2-cudnn8-devel-ubuntu20.04 AS opencv-gpu-cuda-11-base
|
||||
LABEL maintainer="hybridgroup"
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
git build-essential cmake pkg-config unzip libgtk2.0-dev \
|
||||
wget curl ca-certificates libcurl4-openssl-dev libssl-dev \
|
||||
libavcodec-dev libavformat-dev libswscale-dev libtbb2 libtbb-dev \
|
||||
libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ARG OPENCV_VERSION="4.6.0"
|
||||
ENV OPENCV_VERSION $OPENCV_VERSION
|
||||
|
||||
RUN curl -Lo opencv.zip https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \
|
||||
unzip -q opencv.zip && \
|
||||
curl -Lo opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip && \
|
||||
unzip -q opencv_contrib.zip && \
|
||||
rm opencv.zip opencv_contrib.zip && \
|
||||
cd opencv-${OPENCV_VERSION} && \
|
||||
mkdir build && cd build && \
|
||||
cmake -D CMAKE_BUILD_TYPE=RELEASE \
|
||||
-D WITH_IPP=OFF \
|
||||
-D WITH_OPENGL=OFF \
|
||||
-D WITH_QT=OFF \
|
||||
-D CMAKE_INSTALL_PREFIX=/usr/local \
|
||||
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-${OPENCV_VERSION}/modules \
|
||||
-D OPENCV_ENABLE_NONFREE=ON \
|
||||
-D WITH_JASPER=OFF \
|
||||
-D BUILD_DOCS=OFF \
|
||||
-D BUILD_EXAMPLES=OFF \
|
||||
-D BUILD_TESTS=OFF \
|
||||
-D BUILD_PERF_TESTS=OFF \
|
||||
-D BUILD_opencv_java=NO \
|
||||
-D BUILD_opencv_python=NO \
|
||||
-D BUILD_opencv_python2=NO \
|
||||
-D BUILD_opencv_python3=NO \
|
||||
-D WITH_TBB=ON \
|
||||
-D WITH_CUDA=ON \
|
||||
-D ENABLE_FAST_MATH=1 \
|
||||
-D CUDA_FAST_MATH=1 \
|
||||
-D WITH_CUBLAS=1 \
|
||||
-D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda/ \
|
||||
-D BUILD_opencv_cudacodec=OFF \
|
||||
-D WITH_CUDNN=ON \
|
||||
-D OPENCV_DNN_CUDA=ON \
|
||||
-D CUDA_GENERATION=Auto \
|
||||
-D OPENCV_GENERATE_PKGCONFIG=ON .. && \
|
||||
make -j $(nproc --all) && \
|
||||
make preinstall && make install && ldconfig && \
|
||||
cd / && rm -rf opencv*
|
||||
|
||||
# install golang here
|
||||
FROM opencv-gpu-cuda-11-base AS opencv-gpu-cuda-11-golang
|
||||
|
||||
ENV GO_RELEASE=1.18.3
|
||||
RUN wget https://dl.google.com/go/go${GO_RELEASE}.linux-amd64.tar.gz && \
|
||||
tar xfv go${GO_RELEASE}.linux-amd64.tar.gz -C /usr/local && \
|
||||
rm go${GO_RELEASE}.linux-amd64.tar.gz
|
||||
ENV PATH="${PATH}:/usr/local/go/bin"
|
||||
|
||||
CMD ["go version"]
|
13
vendor/gocv.io/x/gocv/LICENSE.txt
generated
vendored
13
vendor/gocv.io/x/gocv/LICENSE.txt
generated
vendored
@ -1,13 +0,0 @@
|
||||
Copyright (c) 2017-2022 The Hybrid Group and friends
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
311
vendor/gocv.io/x/gocv/Makefile
generated
vendored
311
vendor/gocv.io/x/gocv/Makefile
generated
vendored
@ -1,311 +0,0 @@
|
||||
.ONESHELL:
|
||||
.PHONY: test deps download build clean astyle cmds docker
|
||||
|
||||
# GoCV version to use.
|
||||
GOCV_VERSION?="v0.31.0"
|
||||
|
||||
# OpenCV version to use.
|
||||
OPENCV_VERSION?=4.6.0
|
||||
|
||||
# Go version to use when building Docker image
|
||||
GOVERSION?=1.16.2
|
||||
|
||||
# Temporary directory to put files into.
|
||||
TMP_DIR?=/tmp/
|
||||
|
||||
# Build shared or static library
|
||||
BUILD_SHARED_LIBS?=ON
|
||||
|
||||
# Package list for each well-known Linux distribution
|
||||
RPMS=cmake curl wget git gtk2-devel libpng-devel libjpeg-devel libtiff-devel tbb tbb-devel libdc1394-devel unzip gcc-c++
|
||||
DEBS=unzip wget build-essential cmake curl git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev
|
||||
JETSON=build-essential cmake git unzip pkg-config libjpeg-dev libpng-dev libtiff-dev libavcodec-dev libavformat-dev libswscale-dev libgtk2.0-dev libcanberra-gtk* libxvidcore-dev libx264-dev libgtk-3-dev libtbb2 libtbb-dev libdc1394-22-dev libv4l-dev v4l-utils libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libavresample-dev libvorbis-dev libxine2-dev libfaac-dev libmp3lame-dev libtheora-dev libopencore-amrnb-dev libopencore-amrwb-dev libopenblas-dev libatlas-base-dev libblas-dev liblapack-dev libeigen3-dev gfortran libhdf5-dev protobuf-compiler libprotobuf-dev libgoogle-glog-dev libgflags-dev
|
||||
|
||||
explain:
|
||||
@echo "For quick install with typical defaults of both OpenCV and GoCV, run 'make install'"
|
||||
|
||||
# Detect Linux distribution
|
||||
distro_deps=
|
||||
ifneq ($(shell which dnf 2>/dev/null),)
|
||||
distro_deps=deps_fedora
|
||||
else
|
||||
ifneq ($(shell which apt-get 2>/dev/null),)
|
||||
distro_deps=deps_debian
|
||||
else
|
||||
ifneq ($(shell which yum 2>/dev/null),)
|
||||
distro_deps=deps_rh_centos
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# Install all necessary dependencies.
|
||||
deps: $(distro_deps)
|
||||
|
||||
deps_rh_centos:
|
||||
sudo yum -y install pkgconfig $(RPMS)
|
||||
|
||||
deps_fedora:
|
||||
sudo dnf -y install pkgconf-pkg-config $(RPMS)
|
||||
|
||||
deps_debian:
|
||||
sudo apt-get -y update
|
||||
sudo apt-get -y install $(DEBS)
|
||||
|
||||
deps_jetson:
|
||||
sudo sh -c "echo '/usr/local/cuda/lib64' >> /etc/ld.so.conf.d/nvidia-tegra.conf"
|
||||
sudo ldconfig
|
||||
sudo apt-get -y update
|
||||
sudo apt-get -y install $(JETSON)
|
||||
|
||||
# Download OpenCV source tarballs.
|
||||
download:
|
||||
rm -rf $(TMP_DIR)opencv
|
||||
mkdir $(TMP_DIR)opencv
|
||||
cd $(TMP_DIR)opencv
|
||||
curl -Lo opencv.zip https://github.com/opencv/opencv/archive/$(OPENCV_VERSION).zip
|
||||
unzip -q opencv.zip
|
||||
curl -Lo opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/$(OPENCV_VERSION).zip
|
||||
unzip -q opencv_contrib.zip
|
||||
rm opencv.zip opencv_contrib.zip
|
||||
cd -
|
||||
|
||||
# Download openvino source tarballs.
|
||||
download_openvino:
|
||||
sudo rm -rf /usr/local/dldt/
|
||||
sudo rm -rf /usr/local/openvino/
|
||||
sudo git clone https://github.com/openvinotoolkit/openvino -b 2019_R3.1 /usr/local/openvino/
|
||||
|
||||
# Build openvino.
|
||||
build_openvino_package:
|
||||
cd /usr/local/openvino/inference-engine
|
||||
sudo git submodule init
|
||||
sudo git submodule update --recursive
|
||||
sudo ./install_dependencies.sh
|
||||
sudo mv -f thirdparty/clDNN/common/intel_ocl_icd/6.3/linux/Release thirdparty/clDNN/common/intel_ocl_icd/6.3/linux/RELEASE
|
||||
sudo mkdir build
|
||||
cd build
|
||||
sudo rm -rf *
|
||||
sudo cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} -D ENABLE_VPU=ON -D ENABLE_MKL_DNN=ON -D ENABLE_CLDNN=ON ..
|
||||
sudo $(MAKE) -j $(shell nproc --all)
|
||||
sudo touch VERSION
|
||||
sudo mkdir -p src/ngraph
|
||||
sudo cp thirdparty/ngraph/src/ngraph/version.hpp src/ngraph
|
||||
cd -
|
||||
|
||||
# Build OpenCV.
|
||||
build:
|
||||
cd $(TMP_DIR)opencv/opencv-$(OPENCV_VERSION)
|
||||
mkdir build
|
||||
cd build
|
||||
rm -rf *
|
||||
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} -D OPENCV_EXTRA_MODULES_PATH=$(TMP_DIR)opencv/opencv_contrib-$(OPENCV_VERSION)/modules -D BUILD_DOCS=OFF -D BUILD_EXAMPLES=OFF -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_opencv_java=NO -D BUILD_opencv_python=NO -D BUILD_opencv_python2=NO -D BUILD_opencv_python3=NO -D WITH_JASPER=OFF -D WITH_TBB=ON -DOPENCV_GENERATE_PKGCONFIG=ON ..
|
||||
$(MAKE) -j $(shell nproc --all)
|
||||
$(MAKE) preinstall
|
||||
cd -
|
||||
|
||||
# Build OpenCV on Raspbian with ARM hardware optimizations.
|
||||
build_raspi:
|
||||
cd $(TMP_DIR)opencv/opencv-$(OPENCV_VERSION)
|
||||
mkdir build
|
||||
cd build
|
||||
rm -rf *
|
||||
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} -D OPENCV_EXTRA_MODULES_PATH=$(TMP_DIR)opencv/opencv_contrib-$(OPENCV_VERSION)/modules -D BUILD_DOCS=OFF -D BUILD_EXAMPLES=OFF -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_opencv_java=OFF -D BUILD_opencv_python=NO -D BUILD_opencv_python2=NO -D BUILD_opencv_python3=NO -D ENABLE_NEON=ON -D ENABLE_VFPV3=ON -D WITH_JASPER=OFF -D OPENCV_GENERATE_PKGCONFIG=ON ..
|
||||
$(MAKE) -j $(shell nproc --all)
|
||||
$(MAKE) preinstall
|
||||
cd -
|
||||
|
||||
# Build OpenCV on Raspberry pi zero which has ARMv6.
|
||||
build_raspi_zero:
|
||||
cd $(TMP_DIR)opencv/opencv-$(OPENCV_VERSION)
|
||||
mkdir build
|
||||
cd build
|
||||
rm -rf *
|
||||
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} -D OPENCV_EXTRA_MODULES_PATH=$(TMP_DIR)opencv/opencv_contrib-$(OPENCV_VERSION)/modules -D BUILD_DOCS=OFF -D BUILD_EXAMPLES=OFF -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_opencv_java=OFF -D BUILD_opencv_python=NO -D BUILD_opencv_python2=NO -D BUILD_opencv_python3=NO -D ENABLE_VFPV2=ON -D WITH_JASPER=OFF -D OPENCV_GENERATE_PKGCONFIG=ON ..
|
||||
$(MAKE) -j $(shell nproc --all)
|
||||
$(MAKE) preinstall
|
||||
cd -
|
||||
|
||||
# Build OpenCV for NVidia Jetson with CUDA.
|
||||
build_jetson:
|
||||
cd $(TMP_DIR)opencv/opencv-$(OPENCV_VERSION)
|
||||
mkdir build
|
||||
cd build
|
||||
rm -rf *
|
||||
cmake -D CMAKE_BUILD_TYPE=RELEASE \
|
||||
-D CMAKE_INSTALL_PREFIX=/usr/local \
|
||||
-D EIGEN_INCLUDE_PATH=/usr/include/eigen3 \
|
||||
-D BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} \
|
||||
-D OPENCV_EXTRA_MODULES_PATH=$(TMP_DIR)opencv/opencv_contrib-$(OPENCV_VERSION)/modules \
|
||||
-D BUILD_DOCS=OFF -D BUILD_EXAMPLES=OFF -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_opencv_java=OFF -D BUILD_opencv_python=NO -D BUILD_opencv_python2=NO -D BUILD_opencv_python3=NO \
|
||||
-D WITH_OPENCL=OFF \
|
||||
-D WITH_CUDA=ON \
|
||||
-D CUDA_ARCH_BIN=5.3 \
|
||||
-D CUDA_ARCH_PTX="" \
|
||||
-D WITH_CUDNN=ON \
|
||||
-D WITH_CUBLAS=ON \
|
||||
-D ENABLE_FAST_MATH=ON \
|
||||
-D CUDA_FAST_MATH=ON \
|
||||
-D OPENCV_DNN_CUDA=ON \
|
||||
-D ENABLE_NEON=ON \
|
||||
-D WITH_QT=OFF \
|
||||
-D WITH_OPENMP=ON \
|
||||
-D WITH_OPENGL=ON \
|
||||
-D BUILD_TIFF=ON \
|
||||
-D WITH_FFMPEG=ON \
|
||||
-D WITH_GSTREAMER=ON \
|
||||
-D WITH_TBB=ON \
|
||||
-D BUILD_TBB=ON \
|
||||
-D BUILD_TESTS=OFF \
|
||||
-D WITH_EIGEN=ON \
|
||||
-D WITH_V4L=ON \
|
||||
-D WITH_LIBV4L=ON \
|
||||
-D OPENCV_GENERATE_PKGCONFIG=ON ..
|
||||
$(MAKE) -j $(shell nproc --all)
|
||||
$(MAKE) preinstall
|
||||
cd -
|
||||
|
||||
# Build OpenCV with non-free contrib modules.
|
||||
build_nonfree:
|
||||
cd $(TMP_DIR)opencv/opencv-$(OPENCV_VERSION)
|
||||
mkdir build
|
||||
cd build
|
||||
rm -rf *
|
||||
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} -D OPENCV_EXTRA_MODULES_PATH=$(TMP_DIR)opencv/opencv_contrib-$(OPENCV_VERSION)/modules -D BUILD_DOCS=OFF -D BUILD_EXAMPLES=OFF -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_opencv_java=NO -D BUILD_opencv_python=NO -D BUILD_opencv_python2=NO -D BUILD_opencv_python3=NO -D WITH_JASPER=OFF -D WITH_TBB=ON -DOPENCV_GENERATE_PKGCONFIG=ON -DOPENCV_ENABLE_NONFREE=ON ..
|
||||
$(MAKE) -j $(shell nproc --all)
|
||||
$(MAKE) preinstall
|
||||
cd -
|
||||
|
||||
# Build OpenCV with openvino.
|
||||
build_openvino:
|
||||
cd $(TMP_DIR)opencv/opencv-$(OPENCV_VERSION)
|
||||
mkdir build
|
||||
cd build
|
||||
rm -rf *
|
||||
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} -D ENABLE_CXX11=ON -D OPENCV_EXTRA_MODULES_PATH=$(TMP_DIR)opencv/opencv_contrib-$(OPENCV_VERSION)/modules -D WITH_INF_ENGINE=ON -D InferenceEngine_DIR=/usr/local/dldt/inference-engine/build -D BUILD_DOCS=OFF -D BUILD_EXAMPLES=OFF -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_opencv_java=NO -D BUILD_opencv_python=NO -D BUILD_opencv_python2=NO -D BUILD_opencv_python3=NO -D WITH_JASPER=OFF -D WITH_TBB=ON -DOPENCV_GENERATE_PKGCONFIG=ON -DOPENCV_ENABLE_NONFREE=ON ..
|
||||
$(MAKE) -j $(shell nproc --all)
|
||||
$(MAKE) preinstall
|
||||
cd -
|
||||
|
||||
# Build OpenCV with cuda.
|
||||
build_cuda:
|
||||
cd $(TMP_DIR)opencv/opencv-$(OPENCV_VERSION)
|
||||
mkdir build
|
||||
cd build
|
||||
rm -rf *
|
||||
cmake -j $(shell nproc --all) -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} -D OPENCV_EXTRA_MODULES_PATH=$(TMP_DIR)opencv/opencv_contrib-$(OPENCV_VERSION)/modules -D BUILD_DOCS=OFF -D BUILD_EXAMPLES=OFF -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_opencv_java=NO -D BUILD_opencv_python=NO -D BUILD_opencv_python2=NO -D BUILD_opencv_python3=NO -D WITH_JASPER=OFF -D WITH_TBB=ON -DOPENCV_GENERATE_PKGCONFIG=ON -DWITH_CUDA=ON -DENABLE_FAST_MATH=1 -DCUDA_FAST_MATH=1 -DWITH_CUBLAS=1 -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda/ -DBUILD_opencv_cudacodec=OFF -D WITH_CUDNN=ON -D OPENCV_DNN_CUDA=ON -D CUDA_GENERATION=Auto ..
|
||||
$(MAKE) -j $(shell nproc --all)
|
||||
$(MAKE) preinstall
|
||||
cd -
|
||||
|
||||
# Build OpenCV staticly linked
|
||||
build_static:
|
||||
cd $(TMP_DIR)opencv/opencv-$(OPENCV_VERSION)
|
||||
mkdir build
|
||||
cd build
|
||||
rm -rf *
|
||||
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_SHARED_LIBS=OFF -D OPENCV_EXTRA_MODULES_PATH=$(TMP_DIR)opencv/opencv_contrib-$(OPENCV_VERSION)/modules -D BUILD_DOCS=OFF -D BUILD_EXAMPLES=OFF -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_opencv_java=NO -D BUILD_opencv_python=NO -D BUILD_opencv_python2=NO -D BUILD_opencv_python3=NO -DWITH_JASPER=OFF -DWITH_QT=OFF -DWITH_GTK=OFF -DWITH_FFMPEG=OFF -DWITH_TIFF=OFF -DWITH_WEBP=OFF -DWITH_PNG=OFF -DWITH_1394=OFF -DWITH_OPENJPEG=OFF -DOPENCV_GENERATE_PKGCONFIG=ON ..
|
||||
$(MAKE) -j $(shell nproc --all)
|
||||
$(MAKE) preinstall
|
||||
cd -
|
||||
|
||||
# Build OpenCV with cuda.
|
||||
build_all:
|
||||
cd $(TMP_DIR)opencv/opencv-$(OPENCV_VERSION)
|
||||
mkdir build
|
||||
cd build
|
||||
rm -rf *
|
||||
cmake -j $(shell nproc --all) -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} -D ENABLE_CXX11=ON -D OPENCV_EXTRA_MODULES_PATH=$(TMP_DIR)opencv/opencv_contrib-$(OPENCV_VERSION)/modules -D WITH_INF_ENGINE=ON -D InferenceEngine_DIR=/usr/local/dldt/inference-engine/build -D BUILD_DOCS=OFF -D BUILD_EXAMPLES=OFF -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_opencv_java=NO -D BUILD_opencv_python=NO -D BUILD_opencv_python2=NO -D BUILD_opencv_python3=NO -D WITH_JASPER=OFF -D WITH_TBB=ON -DOPENCV_GENERATE_PKGCONFIG=ON -DWITH_CUDA=ON -DENABLE_FAST_MATH=1 -DCUDA_FAST_MATH=1 -DWITH_CUBLAS=1 -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda/ -DBUILD_opencv_cudacodec=OFF -D WITH_CUDNN=ON -D OPENCV_DNN_CUDA=ON -D CUDA_GENERATION=Auto ..
|
||||
$(MAKE) -j $(shell nproc --all)
|
||||
$(MAKE) preinstall
|
||||
cd -
|
||||
|
||||
# Cleanup temporary build files.
|
||||
clean:
|
||||
go clean --cache
|
||||
rm -rf $(TMP_DIR)opencv
|
||||
|
||||
# Cleanup old library files.
|
||||
sudo_pre_install_clean:
|
||||
sudo rm -rf /usr/local/lib/cmake/opencv4/
|
||||
sudo rm -rf /usr/local/lib/libopencv*
|
||||
sudo rm -rf /usr/local/lib/pkgconfig/opencv*
|
||||
sudo rm -rf /usr/local/include/opencv*
|
||||
|
||||
# Do everything.
|
||||
install: deps download sudo_pre_install_clean build sudo_install clean verify
|
||||
|
||||
# Do everything on Raspbian.
|
||||
install_raspi: deps download build_raspi sudo_install clean verify
|
||||
|
||||
# Do everything on the raspberry pi zero.
|
||||
install_raspi_zero: deps download build_raspi_zero sudo_install clean verify
|
||||
|
||||
# Do everything on Jetson.
|
||||
install_jetson: deps download build_jetson sudo_install clean verify
|
||||
|
||||
# Do everything with cuda.
|
||||
install_cuda: deps download sudo_pre_install_clean build_cuda sudo_install clean verify verify_cuda
|
||||
|
||||
# Do everything with openvino.
|
||||
install_openvino: deps download download_openvino sudo_pre_install_clean build_openvino_package sudo_install_openvino build_openvino sudo_install clean verify_openvino
|
||||
|
||||
# Do everything statically.
|
||||
install_static: deps download sudo_pre_install_clean build_static sudo_install clean verify_static
|
||||
|
||||
# Do everything with non-free modules from cpencv_contrib.
|
||||
install_nonfree: deps download sudo_pre_install_clean build_nonfree sudo_install clean verify
|
||||
|
||||
# Do everything with openvino and cuda.
|
||||
install_all: deps download download_openvino sudo_pre_install_clean build_openvino_package sudo_install_openvino build_all sudo_install clean verify_openvino verify_cuda
|
||||
|
||||
# Install system wide.
|
||||
sudo_install:
|
||||
cd $(TMP_DIR)opencv/opencv-$(OPENCV_VERSION)/build
|
||||
sudo $(MAKE) install
|
||||
sudo ldconfig
|
||||
cd -
|
||||
|
||||
# Install system wide.
|
||||
sudo_install_openvino:
|
||||
cd /usr/local/openvino/inference-engine/build
|
||||
sudo $(MAKE) install
|
||||
sudo ldconfig
|
||||
cd -
|
||||
|
||||
# Build a minimal Go app to confirm gocv works.
|
||||
verify:
|
||||
go run ./cmd/version/main.go
|
||||
|
||||
# Build a minimal Go app to confirm gocv works with statically built OpenCV.
|
||||
verify_static:
|
||||
go run -tags static ./cmd/version/main.go
|
||||
|
||||
# Build a minimal Go app to confirm gocv cuda works.
|
||||
verify_cuda:
|
||||
go run ./cmd/cuda/main.go
|
||||
|
||||
# Build a minimal Go app to confirm gocv openvino works.
|
||||
verify_openvino:
|
||||
go run -tags openvino ./cmd/version/main.go
|
||||
|
||||
# Runs tests.
|
||||
# This assumes env.sh was already sourced.
|
||||
# pvt is not tested here since it requires additional depenedences.
|
||||
test:
|
||||
go test -tags matprofile . ./contrib
|
||||
|
||||
docker:
|
||||
docker build --build-arg OPENCV_VERSION=$(OPENCV_VERSION) --build-arg GOVERSION=$(GOVERSION) .
|
||||
|
||||
astyle:
|
||||
astyle --project=.astylerc --recursive *.cpp,*.h
|
||||
|
||||
|
||||
releaselog:
|
||||
git log --pretty=format:"%s" $(GOCV_VERSION)..HEAD
|
||||
|
||||
CMDS=basic-drawing caffe-classifier captest capwindow counter dnn-detection dnn-pose-detection dnn-style-transfer faceblur facedetect facedetect-from-url feature-matching find-chessboard find-circles find-lines hand-gestures hello img-similarity mjpeg-streamer motion-detect saveimage savevideo showimage ssd-facedetect tf-classifier tracking version xphoto
|
||||
cmds:
|
||||
for cmd in $(CMDS) ; do \
|
||||
go build -o build/$$cmd cmd/$$cmd/main.go ;
|
||||
done ; \
|
593
vendor/gocv.io/x/gocv/README.md
generated
vendored
593
vendor/gocv.io/x/gocv/README.md
generated
vendored
@ -1,593 +0,0 @@
|
||||
# GoCV
|
||||
|
||||
[](http://gocv.io/)
|
||||
|
||||
[](https://pkg.go.dev/gocv.io/x/gocv)
|
||||
[](https://github.com/hybridgroup/gocv/actions/workflows/linux.yml)
|
||||
[](https://ci.appveyor.com/project/deadprogram/gocv/branch/dev)
|
||||
[](https://goreportcard.com/report/github.com/hybridgroup/gocv)
|
||||
[](https://github.com/hybridgroup/gocv/blob/release/LICENSE.txt)
|
||||
|
||||
The GoCV package provides Go language bindings for the [OpenCV 4](http://opencv.org/) computer vision library.
|
||||
|
||||
The GoCV package supports the latest releases of Go and OpenCV (v4.6.0) on Linux, macOS, and Windows. We intend to make the Go language a "first-class" client compatible with the latest developments in the OpenCV ecosystem.
|
||||
|
||||
GoCV supports [CUDA](https://en.wikipedia.org/wiki/CUDA) for hardware acceleration using Nvidia GPUs. Check out the [CUDA README](./cuda/README.md) for more info on how to use GoCV with OpenCV/CUDA.
|
||||
|
||||
GoCV also supports [Intel OpenVINO](https://software.intel.com/en-us/openvino-toolkit). Check out the [OpenVINO README](./openvino/README.md) for more info on how to use GoCV with the Intel OpenVINO toolkit.
|
||||
|
||||
## How to use
|
||||
|
||||
### Hello, video
|
||||
|
||||
This example opens a video capture device using device "0", reads frames, and shows the video in a GUI window:
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"gocv.io/x/gocv"
|
||||
)
|
||||
|
||||
func main() {
|
||||
webcam, _ := gocv.OpenVideoCapture(0)
|
||||
window := gocv.NewWindow("Hello")
|
||||
img := gocv.NewMat()
|
||||
|
||||
for {
|
||||
webcam.Read(&img)
|
||||
window.IMShow(img)
|
||||
window.WaitKey(1)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Face detect
|
||||
|
||||

|
||||
|
||||
This is a more complete example that opens a video capture device using device "0". It also uses the CascadeClassifier class to load an external data file containing the classifier data. The program grabs each frame from the video, then uses the classifier to detect faces. If any faces are found, it draws a green rectangle around each one, then displays the video in an output window:
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"image/color"
|
||||
|
||||
"gocv.io/x/gocv"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// set to use a video capture device 0
|
||||
deviceID := 0
|
||||
|
||||
// open webcam
|
||||
webcam, err := gocv.OpenVideoCapture(deviceID)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
defer webcam.Close()
|
||||
|
||||
// open display window
|
||||
window := gocv.NewWindow("Face Detect")
|
||||
defer window.Close()
|
||||
|
||||
// prepare image matrix
|
||||
img := gocv.NewMat()
|
||||
defer img.Close()
|
||||
|
||||
// color for the rect when faces detected
|
||||
blue := color.RGBA{0, 0, 255, 0}
|
||||
|
||||
// load classifier to recognize faces
|
||||
classifier := gocv.NewCascadeClassifier()
|
||||
defer classifier.Close()
|
||||
|
||||
if !classifier.Load("data/haarcascade_frontalface_default.xml") {
|
||||
fmt.Println("Error reading cascade file: data/haarcascade_frontalface_default.xml")
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Printf("start reading camera device: %v\n", deviceID)
|
||||
for {
|
||||
if ok := webcam.Read(&img); !ok {
|
||||
fmt.Printf("cannot read device %v\n", deviceID)
|
||||
return
|
||||
}
|
||||
if img.Empty() {
|
||||
continue
|
||||
}
|
||||
|
||||
// detect faces
|
||||
rects := classifier.DetectMultiScale(img)
|
||||
fmt.Printf("found %d faces\n", len(rects))
|
||||
|
||||
// draw a rectangle around each face on the original image
|
||||
for _, r := range rects {
|
||||
gocv.Rectangle(&img, r, blue, 3)
|
||||
}
|
||||
|
||||
// show the image in the window, and wait 1 millisecond
|
||||
window.IMShow(img)
|
||||
window.WaitKey(1)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### More examples
|
||||
|
||||
There are examples in the [cmd directory](./cmd) of this repo in the form of various useful command line utilities, such as [capturing an image file](./cmd/saveimage), [streaming mjpeg video](./cmd/mjpeg-streamer), [counting objects that cross a line](./cmd/counter), and [using OpenCV with Tensorflow for object classification](./cmd/tf-classifier).
|
||||
|
||||
## How to install
|
||||
|
||||
To install GoCV, you must first have the matching version of OpenCV installed on your system. The current release of GoCV requires OpenCV 4.6.0.
|
||||
|
||||
Here are instructions for Ubuntu, Raspian, macOS, and Windows.
|
||||
|
||||
## Ubuntu/Linux
|
||||
|
||||
### Installation
|
||||
|
||||
You can use `make` to install OpenCV 4.6.0 with the handy `Makefile` included with this repo. If you already have installed OpenCV, you do not need to do so again. The installation performed by the `Makefile` is minimal, so it may remove OpenCV options such as Python or Java wrappers if you have already installed OpenCV some other way.
|
||||
|
||||
#### Quick Install
|
||||
|
||||
First, change directories to where you want to install GoCV, and then use git to clone the repository to your local machine like this:
|
||||
|
||||
cd $HOME/folder/with/your/src/
|
||||
git clone https://github.com/hybridgroup/gocv.git
|
||||
|
||||
Make sure to change `$HOME/folder/with/your/src/` to where you actually want to save the code.
|
||||
|
||||
Once you have cloned the repo, the following commands should do everything to download and install OpenCV 4.6.0 on Linux:
|
||||
|
||||
cd gocv
|
||||
make install
|
||||
|
||||
If you need static opencv libraries
|
||||
|
||||
make install BUILD_SHARED_LIBS=OFF
|
||||
|
||||
If it works correctly, at the end of the entire process, the following message should be displayed:
|
||||
|
||||
gocv version: 0.31.0
|
||||
opencv lib version: 4.6.0
|
||||
|
||||
That's it, now you are ready to use GoCV.
|
||||
|
||||
#### Using CUDA with GoCV
|
||||
|
||||
See the [cuda directory](./cuda) for information.
|
||||
|
||||
#### Using OpenVINO with GoCV
|
||||
|
||||
See the [openvino directory](./openvino) for information.
|
||||
|
||||
#### Make Install for OpenVINO and Cuda
|
||||
|
||||
The following commands should do everything to download and install OpenCV 4.6.0 with CUDA and OpenVINO on Linux. Make sure to change `$HOME/folder/with/your/src/` to the directory you used to clone GoCV:
|
||||
|
||||
cd $HOME/folder/with/gocv/
|
||||
make install_all
|
||||
|
||||
If you need static opencv libraries
|
||||
|
||||
make install_all BUILD_SHARED_LIBS=OFF
|
||||
|
||||
If it works correctly, at the end of the entire process, the following message should be displayed:
|
||||
|
||||
gocv version: 0.31.0
|
||||
opencv lib version: 4.6.0-openvino
|
||||
cuda information:
|
||||
Device 0: "GeForce MX150" 2003Mb, sm_61, Driver/Runtime ver.10.0/10.0
|
||||
|
||||
#### Complete Install
|
||||
|
||||
If you have already done the "Quick Install" as described above, you do not need to run any further commands. For the curious, or for custom installations, here are the details for each of the steps that are performed when you run `make install`.
|
||||
|
||||
First, change directories to where you want to install GoCV, and then use git to clone the repository to your local machine like this:
|
||||
|
||||
cd $HOME/folder/with/your/src/
|
||||
git clone https://github.com/hybridgroup/gocv.git
|
||||
|
||||
Make sure to change `$HOME/folder/with/your/src/` to where you actually want to save the code.
|
||||
|
||||
##### Install required packages
|
||||
|
||||
First, you need to change the current directory to the location where you cloned the GoCV repo, so you can access the `Makefile`:
|
||||
|
||||
cd $HOME/folder/with/your/src/gocv
|
||||
|
||||
Next, you need to update the system, and install any required packages:
|
||||
|
||||
make deps
|
||||
|
||||
#### Download source
|
||||
|
||||
Now, download the OpenCV 4.6.0 and OpenCV Contrib source code:
|
||||
|
||||
make download
|
||||
|
||||
#### Build
|
||||
|
||||
Build everything. This will take quite a while:
|
||||
|
||||
make build
|
||||
|
||||
If you need static opencv libraries
|
||||
|
||||
make build BUILD_SHARED_LIBS=OFF
|
||||
|
||||
#### Install
|
||||
|
||||
Once the code is built, you are ready to install:
|
||||
|
||||
make sudo_install
|
||||
|
||||
### Verifying the installation
|
||||
|
||||
To verify your installation you can run one of the included examples.
|
||||
|
||||
First, change the current directory to the location of the GoCV repo:
|
||||
|
||||
cd $HOME/src/gocv.io/x/gocv
|
||||
|
||||
Now you should be able to build or run any of the examples:
|
||||
|
||||
go run ./cmd/version/main.go
|
||||
|
||||
The version program should output the following:
|
||||
|
||||
gocv version: 0.31.0
|
||||
opencv lib version: 4.6.0
|
||||
|
||||
#### Cleanup extra files
|
||||
|
||||
After the installation is complete, you can remove the extra files and folders:
|
||||
|
||||
make clean
|
||||
|
||||
### Custom Environment
|
||||
|
||||
By default, pkg-config is used to determine the correct flags for compiling and linking OpenCV. This behavior can be disabled by supplying `-tags customenv` when building/running your application. When building with this tag you will need to supply the CGO environment variables yourself.
|
||||
|
||||
For example:
|
||||
|
||||
export CGO_CPPFLAGS="-I/usr/local/include"
|
||||
export CGO_LDFLAGS="-L/usr/local/lib -lopencv_core -lopencv_face -lopencv_videoio -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs -lopencv_objdetect -lopencv_features2d -lopencv_video -lopencv_dnn -lopencv_xfeatures2d"
|
||||
|
||||
Please note that you will need to run these 2 lines of code one time in your current session in order to build or run the code, in order to setup the needed ENV variables. Once you have done so, you can execute code that uses GoCV with your custom environment like this:
|
||||
|
||||
go run -tags customenv ./cmd/version/main.go
|
||||
|
||||
### Docker
|
||||
|
||||
The project now provides `Dockerfile` which lets you build [GoCV](https://gocv.io/) Docker image which you can then use to build and run `GoCV` applications in Docker containers. The `Makefile` contains `docker` target which lets you build Docker image with a single command:
|
||||
|
||||
```
|
||||
make docker
|
||||
```
|
||||
|
||||
By default Docker image built by running the command above ships [Go](https://golang.org/) version `1.16.5`, but if you would like to build an image which uses different version of `Go` you can override the default value when running the target command:
|
||||
|
||||
```
|
||||
make docker GOVERSION='1.15'
|
||||
```
|
||||
|
||||
#### Running GUI programs in Docker on macOS
|
||||
|
||||
Sometimes your `GoCV` programs create graphical interfaces like windows eg. when you use `gocv.Window` type when you display an image or video stream. Running the programs which create graphical interfaces in Docker container on macOS is unfortunately a bit elaborate, but not impossible. First you need to satisfy the following prerequisites:
|
||||
* install [xquartz](https://www.xquartz.org/). You can also install xquartz using [homebrew](https://brew.sh/) by running `brew cask install xquartz`
|
||||
* install [socat](https://linux.die.net/man/1/socat) `brew install socat`
|
||||
|
||||
Note, you will have to log out and log back in to your machine once you have installed `xquartz`. This is so the X window system is reloaded.
|
||||
|
||||
Once you have installed all the prerequisites you need to allow connections from network clients to `xquartz`. Here is how you do that. First run the following command to open `xquart` so you can configure it:
|
||||
|
||||
```shell
|
||||
open -a xquartz
|
||||
```
|
||||
Click on *Security* tab in preferences and check the "Allow connections" box:
|
||||
|
||||

|
||||
|
||||
Next, you need to create a TCP proxy using `socat` which will stream [X Window](https://en.wikipedia.org/wiki/X_Window_System) data into `xquart`. Before you start the proxy you need to make sure that there is no process listening in port `6000`. The following command should **not** return any results:
|
||||
|
||||
```shell
|
||||
lsof -i TCP:6000
|
||||
```
|
||||
Now you can start a local proxy which will proxy the X Window traffic into xquartz which acts a your local X server:
|
||||
|
||||
```shell
|
||||
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
|
||||
```
|
||||
|
||||
You are now finally ready to run your `GoCV` GUI programs in Docker containers. In order to make everything work you must set `DISPLAY` environment variables as shown in a sample command below:
|
||||
|
||||
```shell
|
||||
docker run -it --rm -e DISPLAY=docker.for.mac.host.internal:0 your-gocv-app
|
||||
```
|
||||
|
||||
**Note, since Docker for MacOS does not provide any video device support, you won't be able run GoCV apps which require camera.**
|
||||
|
||||
### Alpine 3.7 Docker image
|
||||
|
||||
There is a Docker image with Alpine 3.7 that has been created by project contributor [@denismakogon](https://github.com/denismakogon). You can find it located at [https://github.com/denismakogon/gocv-alpine](https://github.com/denismakogon/gocv-alpine).
|
||||
|
||||
## Raspbian
|
||||
|
||||
### Installation
|
||||
|
||||
We have a special installation for the Raspberry Pi that includes some hardware optimizations. You use `make` to install OpenCV 4.6.0 with the handy `Makefile` included with this repo. If you already have installed OpenCV, you do not need to do so again. The installation performed by the `Makefile` is minimal, so it may remove OpenCV options such as Python or Java wrappers if you have already installed OpenCV some other way.
|
||||
|
||||
#### Quick Install
|
||||
|
||||
First, change directories to where you want to install GoCV, and then use git to clone the repository to your local machine like this:
|
||||
|
||||
cd $HOME/folder/with/your/src/
|
||||
git clone https://github.com/hybridgroup/gocv.git
|
||||
|
||||
Make sure to change `$HOME/folder/with/your/src/` to where you actually want to save the code.
|
||||
|
||||
The following make command should do everything to download and install OpenCV 4.6.0 on Raspbian:
|
||||
|
||||
cd $HOME/folder/with/your/src/gocv
|
||||
make install_raspi
|
||||
|
||||
If it works correctly, at the end of the entire process, the following message should be displayed:
|
||||
|
||||
gocv version: 0.31.0
|
||||
opencv lib version: 4.6.0
|
||||
|
||||
That's it, now you are ready to use GoCV.
|
||||
|
||||
## macOS
|
||||
|
||||
### Installation
|
||||
|
||||
You can install OpenCV 4.6.0 using Homebrew.
|
||||
|
||||
If you already have an earlier version of OpenCV (3.4.x) installed, you should probably remove it before installing the new version:
|
||||
|
||||
brew uninstall opencv
|
||||
|
||||
You can then install OpenCV 4.6.0:
|
||||
|
||||
brew install opencv
|
||||
|
||||
### pkgconfig Installation
|
||||
pkg-config is used to determine the correct flags for compiling and linking OpenCV.
|
||||
You can install it by using Homebrew:
|
||||
|
||||
brew install pkgconfig
|
||||
|
||||
### Verifying the installation
|
||||
|
||||
To verify your installation you can run one of the included examples.
|
||||
|
||||
First, change the current directory to the location of the GoCV repo:
|
||||
|
||||
cd $HOME/folder/with/your/src/gocv
|
||||
|
||||
Now you should be able to build or run any of the examples:
|
||||
|
||||
go run ./cmd/version/main.go
|
||||
|
||||
The version program should output the following:
|
||||
|
||||
gocv version: 0.31.0
|
||||
opencv lib version: 4.6.0
|
||||
|
||||
### Custom Environment
|
||||
|
||||
By default, pkg-config is used to determine the correct flags for compiling and linking OpenCV. This behavior can be disabled by supplying `-tags customenv` when building/running your application. When building with this tag you will need to supply the CGO environment variables yourself.
|
||||
|
||||
For example:
|
||||
|
||||
export CGO_CXXFLAGS="--std=c++11"
|
||||
export CGO_CPPFLAGS="-I/usr/local/Cellar/opencv/4.6.0/include"
|
||||
export CGO_LDFLAGS="-L/usr/local/Cellar/opencv/4.6.0/lib -lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn_objdetect -lopencv_dpm -lopencv_face -lopencv_photo -lopencv_fuzzy -lopencv_hfs -lopencv_img_hash -lopencv_line_descriptor -lopencv_optflow -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_dnn -lopencv_plot -lopencv_xfeatures2d -lopencv_shape -lopencv_video -lopencv_ml -lopencv_ximgproc -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_flann -lopencv_xobjdetect -lopencv_imgcodecs -lopencv_objdetect -lopencv_xphoto -lopencv_imgproc -lopencv_core"
|
||||
|
||||
Please note that you will need to run these 3 lines of code one time in your current session in order to build or run the code, in order to setup the needed ENV variables. Once you have done so, you can execute code that uses GoCV with your custom environment like this:
|
||||
|
||||
go run -tags customenv ./cmd/version/main.go
|
||||
|
||||
## Windows
|
||||
|
||||
### Installation
|
||||
|
||||
The following assumes that you are running a 64-bit version of Windows 10.
|
||||
|
||||
In order to build and install OpenCV 4.6.0 on Windows, you must first download and install MinGW-W64 and CMake, as follows.
|
||||
|
||||
#### MinGW-W64
|
||||
|
||||
Download and run the MinGW-W64 compiler installer from [https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/8.1.0/](https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/8.1.0/).
|
||||
|
||||
The latest version of the MinGW-W64 toolchain is `8.1.0`, but any version from `8.X` on should work.
|
||||
|
||||
Choose the options for "posix" threads, and for "seh" exceptions handling, then install to the default location `c:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0`.
|
||||
|
||||
Add the `C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin` path to your System Path.
|
||||
|
||||
#### CMake
|
||||
|
||||
Download and install CMake [https://cmake.org/download/](https://cmake.org/download/) to the default location. CMake installer will add CMake to your system path.
|
||||
|
||||
#### OpenCV 4.6.0 and OpenCV Contrib Modules
|
||||
|
||||
The following commands should do everything to download and install OpenCV 4.6.0 on Windows:
|
||||
|
||||
chdir %GOPATH%\src\gocv.io\x\gocv
|
||||
win_build_opencv.cmd
|
||||
|
||||
It might take up to one hour.
|
||||
|
||||
Last, add `C:\opencv\build\install\x64\mingw\bin` to your System Path.
|
||||
|
||||
### Verifying the installation
|
||||
|
||||
Change the current directory to the location of the GoCV repo:
|
||||
|
||||
chdir %GOPATH%\src\gocv.io\x\gocv
|
||||
|
||||
Now you should be able to build or run any of the command examples:
|
||||
|
||||
go run cmd\version\main.go
|
||||
|
||||
The version program should output the following:
|
||||
|
||||
gocv version: 0.31.0
|
||||
opencv lib version: 4.6.0
|
||||
|
||||
That's it, now you are ready to use GoCV.
|
||||
|
||||
### Custom Environment
|
||||
|
||||
By default, OpenCV is expected to be in `C:\opencv\build\install\include`. This behavior can be disabled by supplying `-tags customenv` when building/running your application. When building with this tag you will need to supply the CGO environment variables yourself.
|
||||
|
||||
Due to the way OpenCV produces DLLs, including the version in the name, using this method is required if you're using a different version of OpenCV.
|
||||
|
||||
For example:
|
||||
|
||||
set CGO_CXXFLAGS="--std=c++11"
|
||||
set CGO_CPPFLAGS=-IC:\opencv\build\install\include
|
||||
set CGO_LDFLAGS=-LC:\opencv\build\install\x64\mingw\lib -lopencv_core460 -lopencv_face460 -lopencv_videoio460 -lopencv_imgproc460 -lopencv_highgui460 -lopencv_imgcodecs460 -lopencv_objdetect460 -lopencv_features2d460 -lopencv_video460 -lopencv_dnn460 -lopencv_xfeatures2d460 -lopencv_plot460 -lopencv_tracking460 -lopencv_img_hash460
|
||||
|
||||
Please note that you will need to run these 3 lines of code one time in your current session in order to build or run the code, in order to setup the needed ENV variables. Once you have done so, you can execute code that uses GoCV with your custom environment like this:
|
||||
|
||||
go run -tags customenv cmd\version\main.go
|
||||
|
||||
## Android
|
||||
|
||||
There is some work in progress for running GoCV on Android using Gomobile. For information on how to install OpenCV/GoCV for Android, please see:
|
||||
https://gist.github.com/ogero/c19458cf64bd3e91faae85c3ac887481
|
||||
|
||||
See original discussion here:
|
||||
https://github.com/hybridgroup/gocv/issues/235
|
||||
|
||||
## Profiling
|
||||
|
||||
Since memory allocations for images in GoCV are done through C based code, the go garbage collector will not clean all resources associated with a `Mat`. As a result, any `Mat` created *must* be closed to avoid memory leaks.
|
||||
|
||||
To ease the detection and repair of the resource leaks, GoCV provides a `Mat` profiler that records when each `Mat` is created and closed. Each time a `Mat` is allocated, the stack trace is added to the profile. When it is closed, the stack trace is removed. See the [runtime/pprof documentation](https://golang.org/pkg/runtime/pprof/#Profile).
|
||||
|
||||
In order to include the MatProfile custom profiler, you MUST build or run your application or tests using the `-tags matprofile` build tag. For example:
|
||||
|
||||
go run -tags matprofile cmd/version/main.go
|
||||
|
||||
You can get the profile's count at any time using:
|
||||
|
||||
```go
|
||||
gocv.MatProfile.Count()
|
||||
```
|
||||
|
||||
You can display the current entries (the stack traces) with:
|
||||
|
||||
```go
|
||||
var b bytes.Buffer
|
||||
gocv.MatProfile.WriteTo(&b, 1)
|
||||
fmt.Print(b.String())
|
||||
```
|
||||
|
||||
This can be very helpful to track down a leak. For example, suppose you have
|
||||
the following nonsense program:
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"gocv.io/x/gocv"
|
||||
)
|
||||
|
||||
func leak() {
|
||||
gocv.NewMat()
|
||||
}
|
||||
|
||||
func main() {
|
||||
fmt.Printf("initial MatProfile count: %v\n", gocv.MatProfile.Count())
|
||||
leak()
|
||||
|
||||
fmt.Printf("final MatProfile count: %v\n", gocv.MatProfile.Count())
|
||||
var b bytes.Buffer
|
||||
gocv.MatProfile.WriteTo(&b, 1)
|
||||
fmt.Print(b.String())
|
||||
}
|
||||
```
|
||||
|
||||
Running this program produces the following output:
|
||||
|
||||
```
|
||||
initial MatProfile count: 0
|
||||
final MatProfile count: 1
|
||||
gocv.io/x/gocv.Mat profile: total 1
|
||||
1 @ 0x40b936c 0x40b93b7 0x40b94e2 0x40b95af 0x402cd87 0x40558e1
|
||||
# 0x40b936b gocv.io/x/gocv.newMat+0x4b /go/src/gocv.io/x/gocv/core.go:153
|
||||
# 0x40b93b6 gocv.io/x/gocv.NewMat+0x26 /go/src/gocv.io/x/gocv/core.go:159
|
||||
# 0x40b94e1 main.leak+0x21 /go/src/github.com/dougnd/gocvprofexample/main.go:11
|
||||
# 0x40b95ae main.main+0xae /go/src/github.com/dougnd/gocvprofexample/main.go:16
|
||||
# 0x402cd86 runtime.main+0x206 /usr/local/Cellar/go/1.11.1/libexec/src/runtime/proc.go:201
|
||||
```
|
||||
|
||||
We can see that this program would leak memory. As it exited, it had one `Mat` that was never closed. The stack trace points to exactly which line the allocation happened on (line 11, the `gocv.NewMat()`).
|
||||
|
||||
Furthermore, if the program is a long running process or if GoCV is being used on a web server, it may be helpful to install the HTTP interface )). For example:
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
"time"
|
||||
|
||||
"gocv.io/x/gocv"
|
||||
)
|
||||
|
||||
func leak() {
|
||||
gocv.NewMat()
|
||||
}
|
||||
|
||||
func main() {
|
||||
go func() {
|
||||
ticker := time.NewTicker(time.Second)
|
||||
for {
|
||||
<-ticker.C
|
||||
leak()
|
||||
}
|
||||
}()
|
||||
|
||||
http.ListenAndServe("localhost:6060", nil)
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
This will leak a `Mat` once per second. You can see the current profile count and stack traces by going to the installed HTTP debug interface: [http://localhost:6060/debug/pprof/gocv.io/x/gocv.Mat](http://localhost:6060/debug/pprof/gocv.io/x/gocv.Mat?debug=1).
|
||||
|
||||
|
||||
## How to contribute
|
||||
|
||||
Please take a look at our [CONTRIBUTING.md](./CONTRIBUTING.md) document to understand our contribution guidelines.
|
||||
|
||||
Then check out our [ROADMAP.md](./ROADMAP.md) document to know what to work on next.
|
||||
|
||||
## Why this project exists
|
||||
|
||||
The [https://github.com/go-opencv/go-opencv](https://github.com/go-opencv/go-opencv) package for Go and OpenCV does not support any version above OpenCV 2.x, and work on adding support for OpenCV 3 had stalled for over a year, mostly due to the complexity of [SWIG](http://swig.org/). That is why we started this project.
|
||||
|
||||
The GoCV package uses a C-style wrapper around the OpenCV 4 C++ classes to avoid having to deal with applying SWIG to a huge existing codebase. The mappings are intended to match as closely as possible to the original OpenCV project structure, to make it easier to find things, and to be able to figure out where to add support to GoCV for additional OpenCV image filters, algorithms, and other features.
|
||||
|
||||
For example, the [OpenCV `videoio` module](https://github.com/opencv/opencv/tree/master/modules/videoio) wrappers can be found in the GoCV package in the `videoio.*` files.
|
||||
|
||||
This package was inspired by the original https://github.com/go-opencv/go-opencv project, the blog post https://medium.com/@peterleyssens/using-opencv-3-from-golang-5510c312a3c and the repo at https://github.com/sensorbee/opencv thank you all!
|
||||
|
||||
## License
|
||||
|
||||
Licensed under the Apache 2.0 license. Copyright (c) 2017-2021 The Hybrid Group.
|
||||
|
||||
Logo generated by GopherizeMe - https://gopherize.me
|
400
vendor/gocv.io/x/gocv/ROADMAP.md
generated
vendored
400
vendor/gocv.io/x/gocv/ROADMAP.md
generated
vendored
@ -1,400 +0,0 @@
|
||||
# Roadmap
|
||||
|
||||
This is a list of all of the functionality areas within OpenCV, and OpenCV Contrib.
|
||||
|
||||
Any section listed with an "X" means that all of the relevant OpenCV functionality has been wrapped for use within GoCV.
|
||||
|
||||
Any section listed with **WORK STARTED** indicates that some work has been done, but not all functionality in that module has been completed. If there are any functions listed under a section marked **WORK STARTED**, it indicates that that function still requires a wrapper implemented.
|
||||
|
||||
And any section that is simply listed, indicates that so far, no work has been done on that module.
|
||||
|
||||
Your pull requests will be greatly appreciated!
|
||||
|
||||
## Modules list
|
||||
|
||||
- [ ] **core. Core functionality - WORK STARTED**
|
||||
- [X] **Basic structures**
|
||||
- [ ] **Operations on arrays - WORK STARTED**. The following functions still need implementation:
|
||||
- [ ] [Mahalanobis](https://docs.opencv.org/master/d2/de8/group__core__array.html#ga4493aee129179459cbfc6064f051aa7d)
|
||||
- [ ] [mulTransposed](https://docs.opencv.org/master/d2/de8/group__core__array.html#gadc4e49f8f7a155044e3be1b9e3b270ab)
|
||||
- [ ] [PCABackProject](https://docs.opencv.org/master/d2/de8/group__core__array.html#gab26049f30ee8e94f7d69d82c124faafc)
|
||||
- [ ] [PCACompute](https://docs.opencv.org/master/d2/de8/group__core__array.html#ga4e2073c7311f292a0648f04c37b73781)
|
||||
- [ ] [PCAProject](https://docs.opencv.org/master/d2/de8/group__core__array.html#ga6b9fbc7b3a99ebfd441bbec0a6bc4f88)
|
||||
- [ ] [PSNR](https://docs.opencv.org/master/d2/de8/group__core__array.html#ga07aaf34ae31d226b1b847d8bcff3698f)
|
||||
- [ ] [randn](https://docs.opencv.org/master/d2/de8/group__core__array.html#gaeff1f61e972d133a04ce3a5f81cf6808)
|
||||
- [ ] [randShuffle](https://docs.opencv.org/master/d2/de8/group__core__array.html#ga6a789c8a5cb56c6dd62506179808f763)
|
||||
- [ ] [randu](https://docs.opencv.org/master/d2/de8/group__core__array.html#ga1ba1026dca0807b27057ba6a49d258c0)
|
||||
- [ ] [setRNGSeed](https://docs.opencv.org/master/d2/de8/group__core__array.html#ga757e657c037410d9e19e819569e7de0f)
|
||||
- [ ] [SVBackSubst](https://docs.opencv.org/master/d2/de8/group__core__array.html#gab4e620e6fc6c8a27bb2be3d50a840c0b)
|
||||
- [ ] [SVDecomp](https://docs.opencv.org/master/d2/de8/group__core__array.html#gab477b5b7b39b370bb03e75b19d2d5109)
|
||||
- [ ] [theRNG](https://docs.opencv.org/master/d2/de8/group__core__array.html#ga75843061d150ad6564b5447e38e57722)
|
||||
|
||||
- [ ] XML/YAML Persistence
|
||||
- [ ] [FileStorage](https://docs.opencv.org/master/da/d56/classcv_1_1FileStorage.html)
|
||||
|
||||
- [ ] **Clustering - WORK STARTED**. The following functions still need implementation:
|
||||
- [ ] [partition](https://docs.opencv.org/master/d5/d38/group__core__cluster.html#ga2037c989e69b499c1aa271419f3a9b34)
|
||||
|
||||
- [ ] Optimization Algorithms
|
||||
- [ ] [ConjGradSolver](https://docs.opencv.org/master/d0/d21/classcv_1_1ConjGradSolver.html)
|
||||
- [ ] [DownhillSolver](https://docs.opencv.org/master/d4/d43/classcv_1_1DownhillSolver.html)
|
||||
- [ ] [solveLP](https://docs.opencv.org/master/da/d01/group__core__optim.html#ga9a06d237a9d38ace891efa1ca1b5d00a)
|
||||
|
||||
- [ ] **imgproc. Image processing - WORK STARTED**
|
||||
- [ ] **Image Filtering - WORK STARTED** The following functions still need implementation:
|
||||
- [ ] [buildPyramid](https://docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gacfdda2bc1ac55e96de7e9f0bce7238c0)
|
||||
- [ ] [getDerivKernels](https://docs.opencv.org/master/d4/d86/group__imgproc__filter.html#ga6d6c23f7bd3f5836c31cfae994fc4aea)
|
||||
- [ ] [getGaborKernel](https://docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gae84c92d248183bd92fa713ce51cc3599)
|
||||
- [ ] [morphologyExWithParams](https://docs.opencv.org/master/d4/d86/group__imgproc__filter.html#ga67493776e3ad1a3df63883829375201f)
|
||||
- [ ] [pyrMeanShiftFiltering](https://docs.opencv.org/master/d4/d86/group__imgproc__filter.html#ga9fabdce9543bd602445f5db3827e4cc0)
|
||||
|
||||
- [ ] **Geometric Image Transformations - WORK STARTED** The following functions still need implementation:
|
||||
- [ ] [convertMaps](https://docs.opencv.org/master/da/d54/group__imgproc__transform.html#ga9156732fa8f01be9ebd1a194f2728b7f)
|
||||
- [ ] [getDefaultNewCameraMatrix](https://docs.opencv.org/master/da/d54/group__imgproc__transform.html#ga744529385e88ef7bc841cbe04b35bfbf)
|
||||
- [ ] [initUndistortRectifyMap](https://docs.opencv.org/master/da/d54/group__imgproc__transform.html#ga7dfb72c9cf9780a347fbe3d1c47e5d5a)
|
||||
- [ ] [initWideAngleProjMap](https://docs.opencv.org/master/da/d54/group__imgproc__transform.html#gaceb049ec48898d1dadd5b50c604429c8)
|
||||
- [ ] [undistort](https://docs.opencv.org/master/da/d54/group__imgproc__transform.html#ga69f2545a8b62a6b0fc2ee060dc30559d)
|
||||
|
||||
- [ ] **Miscellaneous Image Transformations - WORK STARTED** The following functions still need implementation:
|
||||
- [ ] [cvtColorTwoPlane](https://docs.opencv.org/master/d7/d1b/group__imgproc__misc.html#ga8e873314e72a1a6c0252375538fbf753)
|
||||
- [ ] [floodFill](https://docs.opencv.org/master/d7/d1b/group__imgproc__misc.html#gaf1f55a048f8a45bc3383586e80b1f0d0)
|
||||
|
||||
- [ ] **Drawing Functions - WORK STARTED** The following functions still need implementation:
|
||||
- [ ] [drawMarker](https://docs.opencv.org/master/d6/d6e/group__imgproc__draw.html#ga482fa7b0f578fcdd8a174904592a6250)
|
||||
- [ ] [ellipse2Poly](https://docs.opencv.org/master/d6/d6e/group__imgproc__draw.html#ga727a72a3f6a625a2ae035f957c61051f)
|
||||
- [ ] [fillConvexPoly](https://docs.opencv.org/master/d6/d6e/group__imgproc__draw.html#ga906aae1606ea4ed2f27bec1537f6c5c2)
|
||||
- [ ] [getFontScaleFromHeight](https://docs.opencv.org/master/d6/d6e/group__imgproc__draw.html#ga442ff925c1a957794a1309e0ed3ba2c3)
|
||||
|
||||
- [ ] ColorMaps in OpenCV
|
||||
- [ ] Planar Subdivision
|
||||
- [ ] **Histograms - WORK STARTED** The following functions still need implementation:
|
||||
- [ ] [EMD](https://docs.opencv.org/master/d6/dc7/group__imgproc__hist.html#ga902b8e60cc7075c8947345489221e0e0)
|
||||
- [ ] [wrapperEMD](https://docs.opencv.org/master/d6/dc7/group__imgproc__hist.html#ga31fdda0864e64ca6b9de252a2611758b)
|
||||
|
||||
- [ ] **Structural Analysis and Shape Descriptors - WORK STARTED** The following functions still need implementation:
|
||||
- [ ] [fitEllipse](https://docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#gaf259efaad93098103d6c27b9e4900ffa)
|
||||
- [ ] [fitEllipseAMS](https://docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#ga69e90cda55c4e192a8caa0b99c3e4550)
|
||||
- [ ] [fitEllipseDirect](https://docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#ga6421884fd411923a74891998bbe9e813)
|
||||
- [ ] [HuMoments](https://docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#gab001db45c1f1af6cbdbe64df04c4e944)
|
||||
- [ ] [intersectConvexConvex](https://docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#ga8e840f3f3695613d32c052bec89e782c)
|
||||
- [ ] [isContourConvex](https://docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#ga8abf8010377b58cbc16db6734d92941b)
|
||||
- [ ] [matchShapes](https://docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#gaadc90cb16e2362c9bd6e7363e6e4c317)
|
||||
- [ ] [minEnclosingTriangle](https://docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#ga1513e72f6bbdfc370563664f71e0542f)
|
||||
- [ ] [rotatedRectangleIntersection](https://docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#ga8740e7645628c59d238b0b22c2abe2d4)
|
||||
|
||||
- [ ] **Motion Analysis and Object Tracking - WORK STARTED** The following functions still need implementation:
|
||||
- [ ] [createHanningWindow](https://docs.opencv.org/master/d7/df3/group__imgproc__motion.html#ga80e5c3de52f6bab3a7c1e60e89308e1b)
|
||||
- [ ] [phaseCorrelate](https://docs.opencv.org/master/d7/df3/group__imgproc__motion.html#ga552420a2ace9ef3fb053cd630fdb4952)
|
||||
|
||||
- [ ] **Feature Detection - WORK STARTED** The following functions still need implementation:
|
||||
- [ ] [cornerEigenValsAndVecs](https://docs.opencv.org/master/dd/d1a/group__imgproc__feature.html#ga4055896d9ef77dd3cacf2c5f60e13f1c)
|
||||
- [ ] [cornerHarris](https://docs.opencv.org/master/dd/d1a/group__imgproc__feature.html#gac1fc3598018010880e370e2f709b4345)
|
||||
- [ ] [cornerMinEigenVal](https://docs.opencv.org/master/dd/d1a/group__imgproc__feature.html#ga3dbce297c1feb859ee36707e1003e0a8)
|
||||
- [ ] [createLineSegmentDetector](https://docs.opencv.org/master/dd/d1a/group__imgproc__feature.html#ga6b2ad2353c337c42551b521a73eeae7d)
|
||||
- [ ] [preCornerDetect](https://docs.opencv.org/master/dd/d1a/group__imgproc__feature.html#gaa819f39b5c994871774081803ae22586)
|
||||
|
||||
- [X] **Object Detection**
|
||||
|
||||
- [X] **imgcodecs. Image file reading and writing.**
|
||||
- [X] **videoio. Video I/O**
|
||||
- [X] **highgui. High-level GUI**
|
||||
- [ ] **video. Video Analysis - WORK STARTED**
|
||||
- [X] **Motion Analysis**
|
||||
- [ ] **Object Tracking - WORK STARTED** The following functions still need implementation:
|
||||
- [ ] [buildOpticalFlowPyramid](https://docs.opencv.org/master/dc/d6b/group__video__track.html#ga86640c1c470f87b2660c096d2b22b2ce)
|
||||
- [ ] [estimateRigidTransform](https://docs.opencv.org/master/dc/d6b/group__video__track.html#ga762cbe5efd52cf078950196f3c616d48)
|
||||
- [ ] [findTransformECC](https://docs.opencv.org/master/dc/d6b/group__video__track.html#ga7ded46f9a55c0364c92ccd2019d43e3a)
|
||||
- [ ] [meanShift](https://docs.opencv.org/master/dc/d6b/group__video__track.html#ga7ded46f9a55c0364c92ccd2019d43e3a)
|
||||
- [ ] [CamShift](https://docs.opencv.org/master/dc/d6b/group__video__track.html#gaef2bd39c8356f423124f1fe7c44d54a1)
|
||||
- [ ] [DualTVL1OpticalFlow](https://docs.opencv.org/master/dc/d47/classcv_1_1DualTVL1OpticalFlow.html)
|
||||
- [ ] [FarnebackOpticalFlow](https://docs.opencv.org/master/de/d9e/classcv_1_1FarnebackOpticalFlow.html)
|
||||
- [ ] [KalmanFilter](https://docs.opencv.org/master/dd/d6a/classcv_1_1KalmanFilter.html)
|
||||
- [ ] [SparsePyrLKOpticalFlow](https://docs.opencv.org/master/d7/d08/classcv_1_1SparsePyrLKOpticalFlow.html)
|
||||
- [ ] [GOTURN](https://docs.opencv.org/master/d7/d4c/classcv_1_1TrackerGOTURN.html)
|
||||
|
||||
- [ ] **calib3d. Camera Calibration and 3D Reconstruction - WORK STARTED**. The following functions still need implementation:
|
||||
- [ ] **Camera Calibration - WORK STARTED** The following functions still need implementation:
|
||||
- [X] [calibrateCamera](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [calibrateCameraRO](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [calibrateHandEye](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [calibrationMatrixValues](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [checkChessboard](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [composeRT](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [computeCorrespondEpilines](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [convertPointsFromHomogeneous](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [convertPointsHomogeneous](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [convertPointsToHomogeneous](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [correctMatches](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [decomposeEssentialMat](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [decomposeHomographyMat](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [decomposeProjectionMatrix](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [drawChessboardCorners](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [drawFrameAxes](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [X] [estimateAffine2D](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [estimateAffine3D](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [filterHomographyDecompByVisibleRefpoints](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [filterSpeckles](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [find4QuadCornerSubpix](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [X] [findChessboardCorners](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [X] [findChessboardCornersSB](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [findCirclesGrid](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [findEssentialMat](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [findFundamentalMat](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [getDefaultNewCameraMatrix](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [getOptimalNewCameraMatrix](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [getValidDisparityROI](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [initCameraMatrix2D](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [initUndistortRectifyMap](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [initWideAngleProjMap](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [matMulDeriv](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [projectPoints](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [recoverPose](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [rectify3Collinear](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [reprojectImageTo3D](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [Rodrigues](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [RQDecomp3x3](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [sampsonDistance](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [solveP3P](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [solvePnP](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [solvePnPGeneric](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [solvePnPRansac](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [solvePnPRefineLM](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [solvePnPRefineVVS](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [stereoCalibrate](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [stereoRectify](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [stereoRectifyUncalibrated](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [triangulatePoints](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
- [ ] [validateDisparity](https://docs.opencv.org/master/d9/d0c/group__calib3d.html)
|
||||
|
||||
- [ ] **Fisheye - WORK STARTED** The following functions still need implementation:
|
||||
- [ ] [calibrate](https://docs.opencv.org/master/db/d58/group__calib3d__fisheye.html#gad626a78de2b1dae7489e152a5a5a89e1)
|
||||
- [ ] [distortPoints](https://docs.opencv.org/master/db/d58/group__calib3d__fisheye.html#ga75d8877a98e38d0b29b6892c5f8d7765)
|
||||
- [ ] [projectPoints](https://docs.opencv.org/master/db/d58/group__calib3d__fisheye.html#gab1ad1dc30c42ee1a50ce570019baf2c4)
|
||||
- [ ] [stereoCalibrate](https://docs.opencv.org/master/db/d58/group__calib3d__fisheye.html#gadbb3a6ca6429528ef302c784df47949b)
|
||||
- [ ] [stereoRectify](https://docs.opencv.org/master/db/d58/group__calib3d__fisheye.html#gac1af58774006689056b0f2ef1db55ecc)
|
||||
|
||||
- [ ] **features2d. 2D Features Framework - WORK STARTED**
|
||||
- [X] **Feature Detection and Description**
|
||||
- [X] **Descriptor Matchers**
|
||||
- [X] **Drawing Function of Keypoints and Matches**
|
||||
- [ ] Object Categorization
|
||||
- [ ] [BOWImgDescriptorExtractor](https://docs.opencv.org/master/d2/d6b/classcv_1_1BOWImgDescriptorExtractor.html)
|
||||
- [ ] [BOWKMeansTrainer](https://docs.opencv.org/master/d4/d72/classcv_1_1BOWKMeansTrainer.html)
|
||||
|
||||
- [X] **objdetect. Object Detection**
|
||||
- [X] **dnn. Deep Neural Network module**
|
||||
- [ ] ml. Machine Learning
|
||||
- [ ] flann. Clustering and Search in Multi-Dimensional Spaces
|
||||
- [ ] **photo. Computational Photography - WORK STARTED** The following functions still need implementation:
|
||||
- [ ] [inpaint](https://docs.opencv.org/master/d7/d8b/group__photo__inpaint.html#gaedd30dfa0214fec4c88138b51d678085)
|
||||
- [ ] [denoise_TVL1](https://docs.opencv.org/master/d1/d79/group__photo__denoise.html#ga7602ed5ae17b7de40152b922227c4e4f)
|
||||
- [X] [fastNlMeansDenoising](https://docs.opencv.org/master/d1/d79/group__photo__denoise.html#ga4c6b0031f56ea3f98f768881279ffe93)
|
||||
- [X] [fastNlMeansDenoisingColored](https://docs.opencv.org/master/d1/d79/group__photo__denoise.html#ga03aa4189fc3e31dafd638d90de335617)
|
||||
- [X] [fastNlMeansDenoisingMulti](https://docs.opencv.org/master/d1/d79/group__photo__denoise.html#gaf4421bf068c4d632ea7f0aa38e0bf172)
|
||||
- [ ] [createCalibrateDebevec](https://docs.opencv.org/master/d6/df5/group__photo__hdr.html#ga7fed9707ad5f2cc0e633888867109f90)
|
||||
- [ ] [createCalibrateRobertson](https://docs.opencv.org/master/d6/df5/group__photo__hdr.html#gae77813a21cd351a596619e5ff013be5d)
|
||||
- [ ] [createMergeDebevec](https://docs.opencv.org/master/d6/df5/group__photo__hdr.html#gaa8eab36bc764abb2a225db7c945f87f9)
|
||||
- [ ] [createMergeRobertson](https://docs.opencv.org/master/d6/df5/group__photo__hdr.html#ga460d4a1df1a7e8cdcf7445bb87a8fb78)
|
||||
- [ ] [createTonemap](https://docs.opencv.org/master/d6/df5/group__photo__hdr.html#gabcbd653140b93a1fa87ccce94548cd0d)
|
||||
- [ ] [createTonemapDrago](https://docs.opencv.org/master/d6/df5/group__photo__hdr.html#ga72bf92bb6b8653ee4be650ac01cf50b6)
|
||||
- [ ] [createTonemapMantiuk](https://docs.opencv.org/master/d6/df5/group__photo__hdr.html#ga3b3f3bf083b7515802f039a6a70f2d21)
|
||||
- [ ] [createTonemapReinhard](https://docs.opencv.org/master/d6/df5/group__photo__hdr.html#gadabe7f6bf1fa96ad0fd644df9182c2fb)
|
||||
- [ ] [decolor](https://docs.opencv.org/master/d4/d32/group__photo__decolor.html#ga4864d4c007bda5dacdc5e9d4ed7e222c)
|
||||
- [X] [detailEnhance](https://docs.opencv.org/master/df/dac/group__photo__render.html#ga0de660cb6f371a464a74c7b651415975)
|
||||
- [X] [edgePreservingFilter](https://docs.opencv.org/master/df/dac/group__photo__render.html#gafaee2977597029bc8e35da6e67bd31f7)
|
||||
- [X] [pencilSketch](https://docs.opencv.org/master/df/dac/group__photo__render.html#gae5930dd822c713b36f8529b21ddebd0c)
|
||||
- [X] [stylization](https://docs.opencv.org/master/df/dac/group__photo__render.html#gacb0f7324017df153d7b5d095aed53206)
|
||||
|
||||
- [ ] stitching. Images stitching
|
||||
|
||||
## CUDA
|
||||
|
||||
- [ ] **core. - WORK STARTED** The following functions still need implementation:
|
||||
- [ ] [cv::cuda::convertFp16](https://docs.opencv.org/master/d8/d40/group__cudacore__init.html#gaa1c52258763197958eb9e6681917f723)
|
||||
- [ ] [cv::cuda::deviceSupports](https://docs.opencv.org/master/d8/d40/group__cudacore__init.html#ga170b10cc9af4aa8cce8c0afdb4b1d08c)
|
||||
- [X] [cv::cuda::getDevice](https://docs.opencv.org/master/d8/d40/group__cudacore__init.html#ga6ded4ed8e4fc483a9863d31f34ec9c0e)
|
||||
- [X] [cv::cuda::resetDevice](https://docs.opencv.org/master/d8/d40/group__cudacore__init.html#ga6153b6f461101374e655a54fc77e725e)
|
||||
- [X] [cv::cuda::setDevice](https://docs.opencv.org/master/d8/d40/group__cudacore__init.html#gaefa34186b185de47851836dba537828b)
|
||||
|
||||
- [ ] **cudaarithm. Operations on Matrices - WORK STARTED** The following functions still need implementation:
|
||||
- [ ] **core** The following functions still need implementation:
|
||||
- [ ] [cv::cuda::copyMakeBorder](https://docs.opencv.org/master/de/d09/group__cudaarithm__core.html#ga5368db7656eacf846b40089c98053a49)
|
||||
- [ ] [cv::cuda::createLookUpTable](https://docs.opencv.org/master/de/d09/group__cudaarithm__core.html#ga2d9d9780dea8c5cd85d3c19b7e01979c)
|
||||
- [ ] [cv::cuda::merge](https://docs.opencv.org/master/de/d09/group__cudaarithm__core.html#gaac939dc3b178ee92fb6e7078f342622c)
|
||||
- [ ] [cv::cuda::split](https://docs.opencv.org/master/de/d09/group__cudaarithm__core.html#gabe5013d55d4ff586b20393913726179e)
|
||||
- [ ] [cv::cuda::transpose](https://docs.opencv.org/master/de/d09/group__cudaarithm__core.html#ga327b71c3cb811a904ccf5fba37fc29f2)
|
||||
|
||||
- [ ] **per-element operations - WORK STARTED** The following functions still need implementation:
|
||||
- [X] [cv::cuda::absdiff](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#gac062b283cf46ee90f74a773d3382ab54)
|
||||
- [X] [cv::cuda::add](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga5d9794bde97ed23d1c1485249074a8b1)
|
||||
- [ ] [cv::cuda::addWeighted](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga2cd14a684ea70c6ab2a63ee90ffe6201)
|
||||
- [X] [cv::cuda::bitwise_and](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga78d7c1a013877abd4237fbfc4e13bd76)
|
||||
- [X] [cv::cuda::bitwise_not](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#gae58159a2259ae1acc76b531c171cf06a)
|
||||
- [X] [cv::cuda::bitwise_or](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#gafd098ee3e51c68daa793999c1da3dfb7)
|
||||
- [X] [cv::cuda::bitwise_xor](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga3d95d4faafb099aacf18e8b915a4ad8d)
|
||||
- [ ] [cv::cuda::cartToPolar](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga82210c7d1c1d42e616e554bf75a53480)
|
||||
- [ ] [cv::cuda::compare](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga4d41cd679f4a83862a3de71a6057db54)
|
||||
- [X] [cv::cuda::divide](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga124315aa226260841e25cc0b9ea99dc3)
|
||||
- [X] [cv::cuda::exp](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#gac6e51541d3bb0a7a396128e4d5919b61)
|
||||
- [ ] [cv::cuda::inRange](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#gaf611ab6b1d85e951feb6f485b1ed9672)
|
||||
- [X] [cv::cuda::log](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#gaae9c60739e2d1a977b4d3250a0be42ca)
|
||||
- [ ] [cv::cuda::lshift](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#gafd072accecb14c9adccdad45e3bf2300)
|
||||
- [ ] [cv::cuda::magnitude](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga3d17f4fcd79d7c01fadd217969009463)
|
||||
- [ ] [cv::cuda::magnitudeSqr](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga7613e382d257e150033d0ce4d6098f6a)
|
||||
- [X] [cv::cuda::max](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#gadb5dd3d870f10c0866035755b929b1e7)
|
||||
- [X] [cv::cuda::min](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga74f0b05a65b3d949c237abb5e6c60867)
|
||||
- [X] [cv::cuda::multiply](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga497cc0615bf717e1e615143b56f00591)
|
||||
- [ ] [cv::cuda::phase](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga5b75ec01be06dcd6e27ada09a0d4656a)
|
||||
- [ ] [cv::cuda::polarToCart](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga01516a286a329c303c2db746513dd9df)
|
||||
- [ ] [cv::cuda::pow](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga82d04ef4bcc4dfa9bfbe76488007c6c4)
|
||||
- [ ] [cv::cuda::rshift](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga87af0b66358cc302676f35c1fd56c2ed)
|
||||
- [X] [cv::cuda::sqr](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga8aae233da90ce0ffe309ab8004342acb)
|
||||
- [X] [cv::cuda::sqrt](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga09303680cb1a5521a922b6d392028d8c)
|
||||
- [X] [cv::cuda::subtract](https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga6eab60fc250059e2fda79c5636bd067f)
|
||||
|
||||
- [ ] **matrix reductions** The following functions still need implementation:
|
||||
- [ ] [cv::cuda::absSum](https://docs.opencv.org/master/d5/de6/group__cudaarithm__reduce.html#ga690fa79ba4426c53f7d2bebf3d37a32a)
|
||||
- [ ] [cv::cuda::calcAbsSum](https://docs.opencv.org/master/d5/de6/group__cudaarithm__reduce.html#ga15c403b76ab2c4d7ed0f5edc09891b7e)
|
||||
- [ ] [cv::cuda::calcNorm](https://docs.opencv.org/master/d5/de6/group__cudaarithm__reduce.html#ga39d2826990d29b7e4b69dbe02bdae2e1)
|
||||
- [ ] [cv::cuda::calcNormDiff](https://docs.opencv.org/master/d5/de6/group__cudaarithm__reduce.html#ga9be3d9a7b6c5760955f37d1039d01265)
|
||||
- [ ] [cv::cuda::calcSqrSum](https://docs.opencv.org/master/d5/de6/group__cudaarithm__reduce.html#gac998c83597f6c206c78cee16aa87946f)
|
||||
- [ ] [cv::cuda::calcSum](https://docs.opencv.org/master/d5/de6/group__cudaarithm__reduce.html#ga98a09144047f09f5cb1d6b6ea8e0856f)
|
||||
- [ ] [cv::cuda::countNonZero](https://docs.opencv.org/master/d5/de6/group__cudaarithm__reduce.html#ga98a09144047f09f5cb1d6b6ea8e0856f)
|
||||
- [ ] [cv::cuda::findMinMax](https://docs.opencv.org/master/d5/de6/group__cudaarithm__reduce.html#gae7f5f2aa9f65314470a76fccdff887f2)
|
||||
- [ ] [cv::cuda::findMinMaxLoc](https://docs.opencv.org/master/d5/de6/group__cudaarithm__reduce.html#ga93916bc473a62d215d1130fab84d090a)
|
||||
- [ ] [cv::cuda::integral](https://docs.opencv.org/master/d5/de6/group__cudaarithm__reduce.html#ga07e5104eba4bf45212ac9dbc5bf72ba6)
|
||||
- [ ] [cv::cuda::meanStdDev](https://docs.opencv.org/master/d5/de6/group__cudaarithm__reduce.html#ga990a4db4c6d7e8f0f3a6685ba48fbddc)
|
||||
- [ ] [cv::cuda::minMax](https://docs.opencv.org/master/d5/de6/group__cudaarithm__reduce.html#ga8d7de68c10717cf25e787e3c20d2dfee)
|
||||
- [ ] [cv::cuda::minMaxLoc](https://docs.opencv.org/master/d5/de6/group__cudaarithm__reduce.html#ga5cacbc2a2323c4eaa81e7390c5d9f530)
|
||||
- [ ] [cv::cuda::norm](https://docs.opencv.org/master/d5/de6/group__cudaarithm__reduce.html#ga6c01988a58d92126a7c60a4ab76d8324)
|
||||
- [ ] [cv::cuda::normalize](https://docs.opencv.org/master/d5/de6/group__cudaarithm__reduce.html#ga4da4738b9956a5baaa2f5f8c2fba438a)
|
||||
- [ ] [cv::cuda::rectStdDev](https://docs.opencv.org/master/d5/de6/group__cudaarithm__reduce.html#gac311484a4e57cab2ce2cfdc195fda7ee)
|
||||
- [ ] [cv::cuda::reduce](https://docs.opencv.org/master/d5/de6/group__cudaarithm__reduce.html#ga21d57f661db7be093caf2c4378be2007)
|
||||
- [ ] [cv::cuda::sqrIntegral](https://docs.opencv.org/master/d5/de6/group__cudaarithm__reduce.html#ga40c75196202706399a60bf6ba7a052ac)
|
||||
- [ ] [cv::cuda::sqlSum](https://docs.opencv.org/master/d5/de6/group__cudaarithm__reduce.html#ga056c804ebf5d2eb9f6f35e3dcb01524c)
|
||||
- [ ] [cv::cuda::sum](https://docs.opencv.org/master/d5/de6/group__cudaarithm__reduce.html#ga1f582844670199281e8012733b50c582)
|
||||
|
||||
- [ ] **Operations on matrices** The following functions still need implementation:
|
||||
- [ ] [cv::cuda::createConvolution](https://docs.opencv.org/4.5.0/d9/d88/group__cudaarithm__arithm.html#ga2695e05ef624bf3ce03cfbda383a821d)
|
||||
- [ ] [cv::cuda::createDFT](https://docs.opencv.org/4.5.0/d9/d88/group__cudaarithm__arithm.html#ga0f72d063b73c8bb995678525eb076f10)
|
||||
- [ ] [cv::cuda::dft](https://docs.opencv.org/4.5.0/d9/d88/group__cudaarithm__arithm.html#gadea99cb15a715c983bcc2870d65a2e78)
|
||||
- [ ] [cv::cuda::gemm](https://docs.opencv.org/4.5.0/d9/d88/group__cudaarithm__arithm.html#ga42efe211d7a43bbc922da044c4f17130)
|
||||
- [ ] [cv::cuda::mulAndScaleSpectrums](https://docs.opencv.org/4.5.0/d9/d88/group__cudaarithm__arithm.html#ga5704c25b8be4f19da812e6d98c8ee464)
|
||||
- [ ] [cv::cuda::mulSpectrums](https://docs.opencv.org/4.5.0/d9/d88/group__cudaarithm__arithm.html#gab3e8900d67c4f59bdc137a0495206cd8)
|
||||
|
||||
- [X] **cudabgsegm. Background Segmentation**
|
||||
|
||||
- [ ] **cudacodec** Video Encoding/Decoding. The following functions still need implementation:
|
||||
- [ ] [cv::cuda::VideoReader](https://docs.opencv.org/master/db/ded/classcv_1_1cudacodec_1_1VideoReader.html)
|
||||
- [ ] [cv::cuda::VideoWriter](https://docs.opencv.org/master/df/dde/classcv_1_1cudacodec_1_1VideoWriter.html)
|
||||
|
||||
- [ ] **cudafeatures2d** Feature Detection and Description. The following functions still need implementation:
|
||||
- [ ] [cv::cuda::FastFeatureDetector](https://docs.opencv.org/master/d4/d6a/classcv_1_1cuda_1_1FastFeatureDetector.html)
|
||||
- [ ] [cv::cuda::ORB](https://docs.opencv.org/master/da/d44/classcv_1_1cuda_1_1ORB.html)
|
||||
|
||||
- [ ] **cudafilters. Image Filtering - WORK STARTED** The following functions still need implementation:
|
||||
- [ ] [cv::cuda::createBoxFilter](https://docs.opencv.org/master/dc/d66/group__cudafilters.html#ga3113b66e289bad7caef412e6e13ec2be)
|
||||
- [ ] [cv::cuda::createBoxMaxFilter](https://docs.opencv.org/master/dc/d66/group__cudafilters.html#gaaf4740c51128d23a37f6f1b22cee49e8)
|
||||
- [ ] [cv::cuda::createBoxMinFilter](https://docs.opencv.org/master/dc/d66/group__cudafilters.html#ga77fd36949bc8d92aabc120b4b1cfaafa)
|
||||
- [ ] [cv::cuda::createColumnSumFilter](https://docs.opencv.org/master/dc/d66/group__cudafilters.html#gac13bf7c41a34bfde2a7f33ad8caacfdf)
|
||||
- [ ] [cv::cuda::createDerivFilter](https://docs.opencv.org/master/dc/d66/group__cudafilters.html#ga14d76dc6982ce739c67198f52bc16ee1)
|
||||
- [ ] [cv::cuda::createLaplacianFilter](https://docs.opencv.org/master/dc/d66/group__cudafilters.html#ga53126e88bb7e6185dcd5628e28e42cd2)
|
||||
- [ ] [cv::cuda::createLinearFilter](https://docs.opencv.org/master/dc/d66/group__cudafilters.html#ga57cb1804ad9d1280bf86433858daabf9)
|
||||
- [ ] [cv::cuda::createMorphologyFilter](https://docs.opencv.org/master/dc/d66/group__cudafilters.html#gae58694e07be6bdbae126f36c75c08ee6)
|
||||
- [ ] [cv::cuda::createRowSumFilter](https://docs.opencv.org/master/dc/d66/group__cudafilters.html#gaf735de273ccb5072f3c27816fb97a53a)
|
||||
- [ ] [cv::cuda::createScharrFilter](https://docs.opencv.org/master/dc/d66/group__cudafilters.html#ga4ac8df158e5771ddb0bd5c9091188ce6)
|
||||
- [ ] [cv::cuda::createSeparableLinearFilter](https://docs.opencv.org/master/dc/d66/group__cudafilters.html#gaf7b79a9a92992044f328dad07a52c4bf)
|
||||
|
||||
- [ ] **cudaimgproc. Image Processing - WORK STARTED** The following functions still need implementation:
|
||||
- [ ] [cv::cuda::TemplateMatching](https://docs.opencv.org/master/d2/d58/classcv_1_1cuda_1_1TemplateMatching.html)
|
||||
- [ ] [cv::cuda::alphaComp](https://docs.opencv.org/master/db/d8c/group__cudaimgproc__color.html#ga08a698700458d9311390997b57fbf8dc)
|
||||
- [ ] [cv::cuda::demosaicing](https://docs.opencv.org/master/db/d8c/group__cudaimgproc__color.html#ga7fb153572b573ebd2d7610fcbe64166e)
|
||||
- [ ] [cv::cuda::gammaCorrection](https://docs.opencv.org/master/db/d8c/group__cudaimgproc__color.html#gaf4195a8409c3b8fbfa37295c2b2c4729)
|
||||
- [ ] [cv::cuda::swapChannels](https://docs.opencv.org/master/db/d8c/group__cudaimgproc__color.html#ga75a29cc4a97cde0d43ea066b01de927e)
|
||||
- [ ] [cv::cuda::calcHist](https://docs.opencv.org/master/d8/d0e/group__cudaimgproc__hist.html#gaaf3944106890947020bb4522a7619c26)
|
||||
- [ ] [cv::cuda::CLAHE](https://docs.opencv.org/master/db/d79/classcv_1_1cuda_1_1CLAHE.html)
|
||||
- [ ] [cv::cuda::equalizeHist](https://docs.opencv.org/master/d8/d0e/group__cudaimgproc__hist.html#ga2384be74bd2feba7e6c46815513f0060)
|
||||
- [ ] [cv::cuda::evenLevels](https://docs.opencv.org/master/d8/d0e/group__cudaimgproc__hist.html#ga2f2cbd21dc6d7367a7c4ee1a826f389d)
|
||||
- [ ] [cv::cuda::histEven](https://docs.opencv.org/master/d8/d0e/group__cudaimgproc__hist.html#gacd3b14279fb77a57a510cb8c89a1856f)
|
||||
- [ ] [cv::cuda::histRange](https://docs.opencv.org/master/d8/d0e/group__cudaimgproc__hist.html#ga87819085c1059186d9cdeacd92cea783)
|
||||
- [ ] [cv::cuda::HoughCirclesDetector](https://docs.opencv.org/master/da/d80/classcv_1_1cuda_1_1HoughCirclesDetector.html)
|
||||
- [ ] [cv::cuda::createGoodFeaturesToTrackDetector](https://docs.opencv.org/master/dc/d6d/group__cudaimgproc__feature.html#ga478b474a598ece101f7e706fee2c8e91)
|
||||
- [ ] [cv::cuda::createHarrisCorner](https://docs.opencv.org/master/dc/d6d/group__cudaimgproc__feature.html#ga3e5878a803e9bba51added0c10101979)
|
||||
- [ ] [cv::cuda::createMinEigenValCorner](https://docs.opencv.org/master/dc/d6d/group__cudaimgproc__feature.html#ga7457fd4b53b025f990b1c1dd1b749915)
|
||||
- [ ] [cv::cuda::bilateralFilter](https://docs.opencv.org/master/d0/d05/group__cudaimgproc.html#ga6abeaecdd4e7edc0bd1393a04f4f20bd)
|
||||
- [ ] [cv::cuda::blendLinear](https://docs.opencv.org/master/d0/d05/group__cudaimgproc.html#ga4793607e5729bcc15b27ea33d9fe335e)
|
||||
- [ ] [cv::cuda::meanShiftFiltering](https://docs.opencv.org/master/d0/d05/group__cudaimgproc.html#gae13b3035bc6df0e512d876dbb8c00555)
|
||||
- [ ] [cv::cuda::meanShiftProc](https://docs.opencv.org/master/d0/d05/group__cudaimgproc.html#ga6039dc8ecbe2f912bc83fcc9b3bcca39)
|
||||
- [ ] [cv::cuda::meanShiftSegmentation](https://docs.opencv.org/master/d0/d05/group__cudaimgproc.html#ga70ed80533a448829dc48cf22b1845c16)
|
||||
|
||||
- [X] **cudaobjdetect. Object Detection**
|
||||
|
||||
- [ ] **cudaoptflow. Optical Flow - WORK STARTED** The following functions still need implementation:
|
||||
- [ ] [BroxOpticalFlow](https://docs.opencv.org/master/d7/d18/classcv_1_1cuda_1_1BroxOpticalFlow.html)
|
||||
- [ ] [DenseOpticalFlow](https://docs.opencv.org/master/d6/d4a/classcv_1_1cuda_1_1DenseOpticalFlow.html)
|
||||
- [ ] [DensePyrLKOpticalFlow](https://docs.opencv.org/master/d0/da4/classcv_1_1cuda_1_1DensePyrLKOpticalFlow.html)
|
||||
- [ ] [FarnebackOpticalFlow](https://docs.opencv.org/master/d9/d30/classcv_1_1cuda_1_1FarnebackOpticalFlow.html)
|
||||
- [ ] [NvidiaHWOpticalFlow](https://docs.opencv.org/master/d5/d26/classcv_1_1cuda_1_1NvidiaHWOpticalFlow.html)
|
||||
- [ ] [NvidiaOpticalFlow_1_0](https://docs.opencv.org/master/dc/d9d/classcv_1_1cuda_1_1NvidiaOpticalFlow__1__0.html)
|
||||
- [ ] [SparseOpticalFlow](https://docs.opencv.org/master/d5/dcf/classcv_1_1cuda_1_1SparseOpticalFlow.html)
|
||||
- [ ] **[SparsePyrLKOpticalFlow](https://docs.opencv.org/master/d7/d05/classcv_1_1cuda_1_1SparsePyrLKOpticalFlow.html) - WORK STARTED**
|
||||
|
||||
- [ ] **cudastereo** Stereo Correspondence
|
||||
- [ ] [cv::cuda::createDisparityBilateralFilter](https://docs.opencv.org/master/dd/d47/group__cudastereo.html#gaafb5f9902f7a9e74cb2cd4e680569590)
|
||||
- [ ] [cv::cuda::createStereoBeliefPropagation](https://docs.opencv.org/master/dd/d47/group__cudastereo.html#ga8d22dd80bdfb4e3d7d2ac09e8a07c22b)
|
||||
- [ ] [cv::cuda::createStereoBM](https://docs.opencv.org/master/dd/d47/group__cudastereo.html#ga77edc901350dd0a7f46ec5aca4138039)
|
||||
- [ ] [cv::cuda::createStereoConstantSpaceBP](https://docs.opencv.org/master/dd/d47/group__cudastereo.html#gaec3b49c7cf9f7701a6f549a227be4df2)
|
||||
- [ ] [cv::cuda::createStereoSGM](https://docs.opencv.org/master/dd/d47/group__cudastereo.html#gafb7e5284de5f488d664c3155acb12c93)
|
||||
- [ ] [cv::cuda::drawColorDisp](https://docs.opencv.org/master/dd/d47/group__cudastereo.html#ga469b23a77938dd7c06861e59cecc08c5)
|
||||
- [ ] [cv::cuda::reprojectImageTo3D](https://docs.opencv.org/master/dd/d47/group__cudastereo.html#gaff851e3932da0f3e74d1be1d8855f094)
|
||||
|
||||
- [X] **cudawarping. Image Warping**
|
||||
|
||||
## Contrib modules list
|
||||
|
||||
- [ ] alphamat. Alpha Matting
|
||||
- [X] **aruco. ArUco Marker Detection - WORK STARTED**
|
||||
- [ ] barcode. Barcode detecting and decoding methods
|
||||
- [X] **bgsegm. Improved Background-Foreground Segmentation Methods - WORK STARTED**
|
||||
- [ ] bioinspired. Biologically inspired vision models and derivated tools
|
||||
- [ ] ccalib. Custom Calibration Pattern for 3D reconstruction
|
||||
- [ ] cnn_3dobj. 3D object recognition and pose estimation API
|
||||
- [ ] cvv. GUI for Interactive Visual Debugging of Computer Vision Programs
|
||||
- [ ] datasets. Framework for working with different datasets
|
||||
- [ ] dnn_modern. Deep Learning Modern Module
|
||||
- [ ] dnn_objdetect. DNN used for object detection
|
||||
- [ ] dnn_superres. DNN used for super resolution
|
||||
- [ ] dpm. Deformable Part-based Models
|
||||
- [ ] **face. Face Recognition - WORK STARTED**
|
||||
- [ ] freetype. Drawing UTF-8 strings with freetype/harfbuzz
|
||||
- [ ] fuzzy. Image processing based on fuzzy mathematics
|
||||
- [ ] hdf. Hierarchical Data Format I/O routines
|
||||
- [ ] hfs. Hierarchical Feature Selection for Efficient Image Segmentation
|
||||
- [X] **img_hash. The module brings implementations of different image hashing algorithms.**
|
||||
- [ ] intensity_transform. The module brings implementations of intensity transformation algorithms to adjust image contrast.
|
||||
- [ ] line_descriptor. Binary descriptors for lines extracted from an image
|
||||
- [ ] mcc. Macbeth Chart module
|
||||
- [ ] optflow. Optical Flow Algorithms
|
||||
- [ ] ovis. OGRE 3D Visualiser
|
||||
- [ ] phase_unwrapping. Phase Unwrapping API
|
||||
- [ ] plot. Plot function for Mat data
|
||||
- [ ] quality. Image Quality Analysis (IQA) API
|
||||
- [ ] rapid. silhouette based 3D object tracking
|
||||
- [ ] reg. Image Registration
|
||||
- [ ] rgbd. RGB-Depth Processing
|
||||
- [ ] saliency. Saliency API
|
||||
- [ ] sfm. Structure From Motion
|
||||
- [ ] shape. Shape Distance and Matching
|
||||
- [ ] stereo. Stereo Correspondance Algorithms
|
||||
- [ ] structured_light. Structured Light API
|
||||
- [ ] superres. Super Resolution
|
||||
- [ ] surface_matching. Surface Matching
|
||||
- [ ] text. Scene Text Detection and Recognition
|
||||
- [ ] **tracking. Tracking API - WORK STARTED**
|
||||
- [ ] videostab. Video Stabilization
|
||||
- [ ] viz. 3D Visualizer
|
||||
- [X] **wechat_qrcode. WeChat QR code detector for detecting and parsing QR code**
|
||||
- [ ] **xfeatures2d. Extra 2D Features Framework - WORK STARTED**
|
||||
- [ ] **ximgproc. Extended Image Processing - WORK STARTED**
|
||||
- [ ] xobjdetect. Extended object detection
|
||||
- [X] **xphoto. Additional photo processing algorithms**
|
36
vendor/gocv.io/x/gocv/appveyor.yml
generated
vendored
36
vendor/gocv.io/x/gocv/appveyor.yml
generated
vendored
@ -1,36 +0,0 @@
|
||||
version: "{build}"
|
||||
|
||||
clone_folder: c:\gopath\src\gocv.io\x\gocv
|
||||
|
||||
platform:
|
||||
- MinGW_x64
|
||||
|
||||
environment:
|
||||
GOPATH: c:\gopath
|
||||
GOROOT: c:\go
|
||||
GOVERSION: 1.16
|
||||
TEST_EXTERNAL: 1
|
||||
APPVEYOR_SAVE_CACHE_ON_ERROR: true
|
||||
|
||||
cache:
|
||||
- C:\opencv -> appveyor_build_opencv.cmd
|
||||
|
||||
install:
|
||||
- if not exist "C:\opencv" appveyor_build_opencv.cmd
|
||||
- set PATH=C:\Perl\site\bin;C:\Perl\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\7-Zip;C:\Program Files\Microsoft\Web Platform Installer\;C:\Tools\PsTools;C:\Program Files (x86)\CMake\bin;C:\go\bin;C:\Tools\NuGet;C:\Program Files\LLVM\bin;C:\Tools\curl\bin;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\Yarn\bin;C:\Users\appveyor\AppData\Local\Yarn\bin;C:\Program Files\AppVeyor\BuildAgent\
|
||||
- set PATH=%PATH%;C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin
|
||||
- set PATH=%PATH%;C:\Tools\GitVersion;C:\Program Files\Git LFS;C:\Program Files\Git\cmd;C:\Program Files\Git\usr\bin;C:\opencv\build\install\x64\mingw\bin;
|
||||
- echo %PATH%
|
||||
- echo %GOPATH%
|
||||
- go version
|
||||
- cd c:\gopath\src\gocv.io\x\gocv
|
||||
- go get -d .
|
||||
- set GOCV_CAFFE_TEST_FILES=C:\opencv\testdata
|
||||
- set GOCV_TENSORFLOW_TEST_FILES=C:\opencv\testdata
|
||||
- set GOCV_ONNX_TEST_FILES=C:\opencv\testdata
|
||||
- set OPENCV_ENABLE_NONFREE=ON
|
||||
- go env
|
||||
|
||||
build_script:
|
||||
- go test -tags matprofile -v .
|
||||
- go test -tags matprofile -v ./contrib
|
29
vendor/gocv.io/x/gocv/appveyor_build_opencv.cmd
generated
vendored
29
vendor/gocv.io/x/gocv/appveyor_build_opencv.cmd
generated
vendored
@ -1,29 +0,0 @@
|
||||
|
||||
if not exist "C:\opencv" mkdir "C:\opencv"
|
||||
if not exist "C:\opencv\build" mkdir "C:\opencv\build"
|
||||
if not exist "C:\opencv\testdata" mkdir "C:\opencv\testdata"
|
||||
|
||||
appveyor DownloadFile https://github.com/opencv/opencv/archive/4.6.0.zip -FileName c:\opencv\opencv-4.6.0.zip
|
||||
7z x c:\opencv\opencv-4.6.0.zip -oc:\opencv -y
|
||||
del c:\opencv\opencv-4.6.0.zip /q
|
||||
appveyor DownloadFile https://github.com/opencv/opencv_contrib/archive/4.6.0.zip -FileName c:\opencv\opencv_contrib-4.6.0.zip
|
||||
7z x c:\opencv\opencv_contrib-4.6.0.zip -oc:\opencv -y
|
||||
del c:\opencv\opencv_contrib-4.6.0.zip /q
|
||||
cd C:\opencv\build
|
||||
set PATH=C:\Perl\site\bin;C:\Perl\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\7-Zip;C:\Program Files\Microsoft\Web Platform Installer\;C:\Tools\PsTools;C:\Program Files (x86)\CMake\bin;C:\go\bin;C:\Tools\NuGet;C:\Program Files\LLVM\bin;C:\Tools\curl\bin;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\Yarn\bin;C:\Users\appveyor\AppData\Local\Yarn\bin;C:\Program Files\AppVeyor\BuildAgent\
|
||||
set PATH=%PATH%;C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin
|
||||
dir C:\opencv
|
||||
cmake C:\opencv\opencv-4.6.0 -G "MinGW Makefiles" -BC:\opencv\build -DENABLE_CXX11=ON -DOPENCV_EXTRA_MODULES_PATH=C:\opencv\opencv_contrib-4.6.0\modules -DBUILD_SHARED_LIBS=ON -DWITH_IPP=OFF -DWITH_MSMF=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_opencv_java=OFF -DBUILD_opencv_python=OFF -DBUILD_opencv_python2=OFF -DBUILD_opencv_python3=OFF -DBUILD_DOCS=OFF -DENABLE_PRECOMPILED_HEADERS=OFF -DBUILD_opencv_saliency=OFF -DBUILD_opencv_wechat_qrcode=ON -DCPU_DISPATCH= -DBUILD_opencv_gapi=OFF -DOPENCV_GENERATE_PKGCONFIG=ON -DOPENCV_ENABLE_NONFREE=ON -DWITH_OPENCL_D3D11_NV=OFF -DOPENCV_ALLOCATOR_STATS_COUNTER_TYPE=int64_t -DWITH_TBB=ON -Wno-dev
|
||||
mingw32-make -j%NUMBER_OF_PROCESSORS%
|
||||
mingw32-make install
|
||||
appveyor DownloadFile https://raw.githubusercontent.com/opencv/opencv_extra/master/testdata/dnn/bvlc_googlenet.prototxt -FileName C:\opencv\testdata\bvlc_googlenet.prototxt
|
||||
appveyor DownloadFile https://raw.githubusercontent.com/WeChatCV/opencv_3rdparty/wechat_qrcode/detect.caffemodel -FileName C:\opencv\testdata\detect.caffemodel
|
||||
appveyor DownloadFile https://raw.githubusercontent.com/WeChatCV/opencv_3rdparty/wechat_qrcode/detect.prototxt -FileName C:\opencv\testdata\detect.prototxt
|
||||
appveyor DownloadFile https://raw.githubusercontent.com/WeChatCV/opencv_3rdparty/wechat_qrcode/sr.caffemodel -FileName C:\opencv\testdata\sr.caffemodel
|
||||
appveyor DownloadFile https://raw.githubusercontent.com/WeChatCV/opencv_3rdparty/wechat_qrcode/sr.prototxt -FileName C:\opencv\testdata\sr.prototxt
|
||||
appveyor DownloadFile http://dl.caffe.berkeleyvision.org/bvlc_googlenet.caffemodel -FileName C:\opencv\testdata\bvlc_googlenet.caffemodel
|
||||
appveyor DownloadFile https://storage.googleapis.com/download.tensorflow.org/models/inception5h.zip -FileName C:\opencv\testdata\inception5h.zip
|
||||
appveyor DownloadFile https://github.com/onnx/models/raw/main/vision/classification/inception_and_googlenet/googlenet/model/googlenet-9.onnx -FileName C:\opencv\testdata\googlenet-9.onnx
|
||||
7z x C:\opencv\testdata\inception5h.zip -oC:\opencv\testdata tensorflow_inception_graph.pb -y
|
||||
rmdir c:\opencv\opencv-4.6.0 /s /q
|
||||
rmdir c:\opencv\opencv_contrib-4.6.0 /s /q
|
28
vendor/gocv.io/x/gocv/asyncarray.cpp
generated
vendored
28
vendor/gocv.io/x/gocv/asyncarray.cpp
generated
vendored
@ -1,28 +0,0 @@
|
||||
// +build openvino
|
||||
|
||||
#include <string.h>
|
||||
#include "asyncarray.h"
|
||||
|
||||
|
||||
// AsyncArray_New creates a new empty AsyncArray
|
||||
AsyncArray AsyncArray_New() {
|
||||
return new cv::AsyncArray();
|
||||
}
|
||||
|
||||
// AsyncArray_Close deletes an existing AsyncArray
|
||||
void AsyncArray_Close(AsyncArray a) {
|
||||
delete a;
|
||||
}
|
||||
|
||||
const char* AsyncArray_GetAsync(AsyncArray async_out,Mat out) {
|
||||
try {
|
||||
async_out->get(*out);
|
||||
} catch(cv::Exception ex) {
|
||||
return ex.err.c_str();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
AsyncArray Net_forwardAsync(Net net, const char* outputName) {
|
||||
return new cv::AsyncArray(net->forwardAsync(outputName));
|
||||
}
|
52
vendor/gocv.io/x/gocv/asyncarray.go
generated
vendored
52
vendor/gocv.io/x/gocv/asyncarray.go
generated
vendored
@ -1,52 +0,0 @@
|
||||
// +build openvino
|
||||
|
||||
package gocv
|
||||
|
||||
import (
|
||||
"errors"
|
||||
)
|
||||
|
||||
/*
|
||||
#include <stdlib.h>
|
||||
#include "dnn.h"
|
||||
#include "asyncarray.h"
|
||||
#include "core.h"
|
||||
*/
|
||||
import "C"
|
||||
|
||||
type AsyncArray struct {
|
||||
p C.AsyncArray
|
||||
}
|
||||
|
||||
// NewAsyncArray returns a new empty AsyncArray.
|
||||
func NewAsyncArray() AsyncArray {
|
||||
return newAsyncArray(C.AsyncArray_New())
|
||||
}
|
||||
|
||||
// Ptr returns the AsyncArray's underlying object pointer.
|
||||
func (a *AsyncArray) Ptr() C.AsyncArray {
|
||||
return a.p
|
||||
}
|
||||
|
||||
// Get async returns the Mat
|
||||
func (m *AsyncArray) Get(mat *Mat) error {
|
||||
result := C.AsyncArray_GetAsync(m.p, mat.p)
|
||||
err := C.GoString(result)
|
||||
|
||||
if len(err) > 0 {
|
||||
return errors.New(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// newAsyncArray returns a new AsyncArray from a C AsyncArray
|
||||
func newAsyncArray(p C.AsyncArray) AsyncArray {
|
||||
return AsyncArray{p: p}
|
||||
}
|
||||
|
||||
// Close the AsyncArray object.
|
||||
func (a *AsyncArray) Close() error {
|
||||
C.AsyncArray_Close(a.p)
|
||||
a.p = nil
|
||||
return nil
|
||||
}
|
23
vendor/gocv.io/x/gocv/asyncarray.h
generated
vendored
23
vendor/gocv.io/x/gocv/asyncarray.h
generated
vendored
@ -1,23 +0,0 @@
|
||||
#ifdef __cplusplus
|
||||
#include <opencv2/opencv.hpp>
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "core.h"
|
||||
#include "dnn.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
typedef cv::AsyncArray* AsyncArray;
|
||||
#else
|
||||
typedef void* AsyncArray;
|
||||
#endif
|
||||
|
||||
AsyncArray AsyncArray_New();
|
||||
const char* AsyncArray_GetAsync(AsyncArray async_out,Mat out);
|
||||
void AsyncArray_Close(AsyncArray a);
|
||||
AsyncArray Net_forwardAsync(Net net, const char* outputName);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
82
vendor/gocv.io/x/gocv/calib3d.cpp
generated
vendored
82
vendor/gocv.io/x/gocv/calib3d.cpp
generated
vendored
@ -1,82 +0,0 @@
|
||||
#include "calib3d.h"
|
||||
|
||||
|
||||
void Fisheye_UndistortImage(Mat distorted, Mat undistorted, Mat k, Mat d) {
|
||||
cv::fisheye::undistortImage(*distorted, *undistorted, *k, *d);
|
||||
}
|
||||
|
||||
void Fisheye_UndistortImageWithParams(Mat distorted, Mat undistorted, Mat k, Mat d, Mat knew, Size size) {
|
||||
cv::Size sz(size.width, size.height);
|
||||
cv::fisheye::undistortImage(*distorted, *undistorted, *k, *d, *knew, sz);
|
||||
}
|
||||
|
||||
void Fisheye_UndistortPoints(Mat distorted, Mat undistorted, Mat k, Mat d, Mat r, Mat p) {
|
||||
cv::fisheye::undistortPoints(*distorted, *undistorted, *k, *d, *r, *p);
|
||||
}
|
||||
|
||||
void Fisheye_EstimateNewCameraMatrixForUndistortRectify(Mat k, Mat d, Size imgSize, Mat r, Mat p, double balance, Size newSize, double fovScale) {
|
||||
cv::Size newSz(newSize.width, newSize.height);
|
||||
cv::Size imgSz(imgSize.width, imgSize.height);
|
||||
cv::fisheye::estimateNewCameraMatrixForUndistortRectify(*k, *d, imgSz, *r, *p, balance, newSz, fovScale);
|
||||
}
|
||||
|
||||
void InitUndistortRectifyMap(Mat cameraMatrix,Mat distCoeffs,Mat r,Mat newCameraMatrix,Size size,int m1type,Mat map1,Mat map2) {
|
||||
cv::Size sz(size.width, size.height);
|
||||
cv::initUndistortRectifyMap(*cameraMatrix,*distCoeffs,*r,*newCameraMatrix,sz,m1type,*map1,*map2);
|
||||
}
|
||||
|
||||
Mat GetOptimalNewCameraMatrixWithParams(Mat cameraMatrix,Mat distCoeffs,Size size,double alpha,Size newImgSize,Rect* validPixROI,bool centerPrincipalPoint) {
|
||||
cv::Size sz(size.width, size.height);
|
||||
cv::Size newSize(newImgSize.width, newImgSize.height);
|
||||
cv::Rect rect(validPixROI->x,validPixROI->y,validPixROI->width,validPixROI->height);
|
||||
cv::Mat* mat = new cv::Mat(cv::getOptimalNewCameraMatrix(*cameraMatrix,*distCoeffs,sz,alpha,newSize,&rect,centerPrincipalPoint));
|
||||
validPixROI->x = rect.x;
|
||||
validPixROI->y = rect.y;
|
||||
validPixROI->width = rect.width;
|
||||
validPixROI->height = rect.height;
|
||||
return mat;
|
||||
}
|
||||
|
||||
double CalibrateCamera(Points3fVector objectPoints, Points2fVector imagePoints, Size imageSize, Mat cameraMatrix, Mat distCoeffs, Mat rvecs, Mat tvecs, int flag) {
|
||||
return cv::calibrateCamera(*objectPoints, *imagePoints, cv::Size(imageSize.width, imageSize.height), *cameraMatrix, *distCoeffs, *rvecs, *tvecs, flag);
|
||||
}
|
||||
|
||||
void Undistort(Mat src, Mat dst, Mat cameraMatrix, Mat distCoeffs, Mat newCameraMatrix) {
|
||||
cv::undistort(*src, *dst, *cameraMatrix, *distCoeffs, *newCameraMatrix);
|
||||
}
|
||||
|
||||
void UndistortPoints(Mat distorted, Mat undistorted, Mat k, Mat d, Mat r, Mat p) {
|
||||
cv::undistortPoints(*distorted, *undistorted, *k, *d, *r, *p);
|
||||
}
|
||||
|
||||
bool FindChessboardCorners(Mat image, Size patternSize, Mat corners, int flags) {
|
||||
cv::Size sz(patternSize.width, patternSize.height);
|
||||
return cv::findChessboardCorners(*image, sz, *corners, flags);
|
||||
}
|
||||
|
||||
bool FindChessboardCornersSB(Mat image, Size patternSize, Mat corners, int flags) {
|
||||
cv::Size sz(patternSize.width, patternSize.height);
|
||||
return cv::findChessboardCornersSB(*image, sz, *corners, flags);
|
||||
}
|
||||
|
||||
bool FindChessboardCornersSBWithMeta(Mat image, Size patternSize, Mat corners, int flags, Mat meta) {
|
||||
cv::Size sz(patternSize.width, patternSize.height);
|
||||
return cv::findChessboardCornersSB(*image, sz, *corners, flags, *meta);
|
||||
}
|
||||
|
||||
void DrawChessboardCorners(Mat image, Size patternSize, Mat corners, bool patternWasFound) {
|
||||
cv::Size sz(patternSize.width, patternSize.height);
|
||||
cv::drawChessboardCorners(*image, sz, *corners, patternWasFound);
|
||||
}
|
||||
|
||||
Mat EstimateAffinePartial2D(Point2fVector from, Point2fVector to) {
|
||||
return new cv::Mat(cv::estimateAffinePartial2D(*from, *to));
|
||||
}
|
||||
|
||||
Mat EstimateAffine2D(Point2fVector from, Point2fVector to) {
|
||||
return new cv::Mat(cv::estimateAffine2D(*from, *to));
|
||||
}
|
||||
|
||||
Mat EstimateAffine2DWithParams(Point2fVector from, Point2fVector to, Mat inliers, int method, double ransacReprojThreshold, size_t maxIters, double confidence, size_t refineIters) {
|
||||
return new cv::Mat(cv::estimateAffine2D(*from, *to, *inliers, method, ransacReprojThreshold, maxIters, confidence, refineIters));
|
||||
}
|
256
vendor/gocv.io/x/gocv/calib3d.go
generated
vendored
256
vendor/gocv.io/x/gocv/calib3d.go
generated
vendored
@ -1,256 +0,0 @@
|
||||
package gocv
|
||||
|
||||
/*
|
||||
#include <stdlib.h>
|
||||
#include "calib3d.h"
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
"image"
|
||||
)
|
||||
|
||||
// Calib is a wrapper around OpenCV's "Camera Calibration and 3D Reconstruction" of
|
||||
// Fisheye Camera model
|
||||
//
|
||||
// For more details, please see:
|
||||
// https://docs.opencv.org/trunk/db/d58/group__calib3d__fisheye.html
|
||||
|
||||
// CalibFlag value for calibration
|
||||
type CalibFlag int32
|
||||
|
||||
const (
|
||||
// CalibUseIntrinsicGuess indicates that cameraMatrix contains valid initial values
|
||||
// of fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially
|
||||
// set to the image center ( imageSize is used), and focal distances are computed
|
||||
// in a least-squares fashion.
|
||||
CalibUseIntrinsicGuess CalibFlag = 1 << iota
|
||||
|
||||
// CalibRecomputeExtrinsic indicates that extrinsic will be recomputed after each
|
||||
// iteration of intrinsic optimization.
|
||||
CalibRecomputeExtrinsic
|
||||
|
||||
// CalibCheckCond indicates that the functions will check validity of condition number
|
||||
CalibCheckCond
|
||||
|
||||
// CalibFixSkew indicates that skew coefficient (alpha) is set to zero and stay zero
|
||||
CalibFixSkew
|
||||
|
||||
// CalibFixK1 indicates that selected distortion coefficients are set to zeros and stay zero
|
||||
CalibFixK1
|
||||
|
||||
// CalibFixK2 indicates that selected distortion coefficients are set to zeros and stay zero
|
||||
CalibFixK2
|
||||
|
||||
// CalibFixK3 indicates that selected distortion coefficients are set to zeros and stay zero
|
||||
CalibFixK3
|
||||
|
||||
// CalibFixK4 indicates that selected distortion coefficients are set to zeros and stay zero
|
||||
CalibFixK4
|
||||
|
||||
// CalibFixIntrinsic indicates that fix K1, K2? and D1, D2? so that only R, T matrices are estimated
|
||||
CalibFixIntrinsic
|
||||
|
||||
// CalibFixPrincipalPoint indicates that the principal point is not changed during the global optimization.
|
||||
// It stays at the center or at a different location specified when CalibUseIntrinsicGuess is set too.
|
||||
CalibFixPrincipalPoint
|
||||
)
|
||||
|
||||
// FisheyeUndistortImage transforms an image to compensate for fisheye lens distortion
|
||||
func FisheyeUndistortImage(distorted Mat, undistorted *Mat, k, d Mat) {
|
||||
C.Fisheye_UndistortImage(distorted.Ptr(), undistorted.Ptr(), k.Ptr(), d.Ptr())
|
||||
}
|
||||
|
||||
// FisheyeUndistortImageWithParams transforms an image to compensate for fisheye lens distortion with Knew matrix
|
||||
func FisheyeUndistortImageWithParams(distorted Mat, undistorted *Mat, k, d, knew Mat, size image.Point) {
|
||||
sz := C.struct_Size{
|
||||
width: C.int(size.X),
|
||||
height: C.int(size.Y),
|
||||
}
|
||||
C.Fisheye_UndistortImageWithParams(distorted.Ptr(), undistorted.Ptr(), k.Ptr(), d.Ptr(), knew.Ptr(), sz)
|
||||
}
|
||||
|
||||
// FisheyeUndistortPoints transforms points to compensate for fisheye lens distortion
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/db/d58/group__calib3d__fisheye.html#gab738cdf90ceee97b2b52b0d0e7511541
|
||||
func FisheyeUndistortPoints(distorted Mat, undistorted *Mat, k, d, r, p Mat) {
|
||||
C.Fisheye_UndistortPoints(distorted.Ptr(), undistorted.Ptr(), k.Ptr(), d.Ptr(), r.Ptr(), p.Ptr())
|
||||
}
|
||||
|
||||
// EstimateNewCameraMatrixForUndistortRectify estimates new camera matrix for undistortion or rectification.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/db/d58/group__calib3d__fisheye.html#ga384940fdf04c03e362e94b6eb9b673c9
|
||||
func EstimateNewCameraMatrixForUndistortRectify(k, d Mat, imgSize image.Point, r Mat, p *Mat, balance float64, newSize image.Point, fovScale float64) {
|
||||
imgSz := C.struct_Size{
|
||||
width: C.int(imgSize.X),
|
||||
height: C.int(imgSize.Y),
|
||||
}
|
||||
newSz := C.struct_Size{
|
||||
width: C.int(newSize.X),
|
||||
height: C.int(newSize.Y),
|
||||
}
|
||||
C.Fisheye_EstimateNewCameraMatrixForUndistortRectify(k.Ptr(), d.Ptr(), imgSz, r.Ptr(), p.Ptr(), C.double(balance), newSz, C.double(fovScale))
|
||||
}
|
||||
|
||||
// InitUndistortRectifyMap computes the joint undistortion and rectification transformation and represents the result in the form of maps for remap
|
||||
//
|
||||
// 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),
|
||||
height: C.int(size.Y),
|
||||
}
|
||||
C.InitUndistortRectifyMap(cameraMatrix.Ptr(), distCoeffs.Ptr(), r.Ptr(), newCameraMatrix.Ptr(), sz, C.int(m1type), map1.Ptr(), map2.Ptr())
|
||||
}
|
||||
|
||||
// GetOptimalNewCameraMatrixWithParams computes and returns the optimal new camera matrix based on the free scaling parameter.
|
||||
//
|
||||
// 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),
|
||||
height: C.int(imageSize.Y),
|
||||
}
|
||||
newSize := C.struct_Size{
|
||||
width: C.int(newImgSize.X),
|
||||
height: C.int(newImgSize.Y),
|
||||
}
|
||||
rt := C.struct_Rect{}
|
||||
return newMat(C.GetOptimalNewCameraMatrixWithParams(cameraMatrix.Ptr(), distCoeffs.Ptr(), sz, C.double(alpha), newSize, &rt, C.bool(centerPrincipalPoint))), toRect(rt)
|
||||
}
|
||||
|
||||
// CalibrateCamera finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.
|
||||
//
|
||||
// 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{
|
||||
width: C.int(imageSize.X),
|
||||
height: C.int(imageSize.Y),
|
||||
}
|
||||
|
||||
res := C.CalibrateCamera(objectPoints.p, imagePoints.p, sz, cameraMatrix.p, distCoeffs.p, rvecs.p, tvecs.p, C.int(calibFlag))
|
||||
return float64(res)
|
||||
}
|
||||
|
||||
func Undistort(src Mat, dst *Mat, cameraMatrix Mat, distCoeffs Mat, newCameraMatrix Mat) {
|
||||
C.Undistort(src.Ptr(), dst.Ptr(), cameraMatrix.Ptr(), distCoeffs.Ptr(), newCameraMatrix.Ptr())
|
||||
}
|
||||
|
||||
// UndistortPoints transforms points to compensate for lens distortion
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga55c716492470bfe86b0ee9bf3a1f0f7e
|
||||
func UndistortPoints(src Mat, dst *Mat, cameraMatrix, distCoeffs, rectificationTransform, newCameraMatrix Mat) {
|
||||
C.UndistortPoints(src.Ptr(), dst.Ptr(), cameraMatrix.Ptr(), distCoeffs.Ptr(), rectificationTransform.Ptr(), newCameraMatrix.Ptr())
|
||||
}
|
||||
|
||||
// CalibCBFlag value for chessboard calibration
|
||||
// For more details, please see:
|
||||
// https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga93efa9b0aa890de240ca32b11253dd4a
|
||||
type CalibCBFlag int
|
||||
|
||||
const (
|
||||
// Various operation flags that can be zero or a combination of the following values:
|
||||
// Use adaptive thresholding to convert the image to black and white, rather than a fixed threshold level (computed from the average image brightness).
|
||||
CalibCBAdaptiveThresh CalibCBFlag = 1 << iota
|
||||
// Normalize the image gamma with equalizeHist before applying fixed or adaptive thresholding.
|
||||
CalibCBNormalizeImage
|
||||
// Use additional criteria (like contour area, perimeter, square-like shape) to filter out false quads extracted at the contour retrieval stage.
|
||||
CalibCBFilterQuads
|
||||
// Run a fast check on the image that looks for chessboard corners, and shortcut the call if none is found. This can drastically speed up the call in the degenerate condition when no chessboard is observed.
|
||||
CalibCBFastCheck
|
||||
// Run an exhaustive search to improve detection rate.
|
||||
CalibCBExhaustive
|
||||
// Up sample input image to improve sub-pixel accuracy due to aliasing effects.
|
||||
CalibCBAccuracy
|
||||
// The detected pattern is allowed to be larger than patternSize (see description).
|
||||
CalibCBLarger
|
||||
// The detected pattern must have a marker (see description). This should be used if an accurate camera calibration is required.
|
||||
CalibCBMarker
|
||||
)
|
||||
|
||||
// FindChessboardCorners finds the positions of internal corners of the chessboard.
|
||||
//
|
||||
// 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),
|
||||
height: C.int(patternSize.Y),
|
||||
}
|
||||
return bool(C.FindChessboardCorners(image.Ptr(), sz, corners.Ptr(), C.int(flags)))
|
||||
}
|
||||
|
||||
// FindChessboardCorners finds the positions of internal corners of the chessboard using a sector based approach.
|
||||
//
|
||||
// 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),
|
||||
height: C.int(patternSize.Y),
|
||||
}
|
||||
return bool(C.FindChessboardCornersSB(image.Ptr(), sz, corners.Ptr(), C.int(flags)))
|
||||
}
|
||||
|
||||
// FindChessboardCornersSBWithMeta finds the positions of internal corners of the chessboard using a sector based approach.
|
||||
//
|
||||
// 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),
|
||||
height: C.int(patternSize.Y),
|
||||
}
|
||||
return bool(C.FindChessboardCornersSBWithMeta(image.Ptr(), sz, corners.Ptr(), C.int(flags), meta.Ptr()))
|
||||
}
|
||||
|
||||
// DrawChessboardCorners renders the detected chessboard 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),
|
||||
height: C.int(patternSize.Y),
|
||||
}
|
||||
C.DrawChessboardCorners(image.Ptr(), sz, corners.Ptr(), C.bool(patternWasFound))
|
||||
}
|
||||
|
||||
// EstimateAffinePartial2D computes an optimal limited affine transformation
|
||||
// with 4 degrees of freedom between two 2D point sets.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d9/d0c/group__calib3d.html#gad767faff73e9cbd8b9d92b955b50062d
|
||||
func EstimateAffinePartial2D(from, to Point2fVector) Mat {
|
||||
return newMat(C.EstimateAffinePartial2D(from.p, to.p))
|
||||
}
|
||||
|
||||
// EstimateAffine2D Computes an optimal affine transformation between two 2D point sets.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/4.0.0/d9/d0c/group__calib3d.html#ga27865b1d26bac9ce91efaee83e94d4dd
|
||||
func EstimateAffine2D(from, to Point2fVector) Mat {
|
||||
return newMat(C.EstimateAffine2D(from.p, to.p))
|
||||
}
|
||||
|
||||
// EstimateAffine2DWithParams Computes an optimal affine transformation between two 2D point sets
|
||||
// with additional optional parameters.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/4.0.0/d9/d0c/group__calib3d.html#ga27865b1d26bac9ce91efaee83e94d4dd
|
||||
func EstimateAffine2DWithParams(from Point2fVector, to Point2fVector, inliers Mat, method int, ransacReprojThreshold float64, maxIters uint, confidence float64, refineIters uint) Mat {
|
||||
return newMat(C.EstimateAffine2DWithParams(from.p, to.p, inliers.p, C.int(method), C.double(ransacReprojThreshold), C.size_t(maxIters), C.double(confidence), C.size_t(refineIters)))
|
||||
}
|
36
vendor/gocv.io/x/gocv/calib3d.h
generated
vendored
36
vendor/gocv.io/x/gocv/calib3d.h
generated
vendored
@ -1,36 +0,0 @@
|
||||
#ifndef _OPENCV3_CALIB_H_
|
||||
#define _OPENCV3_CALIB_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <opencv2/calib3d.hpp>
|
||||
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "core.h"
|
||||
|
||||
//Calib
|
||||
void Fisheye_UndistortImage(Mat distorted, Mat undistorted, Mat k, Mat d);
|
||||
void Fisheye_UndistortImageWithParams(Mat distorted, Mat undistorted, Mat k, Mat d, Mat knew, Size size);
|
||||
void Fisheye_UndistortPoints(Mat distorted, Mat undistorted, Mat k, Mat d, Mat R, Mat P);
|
||||
void Fisheye_EstimateNewCameraMatrixForUndistortRectify(Mat k, Mat d, Size imgSize, Mat r, Mat p, double balance, Size newSize, double fovScale);
|
||||
|
||||
void InitUndistortRectifyMap(Mat cameraMatrix,Mat distCoeffs,Mat r,Mat newCameraMatrix,Size size,int m1type,Mat map1,Mat map2);
|
||||
Mat GetOptimalNewCameraMatrixWithParams(Mat cameraMatrix,Mat distCoeffs,Size size,double alpha,Size newImgSize,Rect* validPixROI,bool centerPrincipalPoint);
|
||||
double CalibrateCamera(Points3fVector objectPoints, Points2fVector imagePoints, Size imageSize, Mat cameraMatrix, Mat distCoeffs, Mat rvecs, Mat tvecs, int flag);
|
||||
void Undistort(Mat src, Mat dst, Mat cameraMatrix, Mat distCoeffs, Mat newCameraMatrix);
|
||||
void UndistortPoints(Mat distorted, Mat undistorted, Mat k, Mat d, Mat r, Mat p);
|
||||
bool FindChessboardCorners(Mat image, Size patternSize, Mat corners, int flags);
|
||||
bool FindChessboardCornersSB(Mat image, Size patternSize, Mat corners, int flags);
|
||||
bool FindChessboardCornersSBWithMeta(Mat image, Size patternSize, Mat corners, int flags, Mat meta);
|
||||
void DrawChessboardCorners(Mat image, Size patternSize, Mat corners, bool patternWasFound);
|
||||
Mat EstimateAffinePartial2D(Point2fVector from, Point2fVector to);
|
||||
Mat EstimateAffine2D(Point2fVector from, Point2fVector to);
|
||||
Mat EstimateAffine2DWithParams(Point2fVector from, Point2fVector to, Mat inliers, int method, double ransacReprojThreshold, size_t maxIters, double confidence, size_t refineIters);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //_OPENCV3_CALIB_H
|
49
vendor/gocv.io/x/gocv/calib3d_string.go
generated
vendored
49
vendor/gocv.io/x/gocv/calib3d_string.go
generated
vendored
@ -1,49 +0,0 @@
|
||||
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 ""
|
||||
}
|
||||
|
||||
func (c CalibCBFlag) String() string {
|
||||
switch c {
|
||||
case CalibCBAdaptiveThresh:
|
||||
return "calib-cb-adaptive-thresh"
|
||||
case CalibCBNormalizeImage:
|
||||
return "calib-cb-normalize-image"
|
||||
case CalibCBFilterQuads:
|
||||
return "calib-cb-filter-quads"
|
||||
case CalibCBFastCheck:
|
||||
return "calib-cb-fast-check"
|
||||
case CalibCBExhaustive:
|
||||
return "calib-cb-exhaustive"
|
||||
case CalibCBAccuracy:
|
||||
return "calib-cb-accuracy"
|
||||
case CalibCBLarger:
|
||||
return "calib-cb-larger"
|
||||
case CalibCBMarker:
|
||||
return "calib-cb-marker"
|
||||
}
|
||||
return ""
|
||||
}
|
14
vendor/gocv.io/x/gocv/cgo.go
generated
vendored
14
vendor/gocv.io/x/gocv/cgo.go
generated
vendored
@ -1,14 +0,0 @@
|
||||
//go:build !customenv && !static
|
||||
// +build !customenv,!static
|
||||
|
||||
package gocv
|
||||
|
||||
// Changes here should be mirrored in contrib/cgo.go and cuda/cgo.go.
|
||||
|
||||
/*
|
||||
#cgo !windows pkg-config: opencv4
|
||||
#cgo CXXFLAGS: --std=c++11
|
||||
#cgo windows CPPFLAGS: -IC:/opencv/build/install/include
|
||||
#cgo windows LDFLAGS: -LC:/opencv/build/install/x64/mingw/lib -lopencv_core460 -lopencv_face460 -lopencv_videoio460 -lopencv_imgproc460 -lopencv_highgui460 -lopencv_imgcodecs460 -lopencv_objdetect460 -lopencv_features2d460 -lopencv_video460 -lopencv_dnn460 -lopencv_xfeatures2d460 -lopencv_plot460 -lopencv_tracking460 -lopencv_img_hash460 -lopencv_calib3d460 -lopencv_bgsegm460 -lopencv_photo460 -lopencv_aruco460 -lopencv_wechat_qrcode460 -lopencv_ximgproc460
|
||||
*/
|
||||
import "C"
|
15
vendor/gocv.io/x/gocv/cgo_static.go
generated
vendored
15
vendor/gocv.io/x/gocv/cgo_static.go
generated
vendored
@ -1,15 +0,0 @@
|
||||
//go:build !customenv && static
|
||||
// +build !customenv,static
|
||||
|
||||
package gocv
|
||||
|
||||
// Changes here should be mirrored in contrib/cgo_static.go and cuda/cgo_static.go.
|
||||
|
||||
/*
|
||||
#cgo CXXFLAGS: --std=c++11
|
||||
#cgo !windows CPPFLAGS: -I/usr/local/include -I/usr/local/include/opencv4
|
||||
#cgo !windows LDFLAGS: -L/usr/local/lib -L/usr/local/lib/opencv4/3rdparty -lopencv_gapi -lopencv_stitching -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn_objdetect -lopencv_dpm -lopencv_face -lopencv_fuzzy -lopencv_hfs -lopencv_img_hash -lopencv_line_descriptor -lopencv_quality -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_superres -lopencv_optflow -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_highgui -lopencv_dnn -lopencv_plot -lopencv_videostab -lopencv_video -lopencv_videoio -lopencv_xfeatures2d -lopencv_shape -lopencv_ml -lopencv_ximgproc -lopencv_xobjdetect -lopencv_objdetect -lopencv_calib3d -lopencv_imgcodecs -lopencv_features2d -lopencv_flann -lopencv_xphoto -lopencv_wechat_qrcode -lopencv_photo -lopencv_imgproc -lopencv_core -littnotify -llibprotobuf -lIlmImf -lquirc -lippiw -lippicv -lade -lz -ljpeg -ldl -lm -lpthread -lrt -lquadmath
|
||||
#cgo windows CPPFLAGS: -IC:/opencv/build/install/include
|
||||
#cgo windows LDFLAGS: -LC:/opencv/build/install/x64/mingw/staticlib -lopencv_stereo460 -lopencv_tracking460 -lopencv_superres460 -lopencv_stitching460 -lopencv_optflow460 -lopencv_gapi460 -lopencv_face460 -lopencv_dpm460 -lopencv_dnn_objdetect460 -lopencv_ccalib460 -lopencv_bioinspired460 -lopencv_bgsegm460 -lopencv_aruco460 -lopencv_xobjdetect460 -lopencv_ximgproc460 -lopencv_xfeatures2d460 -lopencv_videostab460 -lopencv_video460 -lopencv_structured_light460 -lopencv_shape460 -lopencv_rgbd460 -lopencv_rapid460 -lopencv_objdetect460 -lopencv_mcc460 -lopencv_highgui460 -lopencv_datasets460 -lopencv_calib3d460 -lopencv_videoio460 -lopencv_text460 -lopencv_line_descriptor460 -lopencv_imgcodecs460 -lopencv_img_hash460 -lopencv_hfs460 -lopencv_fuzzy460 -lopencv_features2d460 -lopencv_dnn_superres460 -lopencv_dnn460 -lopencv_xphoto460 -lopencv_wechat_qrcode460 -lopencv_surface_matching460 -lopencv_reg460 -lopencv_quality460 -lopencv_plot460 -lopencv_photo460 -lopencv_phase_unwrapping460 -lopencv_ml460 -lopencv_intensity_transform460 -lopencv_imgproc460 -lopencv_flann460 -lopencv_core460 -lade -lquirc -llibprotobuf -lIlmImf -llibpng -llibopenjp2 -llibwebp -llibtiff -llibjpeg-turbo -lzlib -lkernel32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -luser32
|
||||
*/
|
||||
import "C"
|
3
vendor/gocv.io/x/gocv/codecov.yml
generated
vendored
3
vendor/gocv.io/x/gocv/codecov.yml
generated
vendored
@ -1,3 +0,0 @@
|
||||
ignore:
|
||||
- "*_string.go"
|
||||
- "*/*_string.go"
|
1147
vendor/gocv.io/x/gocv/core.cpp
generated
vendored
1147
vendor/gocv.io/x/gocv/core.cpp
generated
vendored
File diff suppressed because it is too large
Load Diff
2817
vendor/gocv.io/x/gocv/core.go
generated
vendored
2817
vendor/gocv.io/x/gocv/core.go
generated
vendored
File diff suppressed because it is too large
Load Diff
519
vendor/gocv.io/x/gocv/core.h
generated
vendored
519
vendor/gocv.io/x/gocv/core.h
generated
vendored
@ -1,519 +0,0 @@
|
||||
#ifndef _OPENCV3_CORE_H_
|
||||
#define _OPENCV3_CORE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
// Wrapper for std::vector<string>
|
||||
typedef struct CStrings {
|
||||
const char** strs;
|
||||
int length;
|
||||
} CStrings;
|
||||
|
||||
typedef struct ByteArray {
|
||||
char* data;
|
||||
int length;
|
||||
} ByteArray;
|
||||
|
||||
// Wrapper for std::vector<int>
|
||||
typedef struct IntVector {
|
||||
int* val;
|
||||
int length;
|
||||
} IntVector;
|
||||
|
||||
// Wrapper for std::vector<float>
|
||||
typedef struct FloatVector {
|
||||
float* val;
|
||||
int length;
|
||||
} FloatVector;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <opencv2/opencv.hpp>
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct RawData {
|
||||
int width;
|
||||
int height;
|
||||
struct ByteArray data;
|
||||
} RawData;
|
||||
|
||||
// Wrapper for an individual cv::Point2f
|
||||
typedef struct Point2f {
|
||||
float x;
|
||||
float y;
|
||||
} Point2f;
|
||||
|
||||
typedef struct Point3f {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
} Point3f;
|
||||
|
||||
// Wrapper for an individual cv::cvPoint
|
||||
typedef struct Point {
|
||||
int x;
|
||||
int y;
|
||||
} Point;
|
||||
|
||||
// Wrapper for the vector of Point structs aka std::vector<Point>
|
||||
typedef struct Points {
|
||||
Point* points;
|
||||
int length;
|
||||
} Points;
|
||||
|
||||
// Wrapper for the vector of Point2f structs aka std::vector<Point2f>
|
||||
typedef struct Points2f {
|
||||
Point2f* points;
|
||||
int length;
|
||||
} Points2f;
|
||||
|
||||
typedef struct Points3f {
|
||||
Point3f *points;
|
||||
int length;
|
||||
} Points3f;
|
||||
|
||||
// Contour is alias for Points
|
||||
typedef Points Contour;
|
||||
|
||||
|
||||
// Contour2f is alias for Points2f
|
||||
typedef Points2f Contour2f;
|
||||
|
||||
typedef struct Contours2f {
|
||||
Contour2f *contours;
|
||||
int length;
|
||||
} Contours2f;
|
||||
|
||||
// Contour3f is alias for Points3f
|
||||
typedef Points3f Contour3f;
|
||||
|
||||
// Wrapper for the vector of Points3f vectors aka std::vector< std::vector<Point3f> >
|
||||
typedef struct Contours3f {
|
||||
Contour3f *contours;
|
||||
int length;
|
||||
} Contours3f;
|
||||
|
||||
|
||||
// Wrapper for the vector of Points vectors aka std::vector< std::vector<Point> >
|
||||
typedef struct Contours {
|
||||
Contour* contours;
|
||||
int length;
|
||||
} Contours;
|
||||
|
||||
// Wrapper for an individual cv::cvRect
|
||||
typedef struct Rect {
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
} Rect;
|
||||
|
||||
// Wrapper for the vector of Rect struct aka std::vector<Rect>
|
||||
typedef struct Rects {
|
||||
Rect* rects;
|
||||
int length;
|
||||
} Rects;
|
||||
|
||||
// Wrapper for an individual cv::cvSize
|
||||
typedef struct Size {
|
||||
int width;
|
||||
int height;
|
||||
} Size;
|
||||
|
||||
// Wrapper for an individual cv::RotatedRect
|
||||
typedef struct RotatedRect {
|
||||
Points pts;
|
||||
Rect boundingRect;
|
||||
Point center;
|
||||
Size size;
|
||||
double angle;
|
||||
} RotatedRect;
|
||||
|
||||
// Wrapper for an individual cv::cvScalar
|
||||
typedef struct Scalar {
|
||||
double val1;
|
||||
double val2;
|
||||
double val3;
|
||||
double val4;
|
||||
} Scalar;
|
||||
|
||||
// Wrapper for a individual cv::KeyPoint
|
||||
typedef struct KeyPoint {
|
||||
double x;
|
||||
double y;
|
||||
double size;
|
||||
double angle;
|
||||
double response;
|
||||
int octave;
|
||||
int classID;
|
||||
} KeyPoint;
|
||||
|
||||
// Wrapper for the vector of KeyPoint struct aka std::vector<KeyPoint>
|
||||
typedef struct KeyPoints {
|
||||
KeyPoint* keypoints;
|
||||
int length;
|
||||
} KeyPoints;
|
||||
|
||||
// Wrapper for SimpleBlobDetectorParams aka SimpleBlobDetector::Params
|
||||
typedef struct SimpleBlobDetectorParams {
|
||||
unsigned char blobColor;
|
||||
bool filterByArea;
|
||||
bool filterByCircularity;
|
||||
bool filterByColor;
|
||||
bool filterByConvexity;
|
||||
bool filterByInertia;
|
||||
float maxArea;
|
||||
float maxCircularity;
|
||||
float maxConvexity;
|
||||
float maxInertiaRatio;
|
||||
float maxThreshold;
|
||||
float minArea;
|
||||
float minCircularity;
|
||||
float minConvexity;
|
||||
float minDistBetweenBlobs;
|
||||
float minInertiaRatio;
|
||||
size_t minRepeatability;
|
||||
float minThreshold;
|
||||
float thresholdStep;
|
||||
} SimpleBlobDetectorParams;
|
||||
|
||||
// Wrapper for an individual cv::DMatch
|
||||
typedef struct DMatch {
|
||||
int queryIdx;
|
||||
int trainIdx;
|
||||
int imgIdx;
|
||||
float distance;
|
||||
} DMatch;
|
||||
|
||||
// Wrapper for the vector of DMatch struct aka std::vector<DMatch>
|
||||
typedef struct DMatches {
|
||||
DMatch* dmatches;
|
||||
int length;
|
||||
} DMatches;
|
||||
|
||||
// Wrapper for the vector vector of DMatch struct aka std::vector<std::vector<DMatch>>
|
||||
typedef struct MultiDMatches {
|
||||
DMatches* dmatches;
|
||||
int length;
|
||||
} MultiDMatches;
|
||||
|
||||
// Wrapper for an individual cv::Moment
|
||||
typedef struct Moment {
|
||||
double m00;
|
||||
double m10;
|
||||
double m01;
|
||||
double m20;
|
||||
double m11;
|
||||
double m02;
|
||||
double m30;
|
||||
double m21;
|
||||
double m12;
|
||||
double m03;
|
||||
|
||||
double mu20;
|
||||
double mu11;
|
||||
double mu02;
|
||||
double mu30;
|
||||
double mu21;
|
||||
double mu12;
|
||||
double mu03;
|
||||
|
||||
double nu20;
|
||||
double nu11;
|
||||
double nu02;
|
||||
double nu30;
|
||||
double nu21;
|
||||
double nu12;
|
||||
double nu03;
|
||||
} Moment;
|
||||
|
||||
#ifdef __cplusplus
|
||||
typedef cv::Mat* Mat;
|
||||
typedef cv::TermCriteria* TermCriteria;
|
||||
typedef cv::RNG* RNG;
|
||||
typedef std::vector< cv::Point >* PointVector;
|
||||
typedef std::vector< std::vector< cv::Point > >* PointsVector;
|
||||
typedef std::vector< cv::Point2f >* Point2fVector;
|
||||
typedef std::vector< std::vector< cv::Point2f> >* Points2fVector;
|
||||
typedef std::vector< cv::Point3f >* Point3fVector;
|
||||
typedef std::vector< std::vector< cv::Point3f > >* Points3fVector;
|
||||
#else
|
||||
typedef void* Mat;
|
||||
typedef void* TermCriteria;
|
||||
typedef void* RNG;
|
||||
typedef void* PointVector;
|
||||
typedef void* PointsVector;
|
||||
typedef void* Point2fVector;
|
||||
typedef void* Points2fVector;
|
||||
typedef void* Point3fVector;
|
||||
typedef void* Points3fVector;
|
||||
#endif
|
||||
|
||||
// Wrapper for the vector of Mat aka std::vector<Mat>
|
||||
typedef struct Mats {
|
||||
Mat* mats;
|
||||
int length;
|
||||
} Mats;
|
||||
|
||||
Mat Mats_get(struct Mats mats, int i);
|
||||
struct DMatches MultiDMatches_get(struct MultiDMatches mds, int index);
|
||||
|
||||
struct ByteArray toByteArray(const char* buf, int len);
|
||||
void ByteArray_Release(struct ByteArray buf);
|
||||
|
||||
void Contours_Close(struct Contours cs);
|
||||
void KeyPoints_Close(struct KeyPoints ks);
|
||||
void Rects_Close(struct Rects rs);
|
||||
void Mats_Close(struct Mats mats);
|
||||
void Point_Close(struct Point p);
|
||||
void Points_Close(struct Points ps);
|
||||
void DMatches_Close(struct DMatches ds);
|
||||
void MultiDMatches_Close(struct MultiDMatches mds);
|
||||
|
||||
Mat Mat_New();
|
||||
Mat Mat_NewWithSize(int rows, int cols, int type);
|
||||
Mat Mat_NewWithSizes(struct IntVector sizes, int type);
|
||||
Mat Mat_NewWithSizesFromScalar(IntVector sizes, int type, Scalar ar);
|
||||
Mat Mat_NewWithSizesFromBytes(IntVector sizes, int type, struct ByteArray buf);
|
||||
Mat Mat_NewFromScalar(const Scalar ar, int type);
|
||||
Mat Mat_NewWithSizeFromScalar(const Scalar ar, int rows, int cols, int type);
|
||||
Mat Mat_NewFromBytes(int rows, int cols, int type, struct ByteArray buf);
|
||||
Mat Mat_FromPtr(Mat m, int rows, int cols, int type, int prows, int pcols);
|
||||
void Mat_Close(Mat m);
|
||||
int Mat_Empty(Mat m);
|
||||
bool Mat_IsContinuous(Mat m);
|
||||
Mat Mat_Clone(Mat m);
|
||||
void Mat_CopyTo(Mat m, Mat dst);
|
||||
int Mat_Total(Mat m);
|
||||
void Mat_Size(Mat m, IntVector* res);
|
||||
void Mat_CopyToWithMask(Mat m, Mat dst, Mat mask);
|
||||
void Mat_ConvertTo(Mat m, Mat dst, int type);
|
||||
void Mat_ConvertToWithParams(Mat m, Mat dst, int type, float alpha, float beta);
|
||||
struct ByteArray Mat_ToBytes(Mat m);
|
||||
struct ByteArray Mat_DataPtr(Mat m);
|
||||
Mat Mat_Region(Mat m, Rect r);
|
||||
Mat Mat_Reshape(Mat m, int cn, int rows);
|
||||
void Mat_PatchNaNs(Mat m);
|
||||
Mat Mat_ConvertFp16(Mat m);
|
||||
Scalar Mat_Mean(Mat m);
|
||||
Scalar Mat_MeanWithMask(Mat m, Mat mask);
|
||||
Mat Mat_Sqrt(Mat m);
|
||||
int Mat_Rows(Mat m);
|
||||
int Mat_Cols(Mat m);
|
||||
int Mat_Channels(Mat m);
|
||||
int Mat_Type(Mat m);
|
||||
int Mat_Step(Mat m);
|
||||
int Mat_ElemSize(Mat m);
|
||||
Mat Eye(int rows, int cols, int type);
|
||||
Mat Zeros(int rows, int cols, int type);
|
||||
Mat Ones(int rows, int cols, int type);
|
||||
|
||||
uint8_t Mat_GetUChar(Mat m, int row, int col);
|
||||
uint8_t Mat_GetUChar3(Mat m, int x, int y, int z);
|
||||
int8_t Mat_GetSChar(Mat m, int row, int col);
|
||||
int8_t Mat_GetSChar3(Mat m, int x, int y, int z);
|
||||
int16_t Mat_GetShort(Mat m, int row, int col);
|
||||
int16_t Mat_GetShort3(Mat m, int x, int y, int z);
|
||||
int32_t Mat_GetInt(Mat m, int row, int col);
|
||||
int32_t Mat_GetInt3(Mat m, int x, int y, int z);
|
||||
float Mat_GetFloat(Mat m, int row, int col);
|
||||
float Mat_GetFloat3(Mat m, int x, int y, int z);
|
||||
double Mat_GetDouble(Mat m, int row, int col);
|
||||
double Mat_GetDouble3(Mat m, int x, int y, int z);
|
||||
|
||||
void Mat_SetTo(Mat m, Scalar value);
|
||||
void Mat_SetUChar(Mat m, int row, int col, uint8_t val);
|
||||
void Mat_SetUChar3(Mat m, int x, int y, int z, uint8_t val);
|
||||
void Mat_SetSChar(Mat m, int row, int col, int8_t val);
|
||||
void Mat_SetSChar3(Mat m, int x, int y, int z, int8_t val);
|
||||
void Mat_SetShort(Mat m, int row, int col, int16_t val);
|
||||
void Mat_SetShort3(Mat m, int x, int y, int z, int16_t val);
|
||||
void Mat_SetInt(Mat m, int row, int col, int32_t val);
|
||||
void Mat_SetInt3(Mat m, int x, int y, int z, int32_t val);
|
||||
void Mat_SetFloat(Mat m, int row, int col, float val);
|
||||
void Mat_SetFloat3(Mat m, int x, int y, int z, float val);
|
||||
void Mat_SetDouble(Mat m, int row, int col, double val);
|
||||
void Mat_SetDouble3(Mat m, int x, int y, int z, double val);
|
||||
|
||||
void Mat_AddUChar(Mat m, uint8_t val);
|
||||
void Mat_SubtractUChar(Mat m, uint8_t val);
|
||||
void Mat_MultiplyUChar(Mat m, uint8_t val);
|
||||
void Mat_DivideUChar(Mat m, uint8_t val);
|
||||
void Mat_AddFloat(Mat m, float val);
|
||||
void Mat_SubtractFloat(Mat m, float val);
|
||||
void Mat_MultiplyFloat(Mat m, float val);
|
||||
void Mat_DivideFloat(Mat m, float val);
|
||||
Mat Mat_MultiplyMatrix(Mat x, Mat y);
|
||||
|
||||
Mat Mat_T(Mat x);
|
||||
|
||||
void LUT(Mat src, Mat lut, Mat dst);
|
||||
|
||||
void Mat_AbsDiff(Mat src1, Mat src2, Mat dst);
|
||||
void Mat_Add(Mat src1, Mat src2, Mat dst);
|
||||
void Mat_AddWeighted(Mat src1, double alpha, Mat src2, double beta, double gamma, Mat dst);
|
||||
void Mat_BitwiseAnd(Mat src1, Mat src2, Mat dst);
|
||||
void Mat_BitwiseAndWithMask(Mat src1, Mat src2, Mat dst, Mat mask);
|
||||
void Mat_BitwiseNot(Mat src1, Mat dst);
|
||||
void Mat_BitwiseNotWithMask(Mat src1, Mat dst, Mat mask);
|
||||
void Mat_BitwiseOr(Mat src1, Mat src2, Mat dst);
|
||||
void Mat_BitwiseOrWithMask(Mat src1, Mat src2, Mat dst, Mat mask);
|
||||
void Mat_BitwiseXor(Mat src1, Mat src2, Mat dst);
|
||||
void Mat_BitwiseXorWithMask(Mat src1, Mat src2, Mat dst, Mat mask);
|
||||
void Mat_Compare(Mat src1, Mat src2, Mat dst, int ct);
|
||||
void Mat_BatchDistance(Mat src1, Mat src2, Mat dist, int dtype, Mat nidx, int normType, int K,
|
||||
Mat mask, int update, bool crosscheck);
|
||||
int Mat_BorderInterpolate(int p, int len, int borderType);
|
||||
void Mat_CalcCovarMatrix(Mat samples, Mat covar, Mat mean, int flags, int ctype);
|
||||
void Mat_CartToPolar(Mat x, Mat y, Mat magnitude, Mat angle, bool angleInDegrees);
|
||||
bool Mat_CheckRange(Mat m);
|
||||
void Mat_CompleteSymm(Mat m, bool lowerToUpper);
|
||||
void Mat_ConvertScaleAbs(Mat src, Mat dst, double alpha, double beta);
|
||||
void Mat_CopyMakeBorder(Mat src, Mat dst, int top, int bottom, int left, int right, int borderType,
|
||||
Scalar value);
|
||||
int Mat_CountNonZero(Mat src);
|
||||
void Mat_DCT(Mat src, Mat dst, int flags);
|
||||
double Mat_Determinant(Mat m);
|
||||
void Mat_DFT(Mat m, Mat dst, int flags);
|
||||
void Mat_Divide(Mat src1, Mat src2, Mat dst);
|
||||
bool Mat_Eigen(Mat src, Mat eigenvalues, Mat eigenvectors);
|
||||
void Mat_EigenNonSymmetric(Mat src, Mat eigenvalues, Mat eigenvectors);
|
||||
void Mat_Exp(Mat src, Mat dst);
|
||||
void Mat_ExtractChannel(Mat src, Mat dst, int coi);
|
||||
void Mat_FindNonZero(Mat src, Mat idx);
|
||||
void Mat_Flip(Mat src, Mat dst, int flipCode);
|
||||
void Mat_Gemm(Mat src1, Mat src2, double alpha, Mat src3, double beta, Mat dst, int flags);
|
||||
int Mat_GetOptimalDFTSize(int vecsize);
|
||||
void Mat_Hconcat(Mat src1, Mat src2, Mat dst);
|
||||
void Mat_Vconcat(Mat src1, Mat src2, Mat dst);
|
||||
void Rotate(Mat src, Mat dst, int rotationCode);
|
||||
void Mat_Idct(Mat src, Mat dst, int flags);
|
||||
void Mat_Idft(Mat src, Mat dst, int flags, int nonzeroRows);
|
||||
void Mat_InRange(Mat src, Mat lowerb, Mat upperb, Mat dst);
|
||||
void Mat_InRangeWithScalar(Mat src, const Scalar lowerb, const Scalar upperb, Mat dst);
|
||||
void Mat_InsertChannel(Mat src, Mat dst, int coi);
|
||||
double Mat_Invert(Mat src, Mat dst, int flags);
|
||||
double KMeans(Mat data, int k, Mat bestLabels, TermCriteria criteria, int attempts, int flags, Mat centers);
|
||||
double KMeansPoints(PointVector pts, int k, Mat bestLabels, TermCriteria criteria, int attempts, int flags, Mat centers);
|
||||
void Mat_Log(Mat src, Mat dst);
|
||||
void Mat_Magnitude(Mat x, Mat y, Mat magnitude);
|
||||
void Mat_Max(Mat src1, Mat src2, Mat dst);
|
||||
void Mat_MeanStdDev(Mat src, Mat dstMean, Mat dstStdDev);
|
||||
void Mat_Merge(struct Mats mats, Mat dst);
|
||||
void Mat_Min(Mat src1, Mat src2, Mat dst);
|
||||
void Mat_MinMaxIdx(Mat m, double* minVal, double* maxVal, int* minIdx, int* maxIdx);
|
||||
void Mat_MinMaxLoc(Mat m, double* minVal, double* maxVal, Point* minLoc, Point* maxLoc);
|
||||
void Mat_MixChannels(struct Mats src, struct Mats dst, struct IntVector fromTo);
|
||||
void Mat_MulSpectrums(Mat a, Mat b, Mat c, int flags);
|
||||
void Mat_Multiply(Mat src1, Mat src2, Mat dst);
|
||||
void Mat_MultiplyWithParams(Mat src1, Mat src2, Mat dst, double scale, int dtype);
|
||||
void Mat_Subtract(Mat src1, Mat src2, Mat dst);
|
||||
void Mat_Normalize(Mat src, Mat dst, double alpha, double beta, int typ);
|
||||
double Norm(Mat src1, int normType);
|
||||
double NormWithMats(Mat src1, Mat src2, int normType);
|
||||
void Mat_PerspectiveTransform(Mat src, Mat dst, Mat tm);
|
||||
bool Mat_Solve(Mat src1, Mat src2, Mat dst, int flags);
|
||||
int Mat_SolveCubic(Mat coeffs, Mat roots);
|
||||
double Mat_SolvePoly(Mat coeffs, Mat roots, int maxIters);
|
||||
void Mat_Reduce(Mat src, Mat dst, int dim, int rType, int dType);
|
||||
void Mat_Repeat(Mat src, int nY, int nX, Mat dst);
|
||||
void Mat_ScaleAdd(Mat src1, double alpha, Mat src2, Mat dst);
|
||||
void Mat_SetIdentity(Mat src, double scalar);
|
||||
void Mat_Sort(Mat src, Mat dst, int flags);
|
||||
void Mat_SortIdx(Mat src, Mat dst, int flags);
|
||||
void Mat_Split(Mat src, struct Mats* mats);
|
||||
void Mat_Subtract(Mat src1, Mat src2, Mat dst);
|
||||
Scalar Mat_Trace(Mat src);
|
||||
void Mat_Transform(Mat src, Mat dst, Mat tm);
|
||||
void Mat_Transpose(Mat src, Mat dst);
|
||||
void Mat_PolarToCart(Mat magnitude, Mat degree, Mat x, Mat y, bool angleInDegrees);
|
||||
void Mat_Pow(Mat src, double power, Mat dst);
|
||||
void Mat_Phase(Mat x, Mat y, Mat angle, bool angleInDegrees);
|
||||
Scalar Mat_Sum(Mat src1);
|
||||
|
||||
TermCriteria TermCriteria_New(int typ, int maxCount, double epsilon);
|
||||
|
||||
int64_t GetCVTickCount();
|
||||
double GetTickFrequency();
|
||||
|
||||
Mat Mat_rowRange(Mat m,int startrow,int endrow);
|
||||
Mat Mat_colRange(Mat m,int startrow,int endrow);
|
||||
|
||||
PointVector PointVector_New();
|
||||
PointVector PointVector_NewFromPoints(Contour points);
|
||||
PointVector PointVector_NewFromMat(Mat mat);
|
||||
Point PointVector_At(PointVector pv, int idx);
|
||||
void PointVector_Append(PointVector pv, Point p);
|
||||
int PointVector_Size(PointVector pv);
|
||||
void PointVector_Close(PointVector pv);
|
||||
|
||||
PointsVector PointsVector_New();
|
||||
PointsVector PointsVector_NewFromPoints(Contours points);
|
||||
PointVector PointsVector_At(PointsVector psv, int idx);
|
||||
void PointsVector_Append(PointsVector psv, PointVector pv);
|
||||
int PointsVector_Size(PointsVector psv);
|
||||
void PointsVector_Close(PointsVector psv);
|
||||
|
||||
Point2fVector Point2fVector_New();
|
||||
void Point2fVector_Close(Point2fVector pfv);
|
||||
Point2fVector Point2fVector_NewFromPoints(Contour2f pts);
|
||||
Point2fVector Point2fVector_NewFromMat(Mat mat);
|
||||
Point2f Point2fVector_At(Point2fVector pfv, int idx);
|
||||
int Point2fVector_Size(Point2fVector pfv);
|
||||
|
||||
void IntVector_Close(struct IntVector ivec);
|
||||
|
||||
void CStrings_Close(struct CStrings cstrs);
|
||||
|
||||
RNG TheRNG();
|
||||
|
||||
void SetRNGSeed(int seed);
|
||||
|
||||
void RNG_Fill(RNG rng, Mat mat, int distType, double a, double b, bool saturateRange);
|
||||
|
||||
double RNG_Gaussian(RNG rng, double sigma);
|
||||
|
||||
unsigned int RNG_Next(RNG rng);
|
||||
|
||||
void RandN(Mat mat, Scalar mean, Scalar stddev);
|
||||
|
||||
void RandShuffle(Mat mat);
|
||||
|
||||
void RandShuffleWithParams(Mat mat, double iterFactor, RNG rng);
|
||||
|
||||
void RandU(Mat mat, Scalar low, Scalar high);
|
||||
|
||||
void copyPointVectorToPoint2fVector(PointVector src, Point2fVector dest);
|
||||
|
||||
void StdByteVectorInitialize(void* data);
|
||||
void StdByteVectorFree(void *data);
|
||||
size_t StdByteVectorLen(void *data);
|
||||
uint8_t* StdByteVectorData(void *data);
|
||||
|
||||
Points2fVector Points2fVector_New();
|
||||
Points2fVector Points2fVector_NewFromPoints(Contours2f points);
|
||||
int Points2fVector_Size(Points2fVector ps);
|
||||
Point2fVector Points2fVector_At(Points2fVector ps, int idx);
|
||||
void Points2fVector_Append(Points2fVector psv, Point2fVector pv);
|
||||
void Points2fVector_Close(Points2fVector ps);
|
||||
|
||||
Point3fVector Point3fVector_New();
|
||||
Point3fVector Point3fVector_NewFromPoints(Contour3f points);
|
||||
Point3fVector Point3fVector_NewFromMat(Mat mat);
|
||||
void Point3fVector_Append(Point3fVector pfv, Point3f point);
|
||||
Point3f Point3fVector_At(Point3fVector pfv, int idx);
|
||||
int Point3fVector_Size(Point3fVector pfv);
|
||||
void Point3fVector_Close(Point3fVector pv);
|
||||
Points3fVector Points3fVector_New();
|
||||
Points3fVector Points3fVector_NewFromPoints(Contours3f points);
|
||||
int Points3fVector_Size(Points3fVector ps);
|
||||
Point3fVector Points3fVector_At(Points3fVector ps, int idx);
|
||||
void Points3fVector_Append(Points3fVector psv, Point3fVector pv);
|
||||
void Points3fVector_Close(Points3fVector ps);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //_OPENCV3_CORE_H_
|
211
vendor/gocv.io/x/gocv/core_string.go
generated
vendored
211
vendor/gocv.io/x/gocv/core_string.go
generated
vendored
@ -1,211 +0,0 @@
|
||||
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 ""
|
||||
}
|
266
vendor/gocv.io/x/gocv/dnn.cpp
generated
vendored
266
vendor/gocv.io/x/gocv/dnn.cpp
generated
vendored
@ -1,266 +0,0 @@
|
||||
#include "dnn.h"
|
||||
|
||||
Net Net_ReadNet(const char* model, const char* config) {
|
||||
Net n = new cv::dnn::Net(cv::dnn::readNet(model, config));
|
||||
return n;
|
||||
}
|
||||
|
||||
Net Net_ReadNetBytes(const char* framework, struct ByteArray model, struct ByteArray config) {
|
||||
std::vector<uchar> modelv(model.data, model.data + model.length);
|
||||
std::vector<uchar> configv(config.data, config.data + config.length);
|
||||
Net n = new cv::dnn::Net(cv::dnn::readNet(framework, modelv, configv));
|
||||
return n;
|
||||
}
|
||||
|
||||
Net Net_ReadNetFromCaffe(const char* prototxt, const char* caffeModel) {
|
||||
Net n = new cv::dnn::Net(cv::dnn::readNetFromCaffe(prototxt, caffeModel));
|
||||
return n;
|
||||
}
|
||||
|
||||
Net Net_ReadNetFromCaffeBytes(struct ByteArray prototxt, struct ByteArray caffeModel) {
|
||||
Net n = new cv::dnn::Net(cv::dnn::readNetFromCaffe(prototxt.data, prototxt.length,
|
||||
caffeModel.data, caffeModel.length));
|
||||
return n;
|
||||
}
|
||||
|
||||
Net Net_ReadNetFromTensorflow(const char* model) {
|
||||
Net n = new cv::dnn::Net(cv::dnn::readNetFromTensorflow(model));
|
||||
return n;
|
||||
}
|
||||
|
||||
Net Net_ReadNetFromTensorflowBytes(struct ByteArray model) {
|
||||
Net n = new cv::dnn::Net(cv::dnn::readNetFromTensorflow(model.data, model.length));
|
||||
return n;
|
||||
}
|
||||
|
||||
Net Net_ReadNetFromTorch(const char* model) {
|
||||
Net n = new cv::dnn::Net(cv::dnn::readNetFromTorch(model));
|
||||
return n;
|
||||
}
|
||||
|
||||
Net Net_ReadNetFromONNX(const char* model) {
|
||||
Net n = new cv::dnn::Net(cv::dnn::readNetFromONNX(model));
|
||||
return n;
|
||||
}
|
||||
|
||||
Net Net_ReadNetFromONNXBytes(struct ByteArray model) {
|
||||
Net n = new cv::dnn::Net(cv::dnn::readNetFromONNX(model.data, model.length));
|
||||
return n;
|
||||
}
|
||||
|
||||
void Net_Close(Net net) {
|
||||
delete net;
|
||||
}
|
||||
|
||||
bool Net_Empty(Net net) {
|
||||
return net->empty();
|
||||
}
|
||||
|
||||
void Net_SetInput(Net net, Mat blob, const char* name) {
|
||||
net->setInput(*blob, name);
|
||||
}
|
||||
|
||||
Mat Net_Forward(Net net, const char* outputName) {
|
||||
return new cv::Mat(net->forward(outputName));
|
||||
}
|
||||
|
||||
void Net_ForwardLayers(Net net, struct Mats* outputBlobs, struct CStrings outBlobNames) {
|
||||
std::vector< cv::Mat > blobs;
|
||||
|
||||
std::vector< cv::String > names;
|
||||
for (int i = 0; i < outBlobNames.length; ++i) {
|
||||
names.push_back(cv::String(outBlobNames.strs[i]));
|
||||
}
|
||||
net->forward(blobs, names);
|
||||
|
||||
// copy blobs into outputBlobs
|
||||
outputBlobs->mats = new Mat[blobs.size()];
|
||||
|
||||
for (size_t i = 0; i < blobs.size(); ++i) {
|
||||
outputBlobs->mats[i] = new cv::Mat(blobs[i]);
|
||||
}
|
||||
|
||||
outputBlobs->length = (int)blobs.size();
|
||||
}
|
||||
|
||||
void Net_SetPreferableBackend(Net net, int backend) {
|
||||
net->setPreferableBackend(backend);
|
||||
}
|
||||
|
||||
void Net_SetPreferableTarget(Net net, int target) {
|
||||
net->setPreferableTarget(target);
|
||||
}
|
||||
|
||||
int64_t Net_GetPerfProfile(Net net) {
|
||||
std::vector<double> layersTimes;
|
||||
return net->getPerfProfile(layersTimes);
|
||||
}
|
||||
|
||||
void Net_GetUnconnectedOutLayers(Net net, IntVector* res) {
|
||||
std::vector< int > cids(net->getUnconnectedOutLayers());
|
||||
int* ids = new int[cids.size()];
|
||||
|
||||
for (size_t i = 0; i < cids.size(); ++i) {
|
||||
ids[i] = cids[i];
|
||||
}
|
||||
|
||||
res->length = cids.size();
|
||||
res->val = ids;
|
||||
return;
|
||||
}
|
||||
|
||||
void Net_GetLayerNames(Net net, CStrings* names) {
|
||||
std::vector< cv::String > cstrs(net->getLayerNames());
|
||||
const char **strs = new const char*[cstrs.size()];
|
||||
|
||||
for (size_t i = 0; i < cstrs.size(); ++i) {
|
||||
strs[i] = cstrs[i].c_str();
|
||||
}
|
||||
|
||||
names->length = cstrs.size();
|
||||
names->strs = strs;
|
||||
return;
|
||||
}
|
||||
|
||||
Mat Net_BlobFromImage(Mat image, double scalefactor, Size size, Scalar mean, bool swapRB,
|
||||
bool crop) {
|
||||
cv::Size sz(size.width, size.height);
|
||||
cv::Scalar cm(mean.val1, mean.val2, mean.val3, mean.val4);
|
||||
// use the default target ddepth here.
|
||||
return new cv::Mat(cv::dnn::blobFromImage(*image, scalefactor, sz, cm, swapRB, crop));
|
||||
}
|
||||
|
||||
void Net_BlobFromImages(struct Mats images, Mat blob, double scalefactor, Size size,
|
||||
Scalar mean, bool swapRB, bool crop, int ddepth) {
|
||||
std::vector<cv::Mat> imgs;
|
||||
|
||||
for (int i = 0; i < images.length; ++i) {
|
||||
imgs.push_back(*images.mats[i]);
|
||||
}
|
||||
|
||||
cv::Size sz(size.width, size.height);
|
||||
cv::Scalar cm = cv::Scalar(mean.val1, mean.val2, mean.val3, mean.val4);
|
||||
|
||||
// ignore the passed in ddepth, just use default.
|
||||
cv::dnn::blobFromImages(imgs, *blob, scalefactor, sz, cm, swapRB, crop);
|
||||
}
|
||||
|
||||
void Net_ImagesFromBlob(Mat blob_, struct Mats* images_) {
|
||||
std::vector<cv::Mat> imgs;
|
||||
cv::dnn::imagesFromBlob(*blob_, imgs);
|
||||
images_->mats = new Mat[imgs.size()];
|
||||
|
||||
for (size_t i = 0; i < imgs.size(); ++i) {
|
||||
images_->mats[i] = new cv::Mat(imgs[i]);
|
||||
}
|
||||
images_->length = (int) imgs.size();
|
||||
}
|
||||
|
||||
Mat Net_GetBlobChannel(Mat blob, int imgidx, int chnidx) {
|
||||
size_t w = blob->size[3];
|
||||
size_t h = blob->size[2];
|
||||
return new cv::Mat(h, w, CV_32F, blob->ptr<float>(imgidx, chnidx));
|
||||
}
|
||||
|
||||
Scalar Net_GetBlobSize(Mat blob) {
|
||||
Scalar scal = Scalar();
|
||||
scal.val1 = blob->size[0];
|
||||
scal.val2 = blob->size[1];
|
||||
scal.val3 = blob->size[2];
|
||||
scal.val4 = blob->size[3];
|
||||
return scal;
|
||||
}
|
||||
|
||||
Layer Net_GetLayer(Net net, int layerid) {
|
||||
return new cv::Ptr<cv::dnn::Layer>(net->getLayer(layerid));
|
||||
}
|
||||
|
||||
void Layer_Close(Layer layer) {
|
||||
delete layer;
|
||||
}
|
||||
|
||||
int Layer_InputNameToIndex(Layer layer, const char* name) {
|
||||
return (*layer)->inputNameToIndex(name);
|
||||
}
|
||||
|
||||
int Layer_OutputNameToIndex(Layer layer, const char* name) {
|
||||
return (*layer)->outputNameToIndex(name);
|
||||
}
|
||||
|
||||
const char* Layer_GetName(Layer layer) {
|
||||
return (*layer)->name.c_str();
|
||||
}
|
||||
|
||||
const char* Layer_GetType(Layer layer) {
|
||||
return (*layer)->type.c_str();
|
||||
}
|
||||
|
||||
void NMSBoxes(struct Rects bboxes, FloatVector scores, float score_threshold, float nms_threshold, IntVector* indices) {
|
||||
std::vector<cv::Rect> _bboxes;
|
||||
|
||||
for (int i = 0; i < bboxes.length; ++i) {
|
||||
_bboxes.push_back(cv::Rect(
|
||||
bboxes.rects[i].x,
|
||||
bboxes.rects[i].y,
|
||||
bboxes.rects[i].width,
|
||||
bboxes.rects[i].height
|
||||
));
|
||||
}
|
||||
|
||||
std::vector<float> _scores;
|
||||
|
||||
float* f;
|
||||
int i;
|
||||
for (i = 0, f = scores.val; i < scores.length; ++f, ++i) {
|
||||
_scores.push_back(*f);
|
||||
}
|
||||
|
||||
std::vector<int> _indices(indices->length);
|
||||
|
||||
cv::dnn::NMSBoxes(_bboxes, _scores, score_threshold, nms_threshold, _indices, 1.f, 0);
|
||||
|
||||
int* ptr = new int[_indices.size()];
|
||||
|
||||
for (size_t i=0; i<_indices.size(); ++i) {
|
||||
ptr[i] = _indices[i];
|
||||
}
|
||||
|
||||
indices->length = _indices.size();
|
||||
indices->val = ptr;
|
||||
return;
|
||||
}
|
||||
|
||||
void NMSBoxesWithParams(struct Rects bboxes, FloatVector scores, const float score_threshold, const float nms_threshold, IntVector* indices, const float eta, const int top_k) {
|
||||
std::vector<cv::Rect> _bboxes;
|
||||
|
||||
for (int i = 0; i < bboxes.length; ++i) {
|
||||
_bboxes.push_back(cv::Rect(
|
||||
bboxes.rects[i].x,
|
||||
bboxes.rects[i].y,
|
||||
bboxes.rects[i].width,
|
||||
bboxes.rects[i].height
|
||||
));
|
||||
}
|
||||
|
||||
std::vector<float> _scores;
|
||||
|
||||
float* f;
|
||||
int i;
|
||||
for (i = 0, f = scores.val; i < scores.length; ++f, ++i) {
|
||||
_scores.push_back(*f);
|
||||
}
|
||||
|
||||
std::vector<int> _indices(indices->length);
|
||||
|
||||
cv::dnn::NMSBoxes(_bboxes, _scores, score_threshold, nms_threshold, _indices, eta, top_k);
|
||||
|
||||
int* ptr = new int[_indices.size()];
|
||||
|
||||
for (size_t i=0; i<_indices.size(); ++i) {
|
||||
ptr[i] = _indices[i];
|
||||
}
|
||||
|
||||
indices->length = _indices.size();
|
||||
indices->val = ptr;
|
||||
return;
|
||||
}
|
615
vendor/gocv.io/x/gocv/dnn.go
generated
vendored
615
vendor/gocv.io/x/gocv/dnn.go
generated
vendored
@ -1,615 +0,0 @@
|
||||
package gocv
|
||||
|
||||
/*
|
||||
#include <stdlib.h>
|
||||
#include "dnn.h"
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
"image"
|
||||
"reflect"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Net allows you to create and manipulate comprehensive artificial neural networks.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/db/d30/classcv_1_1dnn_1_1Net.html
|
||||
//
|
||||
type Net struct {
|
||||
// C.Net
|
||||
p unsafe.Pointer
|
||||
}
|
||||
|
||||
// NetBackendType is the type for the various different kinds of DNN backends.
|
||||
type NetBackendType int
|
||||
|
||||
const (
|
||||
// NetBackendDefault is the default backend.
|
||||
NetBackendDefault NetBackendType = 0
|
||||
|
||||
// NetBackendHalide is the Halide backend.
|
||||
NetBackendHalide NetBackendType = 1
|
||||
|
||||
// NetBackendOpenVINO is the OpenVINO backend.
|
||||
NetBackendOpenVINO NetBackendType = 2
|
||||
|
||||
// NetBackendOpenCV is the OpenCV backend.
|
||||
NetBackendOpenCV NetBackendType = 3
|
||||
|
||||
// NetBackendVKCOM is the Vulkan backend.
|
||||
NetBackendVKCOM NetBackendType = 4
|
||||
|
||||
// NetBackendCUDA is the Cuda backend.
|
||||
NetBackendCUDA NetBackendType = 5
|
||||
)
|
||||
|
||||
// ParseNetBackend returns a valid NetBackendType given a string. Valid values are:
|
||||
// - halide
|
||||
// - openvino
|
||||
// - opencv
|
||||
// - vulkan
|
||||
// - cuda
|
||||
// - default
|
||||
func ParseNetBackend(backend string) NetBackendType {
|
||||
switch backend {
|
||||
case "halide":
|
||||
return NetBackendHalide
|
||||
case "openvino":
|
||||
return NetBackendOpenVINO
|
||||
case "opencv":
|
||||
return NetBackendOpenCV
|
||||
case "vulkan":
|
||||
return NetBackendVKCOM
|
||||
case "cuda":
|
||||
return NetBackendCUDA
|
||||
default:
|
||||
return NetBackendDefault
|
||||
}
|
||||
}
|
||||
|
||||
// NetTargetType is the type for the various different kinds of DNN device targets.
|
||||
type NetTargetType int
|
||||
|
||||
const (
|
||||
// NetTargetCPU is the default CPU device target.
|
||||
NetTargetCPU NetTargetType = 0
|
||||
|
||||
// NetTargetFP32 is the 32-bit OpenCL target.
|
||||
NetTargetFP32 NetTargetType = 1
|
||||
|
||||
// NetTargetFP16 is the 16-bit OpenCL target.
|
||||
NetTargetFP16 NetTargetType = 2
|
||||
|
||||
// NetTargetVPU is the Movidius VPU target.
|
||||
NetTargetVPU NetTargetType = 3
|
||||
|
||||
// NetTargetVulkan is the NVIDIA Vulkan target.
|
||||
NetTargetVulkan NetTargetType = 4
|
||||
|
||||
// NetTargetFPGA is the FPGA target.
|
||||
NetTargetFPGA NetTargetType = 5
|
||||
|
||||
// NetTargetCUDA is the CUDA target.
|
||||
NetTargetCUDA NetTargetType = 6
|
||||
|
||||
// NetTargetCUDAFP16 is the CUDA target.
|
||||
NetTargetCUDAFP16 NetTargetType = 7
|
||||
)
|
||||
|
||||
// ParseNetTarget returns a valid NetTargetType given a string. Valid values are:
|
||||
// - cpu
|
||||
// - fp32
|
||||
// - fp16
|
||||
// - vpu
|
||||
// - vulkan
|
||||
// - fpga
|
||||
// - cuda
|
||||
// - cudafp16
|
||||
func ParseNetTarget(target string) NetTargetType {
|
||||
switch target {
|
||||
case "cpu":
|
||||
return NetTargetCPU
|
||||
case "fp32":
|
||||
return NetTargetFP32
|
||||
case "fp16":
|
||||
return NetTargetFP16
|
||||
case "vpu":
|
||||
return NetTargetVPU
|
||||
case "vulkan":
|
||||
return NetTargetVulkan
|
||||
case "fpga":
|
||||
return NetTargetFPGA
|
||||
case "cuda":
|
||||
return NetTargetCUDA
|
||||
case "cudafp16":
|
||||
return NetTargetCUDAFP16
|
||||
default:
|
||||
return NetTargetCPU
|
||||
}
|
||||
}
|
||||
|
||||
// Close Net
|
||||
func (net *Net) Close() error {
|
||||
C.Net_Close((C.Net)(net.p))
|
||||
net.p = nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// Empty returns true if there are no layers in the network.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/db/d30/classcv_1_1dnn_1_1Net.html#a6a5778787d5b8770deab5eda6968e66c
|
||||
//
|
||||
func (net *Net) Empty() bool {
|
||||
return bool(C.Net_Empty((C.Net)(net.p)))
|
||||
}
|
||||
|
||||
// SetInput sets the new value for the layer output blob.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/trunk/db/d30/classcv_1_1dnn_1_1Net.html#a672a08ae76444d75d05d7bfea3e4a328
|
||||
//
|
||||
func (net *Net) SetInput(blob Mat, name string) {
|
||||
cName := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
C.Net_SetInput((C.Net)(net.p), blob.p, cName)
|
||||
}
|
||||
|
||||
// Forward runs forward pass to compute output of layer with name outputName.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/trunk/db/d30/classcv_1_1dnn_1_1Net.html#a98ed94cb6ef7063d3697259566da310b
|
||||
//
|
||||
func (net *Net) Forward(outputName string) Mat {
|
||||
cName := C.CString(outputName)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
return newMat(C.Net_Forward((C.Net)(net.p), cName))
|
||||
}
|
||||
|
||||
// ForwardLayers forward pass to compute outputs of layers listed in outBlobNames.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/3.4.1/db/d30/classcv_1_1dnn_1_1Net.html#adb34d7650e555264c7da3b47d967311b
|
||||
//
|
||||
func (net *Net) ForwardLayers(outBlobNames []string) (blobs []Mat) {
|
||||
cMats := C.struct_Mats{}
|
||||
C.Net_ForwardLayers((C.Net)(net.p), &(cMats), toCStrings(outBlobNames))
|
||||
blobs = make([]Mat, cMats.length)
|
||||
for i := C.int(0); i < cMats.length; i++ {
|
||||
blobs[i].p = C.Mats_get(cMats, i)
|
||||
addMatToProfile(blobs[i].p)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// SetPreferableBackend ask network to use specific computation backend.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/3.4/db/d30/classcv_1_1dnn_1_1Net.html#a7f767df11386d39374db49cd8df8f59e
|
||||
//
|
||||
func (net *Net) SetPreferableBackend(backend NetBackendType) error {
|
||||
C.Net_SetPreferableBackend((C.Net)(net.p), C.int(backend))
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetPreferableTarget ask network to make computations on specific target device.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/3.4/db/d30/classcv_1_1dnn_1_1Net.html#a9dddbefbc7f3defbe3eeb5dc3d3483f4
|
||||
//
|
||||
func (net *Net) SetPreferableTarget(target NetTargetType) error {
|
||||
C.Net_SetPreferableTarget((C.Net)(net.p), C.int(target))
|
||||
return nil
|
||||
}
|
||||
|
||||
// ReadNet reads a deep learning network represented in one of the supported formats.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/3.4/d6/d0f/group__dnn.html#ga3b34fe7a29494a6a4295c169a7d32422
|
||||
//
|
||||
func ReadNet(model string, config string) Net {
|
||||
cModel := C.CString(model)
|
||||
defer C.free(unsafe.Pointer(cModel))
|
||||
|
||||
cConfig := C.CString(config)
|
||||
defer C.free(unsafe.Pointer(cConfig))
|
||||
return Net{p: unsafe.Pointer(C.Net_ReadNet(cModel, cConfig))}
|
||||
}
|
||||
|
||||
// ReadNetBytes reads a deep learning network represented in one of the supported formats.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d6/d0f/group__dnn.html#ga138439da76f26266fdefec9723f6c5cd
|
||||
//
|
||||
func ReadNetBytes(framework string, model []byte, config []byte) (Net, error) {
|
||||
cFramework := C.CString(framework)
|
||||
defer C.free(unsafe.Pointer(cFramework))
|
||||
bModel, err := toByteArray(model)
|
||||
if err != nil {
|
||||
return Net{}, err
|
||||
}
|
||||
bConfig, err := toByteArray(config)
|
||||
if err != nil {
|
||||
return Net{}, err
|
||||
}
|
||||
return Net{p: unsafe.Pointer(C.Net_ReadNetBytes(cFramework, *bModel, *bConfig))}, nil
|
||||
}
|
||||
|
||||
// ReadNetFromCaffe reads a network model stored in Caffe framework's format.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d6/d0f/group__dnn.html#ga29d0ea5e52b1d1a6c2681e3f7d68473a
|
||||
//
|
||||
func ReadNetFromCaffe(prototxt string, caffeModel string) Net {
|
||||
cprototxt := C.CString(prototxt)
|
||||
defer C.free(unsafe.Pointer(cprototxt))
|
||||
|
||||
cmodel := C.CString(caffeModel)
|
||||
defer C.free(unsafe.Pointer(cmodel))
|
||||
return Net{p: unsafe.Pointer(C.Net_ReadNetFromCaffe(cprototxt, cmodel))}
|
||||
}
|
||||
|
||||
// ReadNetFromCaffeBytes reads a network model stored in Caffe model in memory.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d6/d0f/group__dnn.html#ga946b342af1355185a7107640f868b64a
|
||||
//
|
||||
func ReadNetFromCaffeBytes(prototxt []byte, caffeModel []byte) (Net, error) {
|
||||
bPrototxt, err := toByteArray(prototxt)
|
||||
if err != nil {
|
||||
return Net{}, err
|
||||
}
|
||||
bCaffeModel, err := toByteArray(caffeModel)
|
||||
if err != nil {
|
||||
return Net{}, err
|
||||
}
|
||||
return Net{p: unsafe.Pointer(C.Net_ReadNetFromCaffeBytes(*bPrototxt, *bCaffeModel))}, nil
|
||||
}
|
||||
|
||||
// ReadNetFromTensorflow reads a network model stored in Tensorflow framework's format.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d6/d0f/group__dnn.html#gad820b280978d06773234ba6841e77e8d
|
||||
//
|
||||
func ReadNetFromTensorflow(model string) Net {
|
||||
cmodel := C.CString(model)
|
||||
defer C.free(unsafe.Pointer(cmodel))
|
||||
return Net{p: unsafe.Pointer(C.Net_ReadNetFromTensorflow(cmodel))}
|
||||
}
|
||||
|
||||
// ReadNetFromTensorflowBytes reads a network model stored in Tensorflow framework's format.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d6/d0f/group__dnn.html#gacdba30a7c20db2788efbf5bb16a7884d
|
||||
//
|
||||
func ReadNetFromTensorflowBytes(model []byte) (Net, error) {
|
||||
bModel, err := toByteArray(model)
|
||||
if err != nil {
|
||||
return Net{}, err
|
||||
}
|
||||
return Net{p: unsafe.Pointer(C.Net_ReadNetFromTensorflowBytes(*bModel))}, nil
|
||||
}
|
||||
|
||||
// ReadNetFromTorch reads a network model stored in Torch framework's format (t7).
|
||||
// check net.Empty() for read failure
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d6/d0f/group__dnn.html#gaaaed8c8530e9e92fe6647700c13d961e
|
||||
//
|
||||
func ReadNetFromTorch(model string) Net {
|
||||
cmodel := C.CString(model)
|
||||
defer C.free(unsafe.Pointer(cmodel))
|
||||
return Net{p: unsafe.Pointer(C.Net_ReadNetFromTorch(cmodel))}
|
||||
}
|
||||
|
||||
// ReadNetFromONNX reads a network model stored in ONNX framework's format.
|
||||
// check net.Empty() for read failure
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d6/d0f/group__dnn.html#ga7faea56041d10c71dbbd6746ca854197
|
||||
//
|
||||
func ReadNetFromONNX(model string) Net {
|
||||
cmodel := C.CString(model)
|
||||
defer C.free(unsafe.Pointer(cmodel))
|
||||
return Net{p: unsafe.Pointer(C.Net_ReadNetFromONNX(cmodel))}
|
||||
}
|
||||
|
||||
// ReadNetFromONNXBytes reads a network model stored in ONNX framework's format.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d6/d0f/group__dnn.html#ga9198ecaac7c32ddf0aa7a1bcbd359567
|
||||
//
|
||||
func ReadNetFromONNXBytes(model []byte) (Net, error) {
|
||||
bModel, err := toByteArray(model)
|
||||
if err != nil {
|
||||
return Net{}, err
|
||||
}
|
||||
return Net{p: unsafe.Pointer(C.Net_ReadNetFromONNXBytes(*bModel))}, nil
|
||||
}
|
||||
|
||||
// BlobFromImage creates 4-dimensional blob from image. Optionally resizes and crops
|
||||
// image from center, subtract mean values, scales values by scalefactor,
|
||||
// swap Blue and Red channels.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/trunk/d6/d0f/group__dnn.html#ga152367f253c81b53fe6862b299f5c5cd
|
||||
//
|
||||
func BlobFromImage(img Mat, scaleFactor float64, size image.Point, mean Scalar,
|
||||
swapRB bool, crop bool) Mat {
|
||||
|
||||
sz := C.struct_Size{
|
||||
width: C.int(size.X),
|
||||
height: C.int(size.Y),
|
||||
}
|
||||
|
||||
sMean := C.struct_Scalar{
|
||||
val1: C.double(mean.Val1),
|
||||
val2: C.double(mean.Val2),
|
||||
val3: C.double(mean.Val3),
|
||||
val4: C.double(mean.Val4),
|
||||
}
|
||||
|
||||
return newMat(C.Net_BlobFromImage(img.p, C.double(scaleFactor), sz, sMean, C.bool(swapRB), C.bool(crop)))
|
||||
}
|
||||
|
||||
// BlobFromImages Creates 4-dimensional blob from series of images.
|
||||
// Optionally resizes and crops images from center, subtract mean values,
|
||||
// scales values by scalefactor, swap Blue and Red channels.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d6/d0f/group__dnn.html#ga2b89ed84432e4395f5a1412c2926293c
|
||||
//
|
||||
func BlobFromImages(imgs []Mat, blob *Mat, scaleFactor float64, size image.Point, mean Scalar,
|
||||
swapRB bool, crop bool, ddepth MatType) {
|
||||
|
||||
cMatArray := make([]C.Mat, len(imgs))
|
||||
for i, r := range imgs {
|
||||
cMatArray[i] = r.p
|
||||
}
|
||||
|
||||
cMats := C.struct_Mats{
|
||||
mats: (*C.Mat)(&cMatArray[0]),
|
||||
length: C.int(len(imgs)),
|
||||
}
|
||||
|
||||
sz := C.struct_Size{
|
||||
width: C.int(size.X),
|
||||
height: C.int(size.Y),
|
||||
}
|
||||
|
||||
sMean := C.struct_Scalar{
|
||||
val1: C.double(mean.Val1),
|
||||
val2: C.double(mean.Val2),
|
||||
val3: C.double(mean.Val3),
|
||||
val4: C.double(mean.Val4),
|
||||
}
|
||||
|
||||
C.Net_BlobFromImages(cMats, blob.p, C.double(scaleFactor), sz, sMean, C.bool(swapRB), C.bool(crop), C.int(ddepth))
|
||||
}
|
||||
|
||||
// ImagesFromBlob Parse a 4D blob and output the images it contains as
|
||||
// 2D arrays through a simpler data structure (std::vector<cv::Mat>).
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d6/d0f/group__dnn.html#ga4051b5fa2ed5f54b76c059a8625df9f5
|
||||
//
|
||||
func ImagesFromBlob(blob Mat, imgs []Mat) {
|
||||
cMats := C.struct_Mats{}
|
||||
C.Net_ImagesFromBlob(blob.p, &(cMats))
|
||||
// mv = make([]Mat, cMats.length)
|
||||
for i := C.int(0); i < cMats.length; i++ {
|
||||
imgs[i].p = C.Mats_get(cMats, i)
|
||||
}
|
||||
}
|
||||
|
||||
// GetBlobChannel extracts a single (2d)channel from a 4 dimensional blob structure
|
||||
// (this might e.g. contain the results of a SSD or YOLO detection,
|
||||
// a bones structure from pose detection, or a color plane from Colorization)
|
||||
//
|
||||
func GetBlobChannel(blob Mat, imgidx int, chnidx int) Mat {
|
||||
return newMat(C.Net_GetBlobChannel(blob.p, C.int(imgidx), C.int(chnidx)))
|
||||
}
|
||||
|
||||
// GetBlobSize retrieves the 4 dimensional size information in (N,C,H,W) order
|
||||
//
|
||||
func GetBlobSize(blob Mat) Scalar {
|
||||
s := C.Net_GetBlobSize(blob.p)
|
||||
return NewScalar(float64(s.val1), float64(s.val2), float64(s.val3), float64(s.val4))
|
||||
}
|
||||
|
||||
// Layer is a wrapper around the cv::dnn::Layer algorithm.
|
||||
type Layer struct {
|
||||
// C.Layer
|
||||
p unsafe.Pointer
|
||||
}
|
||||
|
||||
// GetLayer returns pointer to layer with specified id from the network.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/db/d30/classcv_1_1dnn_1_1Net.html#a70aec7f768f38c32b1ee25f3a56526df
|
||||
//
|
||||
func (net *Net) GetLayer(layer int) Layer {
|
||||
return Layer{p: unsafe.Pointer(C.Net_GetLayer((C.Net)(net.p), C.int(layer)))}
|
||||
}
|
||||
|
||||
// GetPerfProfile returns overall time for inference and timings (in ticks) for layers
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/db/d30/classcv_1_1dnn_1_1Net.html#a06ce946f675f75d1c020c5ddbc78aedc
|
||||
//
|
||||
func (net *Net) GetPerfProfile() float64 {
|
||||
return float64(C.Net_GetPerfProfile((C.Net)(net.p)))
|
||||
}
|
||||
|
||||
// GetUnconnectedOutLayers returns indexes of layers with unconnected outputs.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/db/d30/classcv_1_1dnn_1_1Net.html#ae62a73984f62c49fd3e8e689405b056a
|
||||
//
|
||||
func (net *Net) GetUnconnectedOutLayers() (ids []int) {
|
||||
cids := C.IntVector{}
|
||||
C.Net_GetUnconnectedOutLayers((C.Net)(net.p), &cids)
|
||||
defer C.free(unsafe.Pointer(cids.val))
|
||||
|
||||
h := &reflect.SliceHeader{
|
||||
Data: uintptr(unsafe.Pointer(cids.val)),
|
||||
Len: int(cids.length),
|
||||
Cap: int(cids.length),
|
||||
}
|
||||
pcids := *(*[]C.int)(unsafe.Pointer(h))
|
||||
|
||||
for i := 0; i < int(cids.length); i++ {
|
||||
ids = append(ids, int(pcids[i]))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// GetLayerNames returns all layer names.
|
||||
//
|
||||
// For furtherdetails, please see:
|
||||
// https://docs.opencv.org/master/db/d30/classcv_1_1dnn_1_1Net.html#ae8be9806024a0d1d41aba687cce99e6b
|
||||
//
|
||||
func (net *Net) GetLayerNames() (names []string) {
|
||||
cstrs := C.CStrings{}
|
||||
defer C.CStrings_Close(cstrs)
|
||||
C.Net_GetLayerNames((C.Net)(net.p), &cstrs)
|
||||
return toGoStrings(cstrs)
|
||||
}
|
||||
|
||||
// Close Layer
|
||||
func (l *Layer) Close() error {
|
||||
C.Layer_Close((C.Layer)(l.p))
|
||||
l.p = nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetName returns name for this layer.
|
||||
func (l *Layer) GetName() string {
|
||||
return C.GoString(C.Layer_GetName((C.Layer)(l.p)))
|
||||
}
|
||||
|
||||
// GetType returns type for this layer.
|
||||
func (l *Layer) GetType() string {
|
||||
return C.GoString(C.Layer_GetType((C.Layer)(l.p)))
|
||||
}
|
||||
|
||||
// InputNameToIndex returns index of input blob in input array.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d3/d6c/classcv_1_1dnn_1_1Layer.html#a60ffc8238f3fa26cd3f49daa7ac0884b
|
||||
//
|
||||
func (l *Layer) InputNameToIndex(name string) int {
|
||||
cName := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
return int(C.Layer_InputNameToIndex((C.Layer)(l.p), cName))
|
||||
}
|
||||
|
||||
// OutputNameToIndex returns index of output blob in output array.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d3/d6c/classcv_1_1dnn_1_1Layer.html#a60ffc8238f3fa26cd3f49daa7ac0884b
|
||||
//
|
||||
func (l *Layer) OutputNameToIndex(name string) int {
|
||||
cName := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
return int(C.Layer_OutputNameToIndex((C.Layer)(l.p), cName))
|
||||
}
|
||||
|
||||
// NMSBoxes performs non maximum suppression given boxes and corresponding scores.
|
||||
//
|
||||
// For futher details, please see:
|
||||
// https://docs.opencv.org/4.4.0/d6/d0f/group__dnn.html#ga9d118d70a1659af729d01b10233213ee
|
||||
func NMSBoxes(bboxes []image.Rectangle, scores []float32, scoreThreshold float32, nmsThreshold float32, indices []int) {
|
||||
bboxesRectArr := []C.struct_Rect{}
|
||||
for _, v := range bboxes {
|
||||
bbox := C.struct_Rect{
|
||||
x: C.int(v.Min.X),
|
||||
y: C.int(v.Min.Y),
|
||||
width: C.int(v.Size().X),
|
||||
height: C.int(v.Size().Y),
|
||||
}
|
||||
bboxesRectArr = append(bboxesRectArr, bbox)
|
||||
}
|
||||
|
||||
bboxesRects := C.Rects{
|
||||
rects: (*C.Rect)(&bboxesRectArr[0]),
|
||||
length: C.int(len(bboxes)),
|
||||
}
|
||||
|
||||
scoresFloats := []C.float{}
|
||||
for _, v := range scores {
|
||||
scoresFloats = append(scoresFloats, C.float(v))
|
||||
}
|
||||
scoresVector := C.struct_FloatVector{}
|
||||
scoresVector.val = (*C.float)(&scoresFloats[0])
|
||||
scoresVector.length = (C.int)(len(scoresFloats))
|
||||
|
||||
indicesVector := C.IntVector{}
|
||||
|
||||
C.NMSBoxes(bboxesRects, scoresVector, C.float(scoreThreshold), C.float(nmsThreshold), &indicesVector)
|
||||
defer C.free(unsafe.Pointer(indicesVector.val))
|
||||
|
||||
h := &reflect.SliceHeader{
|
||||
Data: uintptr(unsafe.Pointer(indicesVector.val)),
|
||||
Len: int(indicesVector.length),
|
||||
Cap: int(indicesVector.length),
|
||||
}
|
||||
|
||||
ptr := *(*[]C.int)(unsafe.Pointer(h))
|
||||
|
||||
for i := 0; i < int(indicesVector.length); i++ {
|
||||
indices[i] = int(ptr[i])
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// NMSBoxesWithParams performs non maximum suppression given boxes and corresponding scores.
|
||||
//
|
||||
// For futher details, please see:
|
||||
// https://docs.opencv.org/4.4.0/d6/d0f/group__dnn.html#ga9d118d70a1659af729d01b10233213ee
|
||||
func NMSBoxesWithParams(bboxes []image.Rectangle, scores []float32, scoreThreshold float32, nmsThreshold float32, indices []int, eta float32, topK int) {
|
||||
bboxesRectArr := []C.struct_Rect{}
|
||||
for _, v := range bboxes {
|
||||
bbox := C.struct_Rect{
|
||||
x: C.int(v.Min.X),
|
||||
y: C.int(v.Min.Y),
|
||||
width: C.int(v.Size().X),
|
||||
height: C.int(v.Size().Y),
|
||||
}
|
||||
bboxesRectArr = append(bboxesRectArr, bbox)
|
||||
}
|
||||
|
||||
bboxesRects := C.Rects{
|
||||
rects: (*C.Rect)(&bboxesRectArr[0]),
|
||||
length: C.int(len(bboxes)),
|
||||
}
|
||||
|
||||
scoresFloats := []C.float{}
|
||||
for _, v := range scores {
|
||||
scoresFloats = append(scoresFloats, C.float(v))
|
||||
}
|
||||
scoresVector := C.struct_FloatVector{}
|
||||
scoresVector.val = (*C.float)(&scoresFloats[0])
|
||||
scoresVector.length = (C.int)(len(scoresFloats))
|
||||
|
||||
indicesVector := C.IntVector{}
|
||||
|
||||
C.NMSBoxesWithParams(bboxesRects, scoresVector, C.float(scoreThreshold), C.float(nmsThreshold), &indicesVector, C.float(eta), C.int(topK))
|
||||
defer C.free(unsafe.Pointer(indicesVector.val))
|
||||
|
||||
h := &reflect.SliceHeader{
|
||||
Data: uintptr(unsafe.Pointer(indicesVector.val)),
|
||||
Len: int(indicesVector.length),
|
||||
Cap: int(indicesVector.length),
|
||||
}
|
||||
|
||||
ptr := *(*[]C.int)(unsafe.Pointer(h))
|
||||
|
||||
for i := 0; i < int(indicesVector.length); i++ {
|
||||
indices[i] = int(ptr[i])
|
||||
}
|
||||
return
|
||||
}
|
64
vendor/gocv.io/x/gocv/dnn.h
generated
vendored
64
vendor/gocv.io/x/gocv/dnn.h
generated
vendored
@ -1,64 +0,0 @@
|
||||
#ifndef _OPENCV3_DNN_H_
|
||||
#define _OPENCV3_DNN_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <opencv2/dnn.hpp>
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "core.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
typedef cv::dnn::Net* Net;
|
||||
typedef cv::Ptr<cv::dnn::Layer>* Layer;
|
||||
#else
|
||||
typedef void* Net;
|
||||
typedef void* Layer;
|
||||
#endif
|
||||
|
||||
Net Net_ReadNet(const char* model, const char* config);
|
||||
Net Net_ReadNetBytes(const char* framework, struct ByteArray model, struct ByteArray config);
|
||||
Net Net_ReadNetFromCaffe(const char* prototxt, const char* caffeModel);
|
||||
Net Net_ReadNetFromCaffeBytes(struct ByteArray prototxt, struct ByteArray caffeModel);
|
||||
Net Net_ReadNetFromTensorflow(const char* model);
|
||||
Net Net_ReadNetFromTensorflowBytes(struct ByteArray model);
|
||||
Net Net_ReadNetFromTorch(const char* model);
|
||||
Net Net_ReadNetFromONNX(const char* model);
|
||||
Net Net_ReadNetFromONNXBytes(struct ByteArray model);
|
||||
Mat Net_BlobFromImage(Mat image, double scalefactor, Size size, Scalar mean, bool swapRB,
|
||||
bool crop);
|
||||
void Net_BlobFromImages(struct Mats images, Mat blob, double scalefactor, Size size,
|
||||
Scalar mean, bool swapRB, bool crop, int ddepth);
|
||||
void Net_ImagesFromBlob(Mat blob_, struct Mats* images_);
|
||||
void Net_Close(Net net);
|
||||
bool Net_Empty(Net net);
|
||||
void Net_SetInput(Net net, Mat blob, const char* name);
|
||||
Mat Net_Forward(Net net, const char* outputName);
|
||||
void Net_ForwardLayers(Net net, struct Mats* outputBlobs, struct CStrings outBlobNames);
|
||||
void Net_SetPreferableBackend(Net net, int backend);
|
||||
void Net_SetPreferableTarget(Net net, int target);
|
||||
int64_t Net_GetPerfProfile(Net net);
|
||||
void Net_GetUnconnectedOutLayers(Net net, IntVector* res);
|
||||
void Net_GetLayerNames(Net net, CStrings* names);
|
||||
|
||||
Mat Net_GetBlobChannel(Mat blob, int imgidx, int chnidx);
|
||||
Scalar Net_GetBlobSize(Mat blob);
|
||||
|
||||
Layer Net_GetLayer(Net net, int layerid);
|
||||
void Layer_Close(Layer layer);
|
||||
int Layer_InputNameToIndex(Layer layer, const char* name);
|
||||
int Layer_OutputNameToIndex(Layer layer, const char* name);
|
||||
const char* Layer_GetName(Layer layer);
|
||||
const char* Layer_GetType(Layer layer);
|
||||
|
||||
void NMSBoxes(struct Rects bboxes, FloatVector scores, float score_threshold, float nms_threshold, IntVector* indices);
|
||||
void NMSBoxesWithParams(struct Rects bboxes, FloatVector scores, const float score_threshold, const float nms_threshold, IntVector* indices, const float eta, const int top_k);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //_OPENCV3_DNN_H_
|
26
vendor/gocv.io/x/gocv/dnn_async_openvino.go
generated
vendored
26
vendor/gocv.io/x/gocv/dnn_async_openvino.go
generated
vendored
@ -1,26 +0,0 @@
|
||||
// +build openvino
|
||||
|
||||
package gocv
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
/*
|
||||
#include <stdlib.h>
|
||||
#include "dnn.h"
|
||||
#include "asyncarray.h"
|
||||
*/
|
||||
import "C"
|
||||
|
||||
// ForwardAsync runs forward pass to compute output of layer with name outputName.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/trunk/db/d30/classcv_1_1dnn_1_1Net.html#a814890154ea9e10b132fec00b6f6ba30
|
||||
//
|
||||
func (net *Net) ForwardAsync(outputName string) AsyncArray {
|
||||
cName := C.CString(outputName)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
return newAsyncArray(C.Net_forwardAsync((C.Net)(net.p), cName))
|
||||
}
|
67
vendor/gocv.io/x/gocv/dnn_ext.go
generated
vendored
67
vendor/gocv.io/x/gocv/dnn_ext.go
generated
vendored
@ -1,67 +0,0 @@
|
||||
package gocv
|
||||
|
||||
import (
|
||||
"image"
|
||||
)
|
||||
|
||||
// FP16BlobFromImage is an extended helper function to convert an Image to a half-float blob, as used by
|
||||
// the Movidius Neural Compute Stick.
|
||||
func FP16BlobFromImage(img Mat, scaleFactor float32, size image.Point, mean float32,
|
||||
swapRB bool, crop bool) []byte {
|
||||
|
||||
// resizes image so it maintains aspect ratio
|
||||
width := float32(img.Cols())
|
||||
height := float32(img.Rows())
|
||||
|
||||
square := NewMatWithSize(size.Y, size.X, img.Type())
|
||||
defer square.Close()
|
||||
|
||||
maxDim := height
|
||||
var scale float32 = 1.0
|
||||
if width > height {
|
||||
maxDim = width
|
||||
scale = float32(size.X) / float32(maxDim)
|
||||
}
|
||||
if width < height {
|
||||
scale = float32(size.Y) / float32(maxDim)
|
||||
}
|
||||
|
||||
var roi image.Rectangle
|
||||
if width >= height {
|
||||
roi.Min.X = 0
|
||||
roi.Min.Y = int(float32(size.Y)-height*scale) / 2
|
||||
roi.Max.X = size.X
|
||||
roi.Max.Y = int(height * scale)
|
||||
} else {
|
||||
roi.Min.X = int(float32(size.X)-width*scale) / 2
|
||||
roi.Min.Y = 0
|
||||
roi.Max.X = int(width * scale)
|
||||
roi.Max.Y = size.Y
|
||||
}
|
||||
|
||||
Resize(img, &square, roi.Max, 0, 0, InterpolationDefault)
|
||||
|
||||
if swapRB {
|
||||
CvtColor(square, &square, ColorBGRToRGB)
|
||||
}
|
||||
|
||||
fp32Image := NewMat()
|
||||
defer fp32Image.Close()
|
||||
|
||||
square.ConvertTo(&fp32Image, MatTypeCV32F)
|
||||
|
||||
if mean != 0 {
|
||||
// subtract mean
|
||||
fp32Image.SubtractFloat(mean)
|
||||
}
|
||||
|
||||
if scaleFactor != 1.0 {
|
||||
// multiply by scale factor
|
||||
fp32Image.MultiplyFloat(scaleFactor)
|
||||
}
|
||||
|
||||
fp16Blob := fp32Image.ConvertFp16()
|
||||
defer fp16Blob.Close()
|
||||
|
||||
return fp16Blob.ToBytes()
|
||||
}
|
41
vendor/gocv.io/x/gocv/dnn_string.go
generated
vendored
41
vendor/gocv.io/x/gocv/dnn_string.go
generated
vendored
@ -1,41 +0,0 @@
|
||||
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"
|
||||
case NetBackendCUDA:
|
||||
return "cuda"
|
||||
}
|
||||
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"
|
||||
case NetTargetCUDA:
|
||||
return "cuda"
|
||||
case NetTargetCUDAFP16:
|
||||
return "cudafp16"
|
||||
}
|
||||
return ""
|
||||
}
|
2
vendor/gocv.io/x/gocv/env.cmd
generated
vendored
2
vendor/gocv.io/x/gocv/env.cmd
generated
vendored
@ -1,2 +0,0 @@
|
||||
ECHO This script is no longer necessary and has been deprecated.
|
||||
ECHO See the Custom Environment section of the README if you need to customize your environment.
|
2
vendor/gocv.io/x/gocv/env.sh
generated
vendored
2
vendor/gocv.io/x/gocv/env.sh
generated
vendored
@ -1,2 +0,0 @@
|
||||
echo "This script is no longer necessary and has been deprecated."
|
||||
echo "See the Custom Environment section of the README if you need to customize your environment."
|
559
vendor/gocv.io/x/gocv/features2d.cpp
generated
vendored
559
vendor/gocv.io/x/gocv/features2d.cpp
generated
vendored
@ -1,559 +0,0 @@
|
||||
#include "features2d.h"
|
||||
|
||||
AKAZE AKAZE_Create() {
|
||||
// TODO: params
|
||||
return new cv::Ptr<cv::AKAZE>(cv::AKAZE::create());
|
||||
}
|
||||
|
||||
void AKAZE_Close(AKAZE a) {
|
||||
delete a;
|
||||
}
|
||||
|
||||
struct KeyPoints AKAZE_Detect(AKAZE a, Mat src) {
|
||||
std::vector<cv::KeyPoint> detected;
|
||||
(*a)->detect(*src, detected);
|
||||
|
||||
KeyPoint* kps = new KeyPoint[detected.size()];
|
||||
|
||||
for (size_t i = 0; i < detected.size(); ++i) {
|
||||
KeyPoint k = {detected[i].pt.x, detected[i].pt.y, detected[i].size, detected[i].angle,
|
||||
detected[i].response, detected[i].octave, detected[i].class_id
|
||||
};
|
||||
kps[i] = k;
|
||||
}
|
||||
|
||||
KeyPoints ret = {kps, (int)detected.size()};
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct KeyPoints AKAZE_DetectAndCompute(AKAZE a, Mat src, Mat mask, Mat desc) {
|
||||
std::vector<cv::KeyPoint> detected;
|
||||
(*a)->detectAndCompute(*src, *mask, detected, *desc);
|
||||
|
||||
KeyPoint* kps = new KeyPoint[detected.size()];
|
||||
|
||||
for (size_t i = 0; i < detected.size(); ++i) {
|
||||
KeyPoint k = {detected[i].pt.x, detected[i].pt.y, detected[i].size, detected[i].angle,
|
||||
detected[i].response, detected[i].octave, detected[i].class_id
|
||||
};
|
||||
kps[i] = k;
|
||||
}
|
||||
|
||||
KeyPoints ret = {kps, (int)detected.size()};
|
||||
return ret;
|
||||
}
|
||||
|
||||
AgastFeatureDetector AgastFeatureDetector_Create() {
|
||||
// TODO: params
|
||||
return new cv::Ptr<cv::AgastFeatureDetector>(cv::AgastFeatureDetector::create());
|
||||
}
|
||||
|
||||
void AgastFeatureDetector_Close(AgastFeatureDetector a) {
|
||||
delete a;
|
||||
}
|
||||
|
||||
struct KeyPoints AgastFeatureDetector_Detect(AgastFeatureDetector a, Mat src) {
|
||||
std::vector<cv::KeyPoint> detected;
|
||||
(*a)->detect(*src, detected);
|
||||
|
||||
KeyPoint* kps = new KeyPoint[detected.size()];
|
||||
|
||||
for (size_t i = 0; i < detected.size(); ++i) {
|
||||
KeyPoint k = {detected[i].pt.x, detected[i].pt.y, detected[i].size, detected[i].angle,
|
||||
detected[i].response, detected[i].octave, detected[i].class_id
|
||||
};
|
||||
kps[i] = k;
|
||||
}
|
||||
|
||||
KeyPoints ret = {kps, (int)detected.size()};
|
||||
return ret;
|
||||
}
|
||||
|
||||
BRISK BRISK_Create() {
|
||||
// TODO: params
|
||||
return new cv::Ptr<cv::BRISK>(cv::BRISK::create());
|
||||
}
|
||||
|
||||
void BRISK_Close(BRISK b) {
|
||||
delete b;
|
||||
}
|
||||
|
||||
struct KeyPoints BRISK_Detect(BRISK b, Mat src) {
|
||||
std::vector<cv::KeyPoint> detected;
|
||||
(*b)->detect(*src, detected);
|
||||
|
||||
KeyPoint* kps = new KeyPoint[detected.size()];
|
||||
|
||||
for (size_t i = 0; i < detected.size(); ++i) {
|
||||
KeyPoint k = {detected[i].pt.x, detected[i].pt.y, detected[i].size, detected[i].angle,
|
||||
detected[i].response, detected[i].octave, detected[i].class_id
|
||||
};
|
||||
kps[i] = k;
|
||||
}
|
||||
|
||||
KeyPoints ret = {kps, (int)detected.size()};
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct KeyPoints BRISK_DetectAndCompute(BRISK b, Mat src, Mat mask, Mat desc) {
|
||||
std::vector<cv::KeyPoint> detected;
|
||||
(*b)->detectAndCompute(*src, *mask, detected, *desc);
|
||||
|
||||
KeyPoint* kps = new KeyPoint[detected.size()];
|
||||
|
||||
for (size_t i = 0; i < detected.size(); ++i) {
|
||||
KeyPoint k = {detected[i].pt.x, detected[i].pt.y, detected[i].size, detected[i].angle,
|
||||
detected[i].response, detected[i].octave, detected[i].class_id
|
||||
};
|
||||
kps[i] = k;
|
||||
}
|
||||
|
||||
KeyPoints ret = {kps, (int)detected.size()};
|
||||
return ret;
|
||||
}
|
||||
|
||||
GFTTDetector GFTTDetector_Create() {
|
||||
// TODO: params
|
||||
return new cv::Ptr<cv::GFTTDetector>(cv::GFTTDetector::create());
|
||||
}
|
||||
|
||||
void GFTTDetector_Close(GFTTDetector a) {
|
||||
delete a;
|
||||
}
|
||||
|
||||
struct KeyPoints GFTTDetector_Detect(GFTTDetector a, Mat src) {
|
||||
std::vector<cv::KeyPoint> detected;
|
||||
(*a)->detect(*src, detected);
|
||||
|
||||
KeyPoint* kps = new KeyPoint[detected.size()];
|
||||
|
||||
for (size_t i = 0; i < detected.size(); ++i) {
|
||||
KeyPoint k = {detected[i].pt.x, detected[i].pt.y, detected[i].size, detected[i].angle,
|
||||
detected[i].response, detected[i].octave, detected[i].class_id
|
||||
};
|
||||
kps[i] = k;
|
||||
}
|
||||
|
||||
KeyPoints ret = {kps, (int)detected.size()};
|
||||
return ret;
|
||||
}
|
||||
|
||||
KAZE KAZE_Create() {
|
||||
// TODO: params
|
||||
return new cv::Ptr<cv::KAZE>(cv::KAZE::create());
|
||||
}
|
||||
|
||||
void KAZE_Close(KAZE a) {
|
||||
delete a;
|
||||
}
|
||||
|
||||
struct KeyPoints KAZE_Detect(KAZE a, Mat src) {
|
||||
std::vector<cv::KeyPoint> detected;
|
||||
(*a)->detect(*src, detected);
|
||||
|
||||
KeyPoint* kps = new KeyPoint[detected.size()];
|
||||
|
||||
for (size_t i = 0; i < detected.size(); ++i) {
|
||||
KeyPoint k = {detected[i].pt.x, detected[i].pt.y, detected[i].size, detected[i].angle,
|
||||
detected[i].response, detected[i].octave, detected[i].class_id
|
||||
};
|
||||
kps[i] = k;
|
||||
}
|
||||
|
||||
KeyPoints ret = {kps, (int)detected.size()};
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct KeyPoints KAZE_DetectAndCompute(KAZE a, Mat src, Mat mask, Mat desc) {
|
||||
std::vector<cv::KeyPoint> detected;
|
||||
(*a)->detectAndCompute(*src, *mask, detected, *desc);
|
||||
|
||||
KeyPoint* kps = new KeyPoint[detected.size()];
|
||||
|
||||
for (size_t i = 0; i < detected.size(); ++i) {
|
||||
KeyPoint k = {detected[i].pt.x, detected[i].pt.y, detected[i].size, detected[i].angle,
|
||||
detected[i].response, detected[i].octave, detected[i].class_id
|
||||
};
|
||||
kps[i] = k;
|
||||
}
|
||||
|
||||
KeyPoints ret = {kps, (int)detected.size()};
|
||||
return ret;
|
||||
}
|
||||
|
||||
MSER MSER_Create() {
|
||||
// TODO: params
|
||||
return new cv::Ptr<cv::MSER>(cv::MSER::create());
|
||||
}
|
||||
|
||||
void MSER_Close(MSER a) {
|
||||
delete a;
|
||||
}
|
||||
|
||||
struct KeyPoints MSER_Detect(MSER a, Mat src) {
|
||||
std::vector<cv::KeyPoint> detected;
|
||||
(*a)->detect(*src, detected);
|
||||
|
||||
KeyPoint* kps = new KeyPoint[detected.size()];
|
||||
|
||||
for (size_t i = 0; i < detected.size(); ++i) {
|
||||
KeyPoint k = {detected[i].pt.x, detected[i].pt.y, detected[i].size, detected[i].angle,
|
||||
detected[i].response, detected[i].octave, detected[i].class_id
|
||||
};
|
||||
kps[i] = k;
|
||||
}
|
||||
|
||||
KeyPoints ret = {kps, (int)detected.size()};
|
||||
return ret;
|
||||
}
|
||||
|
||||
FastFeatureDetector FastFeatureDetector_Create() {
|
||||
return new cv::Ptr<cv::FastFeatureDetector>(cv::FastFeatureDetector::create());
|
||||
}
|
||||
|
||||
void FastFeatureDetector_Close(FastFeatureDetector f) {
|
||||
delete f;
|
||||
}
|
||||
|
||||
FastFeatureDetector FastFeatureDetector_CreateWithParams(int threshold, bool nonmaxSuppression, int type) {
|
||||
return new cv::Ptr<cv::FastFeatureDetector>(cv::FastFeatureDetector::create(threshold,nonmaxSuppression,static_cast<cv::FastFeatureDetector::DetectorType>(type)));
|
||||
}
|
||||
|
||||
struct KeyPoints FastFeatureDetector_Detect(FastFeatureDetector f, Mat src) {
|
||||
std::vector<cv::KeyPoint> detected;
|
||||
(*f)->detect(*src, detected);
|
||||
|
||||
KeyPoint* kps = new KeyPoint[detected.size()];
|
||||
|
||||
for (size_t i = 0; i < detected.size(); ++i) {
|
||||
KeyPoint k = {detected[i].pt.x, detected[i].pt.y, detected[i].size, detected[i].angle,
|
||||
detected[i].response, detected[i].octave, detected[i].class_id
|
||||
};
|
||||
kps[i] = k;
|
||||
}
|
||||
|
||||
KeyPoints ret = {kps, (int)detected.size()};
|
||||
return ret;
|
||||
}
|
||||
|
||||
ORB ORB_Create() {
|
||||
return new cv::Ptr<cv::ORB>(cv::ORB::create());
|
||||
}
|
||||
|
||||
ORB ORB_CreateWithParams(int nfeatures, float scaleFactor, int nlevels, int edgeThreshold, int firstLevel, int WTA_K, int scoreType, int patchSize, int fastThreshold) {
|
||||
return new cv::Ptr<cv::ORB>(cv::ORB::create(nfeatures, scaleFactor, nlevels, edgeThreshold, firstLevel, WTA_K, static_cast<cv::ORB::ScoreType>(scoreType), patchSize, fastThreshold));
|
||||
}
|
||||
|
||||
void ORB_Close(ORB o) {
|
||||
delete o;
|
||||
}
|
||||
|
||||
struct KeyPoints ORB_Detect(ORB o, Mat src) {
|
||||
std::vector<cv::KeyPoint> detected;
|
||||
(*o)->detect(*src, detected);
|
||||
|
||||
KeyPoint* kps = new KeyPoint[detected.size()];
|
||||
|
||||
for (size_t i = 0; i < detected.size(); ++i) {
|
||||
KeyPoint k = {detected[i].pt.x, detected[i].pt.y, detected[i].size, detected[i].angle,
|
||||
detected[i].response, detected[i].octave, detected[i].class_id
|
||||
};
|
||||
kps[i] = k;
|
||||
}
|
||||
|
||||
KeyPoints ret = {kps, (int)detected.size()};
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct KeyPoints ORB_DetectAndCompute(ORB o, Mat src, Mat mask, Mat desc) {
|
||||
std::vector<cv::KeyPoint> detected;
|
||||
(*o)->detectAndCompute(*src, *mask, detected, *desc);
|
||||
|
||||
KeyPoint* kps = new KeyPoint[detected.size()];
|
||||
|
||||
for (size_t i = 0; i < detected.size(); ++i) {
|
||||
KeyPoint k = {detected[i].pt.x, detected[i].pt.y, detected[i].size, detected[i].angle,
|
||||
detected[i].response, detected[i].octave, detected[i].class_id
|
||||
};
|
||||
kps[i] = k;
|
||||
}
|
||||
|
||||
KeyPoints ret = {kps, (int)detected.size()};
|
||||
return ret;
|
||||
}
|
||||
|
||||
cv::SimpleBlobDetector::Params ConvertCParamsToCPPParams(SimpleBlobDetectorParams params) {
|
||||
cv::SimpleBlobDetector::Params converted;
|
||||
|
||||
converted.blobColor = params.blobColor;
|
||||
converted.filterByArea = params.filterByArea;
|
||||
converted.filterByCircularity = params.filterByCircularity;
|
||||
converted.filterByColor = params.filterByColor;
|
||||
converted.filterByConvexity = params.filterByConvexity;
|
||||
converted.filterByInertia = params.filterByInertia;
|
||||
converted.maxArea = params.maxArea;
|
||||
converted.maxCircularity = params.maxCircularity;
|
||||
converted.maxConvexity = params.maxConvexity;
|
||||
converted.maxInertiaRatio = params.maxInertiaRatio;
|
||||
converted.maxThreshold = params.maxThreshold;
|
||||
converted.minArea = params.minArea;
|
||||
converted.minCircularity = params.minCircularity;
|
||||
converted.minConvexity = params.minConvexity;
|
||||
converted.minDistBetweenBlobs = params.minDistBetweenBlobs;
|
||||
converted.minInertiaRatio = params.minInertiaRatio;
|
||||
converted.minRepeatability = params.minRepeatability;
|
||||
converted.minThreshold = params.minThreshold;
|
||||
converted.thresholdStep = params.thresholdStep;
|
||||
|
||||
return converted;
|
||||
}
|
||||
|
||||
SimpleBlobDetectorParams ConvertCPPParamsToCParams(cv::SimpleBlobDetector::Params params) {
|
||||
SimpleBlobDetectorParams converted;
|
||||
|
||||
converted.blobColor = params.blobColor;
|
||||
converted.filterByArea = params.filterByArea;
|
||||
converted.filterByCircularity = params.filterByCircularity;
|
||||
converted.filterByColor = params.filterByColor;
|
||||
converted.filterByConvexity = params.filterByConvexity;
|
||||
converted.filterByInertia = params.filterByInertia;
|
||||
converted.maxArea = params.maxArea;
|
||||
converted.maxCircularity = params.maxCircularity;
|
||||
converted.maxConvexity = params.maxConvexity;
|
||||
converted.maxInertiaRatio = params.maxInertiaRatio;
|
||||
converted.maxThreshold = params.maxThreshold;
|
||||
converted.minArea = params.minArea;
|
||||
converted.minCircularity = params.minCircularity;
|
||||
converted.minConvexity = params.minConvexity;
|
||||
converted.minDistBetweenBlobs = params.minDistBetweenBlobs;
|
||||
converted.minInertiaRatio = params.minInertiaRatio;
|
||||
converted.minRepeatability = params.minRepeatability;
|
||||
converted.minThreshold = params.minThreshold;
|
||||
converted.thresholdStep = params.thresholdStep;
|
||||
|
||||
return converted;
|
||||
}
|
||||
|
||||
SimpleBlobDetector SimpleBlobDetector_Create_WithParams(SimpleBlobDetectorParams params){
|
||||
cv::SimpleBlobDetector::Params actualParams;
|
||||
return new cv::Ptr<cv::SimpleBlobDetector>(cv::SimpleBlobDetector::create(ConvertCParamsToCPPParams(params)));
|
||||
}
|
||||
|
||||
SimpleBlobDetector SimpleBlobDetector_Create() {
|
||||
return new cv::Ptr<cv::SimpleBlobDetector>(cv::SimpleBlobDetector::create());
|
||||
}
|
||||
|
||||
SimpleBlobDetectorParams SimpleBlobDetectorParams_Create() {
|
||||
return ConvertCPPParamsToCParams(cv::SimpleBlobDetector::Params());
|
||||
}
|
||||
|
||||
void SimpleBlobDetector_Close(SimpleBlobDetector b) {
|
||||
delete b;
|
||||
}
|
||||
|
||||
struct KeyPoints SimpleBlobDetector_Detect(SimpleBlobDetector b, Mat src) {
|
||||
std::vector<cv::KeyPoint> detected;
|
||||
(*b)->detect(*src, detected);
|
||||
|
||||
KeyPoint* kps = new KeyPoint[detected.size()];
|
||||
|
||||
for (size_t i = 0; i < detected.size(); ++i) {
|
||||
KeyPoint k = {detected[i].pt.x, detected[i].pt.y, detected[i].size, detected[i].angle,
|
||||
detected[i].response, detected[i].octave, detected[i].class_id
|
||||
};
|
||||
kps[i] = k;
|
||||
}
|
||||
|
||||
KeyPoints ret = {kps, (int)detected.size()};
|
||||
return ret;
|
||||
}
|
||||
|
||||
BFMatcher BFMatcher_Create() {
|
||||
return new cv::Ptr<cv::BFMatcher>(cv::BFMatcher::create());
|
||||
}
|
||||
|
||||
BFMatcher BFMatcher_CreateWithParams(int normType, bool crossCheck) {
|
||||
return new cv::Ptr<cv::BFMatcher>(cv::BFMatcher::create(normType, crossCheck));
|
||||
}
|
||||
|
||||
void BFMatcher_Close(BFMatcher b) {
|
||||
delete b;
|
||||
}
|
||||
|
||||
struct MultiDMatches BFMatcher_KnnMatch(BFMatcher b, Mat query, Mat train, int k) {
|
||||
std::vector< std::vector<cv::DMatch> > matches;
|
||||
(*b)->knnMatch(*query, *train, matches, k);
|
||||
|
||||
DMatches *dms = new DMatches[matches.size()];
|
||||
for (size_t i = 0; i < matches.size(); ++i) {
|
||||
DMatch *dmatches = new DMatch[matches[i].size()];
|
||||
for (size_t j = 0; j < matches[i].size(); ++j) {
|
||||
DMatch dmatch = {matches[i][j].queryIdx, matches[i][j].trainIdx, matches[i][j].imgIdx,
|
||||
matches[i][j].distance};
|
||||
dmatches[j] = dmatch;
|
||||
}
|
||||
dms[i] = {dmatches, (int) matches[i].size()};
|
||||
}
|
||||
MultiDMatches ret = {dms, (int) matches.size()};
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct MultiDMatches BFMatcher_KnnMatchWithParams(BFMatcher b, Mat query, Mat train, int k, Mat mask, bool compactResult) {
|
||||
std::vector< std::vector<cv::DMatch> > matches;
|
||||
(*b)->knnMatch(*query, *train, matches, k, *mask, compactResult);
|
||||
|
||||
DMatches *dms = new DMatches[matches.size()];
|
||||
for (size_t i = 0; i < matches.size(); ++i) {
|
||||
DMatch *dmatches = new DMatch[matches[i].size()];
|
||||
for (size_t j = 0; j < matches[i].size(); ++j) {
|
||||
DMatch dmatch = {matches[i][j].queryIdx, matches[i][j].trainIdx, matches[i][j].imgIdx,
|
||||
matches[i][j].distance};
|
||||
dmatches[j] = dmatch;
|
||||
}
|
||||
dms[i] = {dmatches, (int) matches[i].size()};
|
||||
}
|
||||
MultiDMatches ret = {dms, (int) matches.size()};
|
||||
return ret;
|
||||
}
|
||||
|
||||
FlannBasedMatcher FlannBasedMatcher_Create() {
|
||||
return new cv::Ptr<cv::FlannBasedMatcher>(cv::FlannBasedMatcher::create());
|
||||
}
|
||||
|
||||
void FlannBasedMatcher_Close(FlannBasedMatcher f) {
|
||||
delete f;
|
||||
}
|
||||
|
||||
struct MultiDMatches FlannBasedMatcher_KnnMatch(FlannBasedMatcher f, Mat query, Mat train, int k) {
|
||||
std::vector< std::vector<cv::DMatch> > matches;
|
||||
(*f)->knnMatch(*query, *train, matches, k);
|
||||
|
||||
DMatches *dms = new DMatches[matches.size()];
|
||||
for (size_t i = 0; i < matches.size(); ++i) {
|
||||
DMatch *dmatches = new DMatch[matches[i].size()];
|
||||
for (size_t j = 0; j < matches[i].size(); ++j) {
|
||||
DMatch dmatch = {matches[i][j].queryIdx, matches[i][j].trainIdx, matches[i][j].imgIdx,
|
||||
matches[i][j].distance};
|
||||
dmatches[j] = dmatch;
|
||||
}
|
||||
dms[i] = {dmatches, (int) matches[i].size()};
|
||||
}
|
||||
MultiDMatches ret = {dms, (int) matches.size()};
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct MultiDMatches FlannBasedMatcher_KnnMatchWithParams(FlannBasedMatcher f, Mat query, Mat train, int k, Mat mask, bool compactResult) {
|
||||
std::vector< std::vector<cv::DMatch> > matches;
|
||||
(*f)->knnMatch(*query, *train, matches, k, *mask, compactResult);
|
||||
|
||||
DMatches *dms = new DMatches[matches.size()];
|
||||
for (size_t i = 0; i < matches.size(); ++i) {
|
||||
DMatch *dmatches = new DMatch[matches[i].size()];
|
||||
for (size_t j = 0; j < matches[i].size(); ++j) {
|
||||
DMatch dmatch = {matches[i][j].queryIdx, matches[i][j].trainIdx, matches[i][j].imgIdx,
|
||||
matches[i][j].distance};
|
||||
dmatches[j] = dmatch;
|
||||
}
|
||||
dms[i] = {dmatches, (int) matches[i].size()};
|
||||
}
|
||||
MultiDMatches ret = {dms, (int) matches.size()};
|
||||
return ret;
|
||||
}
|
||||
|
||||
void DrawKeyPoints(Mat src, struct KeyPoints kp, Mat dst, Scalar s, int flags) {
|
||||
std::vector<cv::KeyPoint> keypts;
|
||||
cv::KeyPoint keypt;
|
||||
|
||||
for (int i = 0; i < kp.length; ++i) {
|
||||
keypt = cv::KeyPoint(kp.keypoints[i].x, kp.keypoints[i].y,
|
||||
kp.keypoints[i].size, kp.keypoints[i].angle, kp.keypoints[i].response,
|
||||
kp.keypoints[i].octave, kp.keypoints[i].classID);
|
||||
keypts.push_back(keypt);
|
||||
}
|
||||
|
||||
cv::Scalar color = cv::Scalar(s.val1, s.val2, s.val3, s.val4);
|
||||
|
||||
cv::drawKeypoints(*src, keypts, *dst, color, static_cast<cv::DrawMatchesFlags>(flags));
|
||||
}
|
||||
|
||||
SIFT SIFT_Create() {
|
||||
// TODO: params
|
||||
return new cv::Ptr<cv::SIFT>(cv::SIFT::create());
|
||||
}
|
||||
|
||||
void SIFT_Close(SIFT d) {
|
||||
delete d;
|
||||
}
|
||||
|
||||
struct KeyPoints SIFT_Detect(SIFT d, Mat src) {
|
||||
std::vector<cv::KeyPoint> detected;
|
||||
(*d)->detect(*src, detected);
|
||||
|
||||
KeyPoint* kps = new KeyPoint[detected.size()];
|
||||
|
||||
for (size_t i = 0; i < detected.size(); ++i) {
|
||||
KeyPoint k = {detected[i].pt.x, detected[i].pt.y, detected[i].size, detected[i].angle,
|
||||
detected[i].response, detected[i].octave, detected[i].class_id
|
||||
};
|
||||
kps[i] = k;
|
||||
}
|
||||
|
||||
KeyPoints ret = {kps, (int)detected.size()};
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct KeyPoints SIFT_DetectAndCompute(SIFT d, Mat src, Mat mask, Mat desc) {
|
||||
std::vector<cv::KeyPoint> detected;
|
||||
(*d)->detectAndCompute(*src, *mask, detected, *desc);
|
||||
|
||||
KeyPoint* kps = new KeyPoint[detected.size()];
|
||||
|
||||
for (size_t i = 0; i < detected.size(); ++i) {
|
||||
KeyPoint k = {detected[i].pt.x, detected[i].pt.y, detected[i].size, detected[i].angle,
|
||||
detected[i].response, detected[i].octave, detected[i].class_id
|
||||
};
|
||||
kps[i] = k;
|
||||
}
|
||||
|
||||
KeyPoints ret = {kps, (int)detected.size()};
|
||||
return ret;
|
||||
}
|
||||
|
||||
void DrawMatches(Mat img1, struct KeyPoints kp1, Mat img2, struct KeyPoints kp2, struct DMatches matches1to2, Mat outImg, const Scalar matchesColor, const Scalar pointColor, struct ByteArray matchesMask, int flags) {
|
||||
std::vector<cv::KeyPoint> kp1vec, kp2vec;
|
||||
cv::KeyPoint keypt;
|
||||
|
||||
for (int i = 0; i < kp1.length; ++i) {
|
||||
keypt = cv::KeyPoint(kp1.keypoints[i].x, kp1.keypoints[i].y,
|
||||
kp1.keypoints[i].size, kp1.keypoints[i].angle, kp1.keypoints[i].response,
|
||||
kp1.keypoints[i].octave, kp1.keypoints[i].classID);
|
||||
kp1vec.push_back(keypt);
|
||||
}
|
||||
|
||||
for (int i = 0; i < kp2.length; ++i) {
|
||||
keypt = cv::KeyPoint(kp2.keypoints[i].x, kp2.keypoints[i].y,
|
||||
kp2.keypoints[i].size, kp2.keypoints[i].angle, kp2.keypoints[i].response,
|
||||
kp2.keypoints[i].octave, kp2.keypoints[i].classID);
|
||||
kp2vec.push_back(keypt);
|
||||
}
|
||||
|
||||
cv::Scalar cvmatchescolor = cv::Scalar(matchesColor.val1, matchesColor.val2, matchesColor.val3, matchesColor.val4);
|
||||
cv::Scalar cvpointcolor = cv::Scalar(pointColor.val1, pointColor.val2, pointColor.val3, pointColor.val4);
|
||||
|
||||
std::vector<cv::DMatch> dmatchvec;
|
||||
cv::DMatch dm;
|
||||
|
||||
for (int i = 0; i < matches1to2.length; i++) {
|
||||
dm = cv::DMatch(matches1to2.dmatches[i].queryIdx, matches1to2.dmatches[i].trainIdx,
|
||||
matches1to2.dmatches[i].imgIdx, matches1to2.dmatches[i].distance);
|
||||
dmatchvec.push_back(dm);
|
||||
}
|
||||
|
||||
std::vector<char> maskvec;
|
||||
|
||||
for (int i = 0; i < matchesMask.length; i++) {
|
||||
maskvec.push_back(matchesMask.data[i]);
|
||||
}
|
||||
|
||||
cv::drawMatches(*img1, kp1vec, *img2, kp2vec, dmatchvec, *outImg, cvmatchescolor, cvpointcolor, maskvec, static_cast<cv::DrawMatchesFlags>(flags));
|
||||
}
|
941
vendor/gocv.io/x/gocv/features2d.go
generated
vendored
941
vendor/gocv.io/x/gocv/features2d.go
generated
vendored
@ -1,941 +0,0 @@
|
||||
package gocv
|
||||
|
||||
/*
|
||||
#include <stdlib.h>
|
||||
#include "features2d.h"
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
"image/color"
|
||||
"reflect"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// AKAZE is a wrapper around the cv::AKAZE algorithm.
|
||||
type AKAZE struct {
|
||||
// C.AKAZE
|
||||
p unsafe.Pointer
|
||||
}
|
||||
|
||||
// NewAKAZE returns a new AKAZE algorithm
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d8/d30/classcv_1_1AKAZE.html
|
||||
//
|
||||
func NewAKAZE() AKAZE {
|
||||
return AKAZE{p: unsafe.Pointer(C.AKAZE_Create())}
|
||||
}
|
||||
|
||||
// Close AKAZE.
|
||||
func (a *AKAZE) Close() error {
|
||||
C.AKAZE_Close((C.AKAZE)(a.p))
|
||||
a.p = nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// Detect keypoints in an image using AKAZE.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887
|
||||
//
|
||||
func (a *AKAZE) Detect(src Mat) []KeyPoint {
|
||||
ret := C.AKAZE_Detect((C.AKAZE)(a.p), src.p)
|
||||
defer C.KeyPoints_Close(ret)
|
||||
|
||||
return getKeyPoints(ret)
|
||||
}
|
||||
|
||||
// DetectAndCompute keypoints and compute in an image using AKAZE.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#a8be0d1c20b08eb867184b8d74c15a677
|
||||
//
|
||||
func (a *AKAZE) DetectAndCompute(src Mat, mask Mat) ([]KeyPoint, Mat) {
|
||||
desc := NewMat()
|
||||
ret := C.AKAZE_DetectAndCompute((C.AKAZE)(a.p), src.p, mask.p, desc.p)
|
||||
defer C.KeyPoints_Close(ret)
|
||||
|
||||
return getKeyPoints(ret), desc
|
||||
}
|
||||
|
||||
// AgastFeatureDetector is a wrapper around the cv::AgastFeatureDetector.
|
||||
type AgastFeatureDetector struct {
|
||||
// C.AgastFeatureDetector
|
||||
p unsafe.Pointer
|
||||
}
|
||||
|
||||
// NewAgastFeatureDetector returns a new AgastFeatureDetector algorithm
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d7/d19/classcv_1_1AgastFeatureDetector.html
|
||||
//
|
||||
func NewAgastFeatureDetector() AgastFeatureDetector {
|
||||
return AgastFeatureDetector{p: unsafe.Pointer(C.AgastFeatureDetector_Create())}
|
||||
}
|
||||
|
||||
// Close AgastFeatureDetector.
|
||||
func (a *AgastFeatureDetector) Close() error {
|
||||
C.AgastFeatureDetector_Close((C.AgastFeatureDetector)(a.p))
|
||||
a.p = nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// Detect keypoints in an image using AgastFeatureDetector.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887
|
||||
//
|
||||
func (a *AgastFeatureDetector) Detect(src Mat) []KeyPoint {
|
||||
ret := C.AgastFeatureDetector_Detect((C.AgastFeatureDetector)(a.p), src.p)
|
||||
defer C.KeyPoints_Close(ret)
|
||||
|
||||
return getKeyPoints(ret)
|
||||
}
|
||||
|
||||
// BRISK is a wrapper around the cv::BRISK algorithm.
|
||||
type BRISK struct {
|
||||
// C.BRISK
|
||||
p unsafe.Pointer
|
||||
}
|
||||
|
||||
// NewBRISK returns a new BRISK algorithm
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d8/d30/classcv_1_1AKAZE.html
|
||||
//
|
||||
func NewBRISK() BRISK {
|
||||
return BRISK{p: unsafe.Pointer(C.BRISK_Create())}
|
||||
}
|
||||
|
||||
// Close BRISK.
|
||||
func (b *BRISK) Close() error {
|
||||
C.BRISK_Close((C.BRISK)(b.p))
|
||||
b.p = nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// Detect keypoints in an image using BRISK.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887
|
||||
//
|
||||
func (b *BRISK) Detect(src Mat) []KeyPoint {
|
||||
ret := C.BRISK_Detect((C.BRISK)(b.p), src.p)
|
||||
defer C.KeyPoints_Close(ret)
|
||||
|
||||
return getKeyPoints(ret)
|
||||
}
|
||||
|
||||
// DetectAndCompute keypoints and compute in an image using BRISK.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#a8be0d1c20b08eb867184b8d74c15a677
|
||||
//
|
||||
func (b *BRISK) DetectAndCompute(src Mat, mask Mat) ([]KeyPoint, Mat) {
|
||||
desc := NewMat()
|
||||
ret := C.BRISK_DetectAndCompute((C.BRISK)(b.p), src.p, mask.p, desc.p)
|
||||
defer C.KeyPoints_Close(ret)
|
||||
|
||||
return getKeyPoints(ret), desc
|
||||
}
|
||||
|
||||
// FastFeatureDetectorType defines the detector type
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/df/d74/classcv_1_1FastFeatureDetector.html#a4654f6fb0aa4b8e9123b223bfa0e2a08
|
||||
type FastFeatureDetectorType int
|
||||
|
||||
const (
|
||||
//FastFeatureDetectorType58 is an alias of FastFeatureDetector::TYPE_5_8
|
||||
FastFeatureDetectorType58 FastFeatureDetectorType = 0
|
||||
//FastFeatureDetectorType712 is an alias of FastFeatureDetector::TYPE_7_12
|
||||
FastFeatureDetectorType712 FastFeatureDetectorType = 1
|
||||
//FastFeatureDetectorType916 is an alias of FastFeatureDetector::TYPE_9_16
|
||||
FastFeatureDetectorType916 FastFeatureDetectorType = 2
|
||||
)
|
||||
|
||||
// FastFeatureDetector is a wrapper around the cv::FastFeatureDetector.
|
||||
type FastFeatureDetector struct {
|
||||
// C.FastFeatureDetector
|
||||
p unsafe.Pointer
|
||||
}
|
||||
|
||||
// NewFastFeatureDetector returns a new FastFeatureDetector algorithm
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/df/d74/classcv_1_1FastFeatureDetector.html
|
||||
//
|
||||
func NewFastFeatureDetector() FastFeatureDetector {
|
||||
return FastFeatureDetector{p: unsafe.Pointer(C.FastFeatureDetector_Create())}
|
||||
}
|
||||
|
||||
// NewFastFeatureDetectorWithParams returns a new FastFeatureDetector algorithm with parameters
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/df/d74/classcv_1_1FastFeatureDetector.html#ab986f2ff8f8778aab1707e2642bc7f8e
|
||||
//
|
||||
func NewFastFeatureDetectorWithParams(threshold int, nonmaxSuppression bool, typ FastFeatureDetectorType) FastFeatureDetector {
|
||||
return FastFeatureDetector{p: unsafe.Pointer(C.FastFeatureDetector_CreateWithParams(C.int(threshold), C.bool(nonmaxSuppression), C.int(typ)))}
|
||||
}
|
||||
|
||||
// Close FastFeatureDetector.
|
||||
func (f *FastFeatureDetector) Close() error {
|
||||
C.FastFeatureDetector_Close((C.FastFeatureDetector)(f.p))
|
||||
f.p = nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// Detect keypoints in an image using FastFeatureDetector.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887
|
||||
//
|
||||
func (f *FastFeatureDetector) Detect(src Mat) []KeyPoint {
|
||||
ret := C.FastFeatureDetector_Detect((C.FastFeatureDetector)(f.p), src.p)
|
||||
defer C.KeyPoints_Close(ret)
|
||||
|
||||
return getKeyPoints(ret)
|
||||
}
|
||||
|
||||
// GFTTDetector is a wrapper around the cv::GFTTDetector algorithm.
|
||||
type GFTTDetector struct {
|
||||
// C.GFTTDetector
|
||||
p unsafe.Pointer
|
||||
}
|
||||
|
||||
// NewGFTTDetector returns a new GFTTDetector algorithm
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/df/d21/classcv_1_1GFTTDetector.html
|
||||
//
|
||||
func NewGFTTDetector() GFTTDetector {
|
||||
return GFTTDetector{p: unsafe.Pointer(C.GFTTDetector_Create())}
|
||||
}
|
||||
|
||||
// Close GFTTDetector.
|
||||
func (a *GFTTDetector) Close() error {
|
||||
C.GFTTDetector_Close((C.GFTTDetector)(a.p))
|
||||
a.p = nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// Detect keypoints in an image using GFTTDetector.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887
|
||||
//
|
||||
func (a *GFTTDetector) Detect(src Mat) []KeyPoint {
|
||||
ret := C.GFTTDetector_Detect((C.GFTTDetector)(a.p), src.p)
|
||||
defer C.KeyPoints_Close(ret)
|
||||
|
||||
return getKeyPoints(ret)
|
||||
}
|
||||
|
||||
// KAZE is a wrapper around the cv::KAZE algorithm.
|
||||
type KAZE struct {
|
||||
// C.KAZE
|
||||
p unsafe.Pointer
|
||||
}
|
||||
|
||||
// NewKAZE returns a new KAZE algorithm
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d3/d61/classcv_1_1KAZE.html
|
||||
//
|
||||
func NewKAZE() KAZE {
|
||||
return KAZE{p: unsafe.Pointer(C.KAZE_Create())}
|
||||
}
|
||||
|
||||
// Close KAZE.
|
||||
func (a *KAZE) Close() error {
|
||||
C.KAZE_Close((C.KAZE)(a.p))
|
||||
a.p = nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// Detect keypoints in an image using KAZE.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887
|
||||
//
|
||||
func (a *KAZE) Detect(src Mat) []KeyPoint {
|
||||
ret := C.KAZE_Detect((C.KAZE)(a.p), src.p)
|
||||
defer C.KeyPoints_Close(ret)
|
||||
|
||||
return getKeyPoints(ret)
|
||||
}
|
||||
|
||||
// DetectAndCompute keypoints and compute in an image using KAZE.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#a8be0d1c20b08eb867184b8d74c15a677
|
||||
//
|
||||
func (a *KAZE) DetectAndCompute(src Mat, mask Mat) ([]KeyPoint, Mat) {
|
||||
desc := NewMat()
|
||||
ret := C.KAZE_DetectAndCompute((C.KAZE)(a.p), src.p, mask.p, desc.p)
|
||||
defer C.KeyPoints_Close(ret)
|
||||
|
||||
return getKeyPoints(ret), desc
|
||||
}
|
||||
|
||||
// MSER is a wrapper around the cv::MSER algorithm.
|
||||
type MSER struct {
|
||||
// C.MSER
|
||||
p unsafe.Pointer
|
||||
}
|
||||
|
||||
// NewMSER returns a new MSER algorithm
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d3/d28/classcv_1_1MSER.html
|
||||
//
|
||||
func NewMSER() MSER {
|
||||
return MSER{p: unsafe.Pointer(C.MSER_Create())}
|
||||
}
|
||||
|
||||
// Close MSER.
|
||||
func (a *MSER) Close() error {
|
||||
C.MSER_Close((C.MSER)(a.p))
|
||||
a.p = nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// Detect keypoints in an image using MSER.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887
|
||||
//
|
||||
func (a *MSER) Detect(src Mat) []KeyPoint {
|
||||
ret := C.MSER_Detect((C.MSER)(a.p), src.p)
|
||||
defer C.KeyPoints_Close(ret)
|
||||
|
||||
return getKeyPoints(ret)
|
||||
}
|
||||
|
||||
// ORB is a wrapper around the cv::ORB.
|
||||
type ORB struct {
|
||||
// C.ORB
|
||||
p unsafe.Pointer
|
||||
}
|
||||
|
||||
// NewORB returns a new ORB algorithm
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/db/d95/classcv_1_1ORB.html
|
||||
//
|
||||
func NewORB() ORB {
|
||||
return ORB{p: unsafe.Pointer(C.ORB_Create())}
|
||||
}
|
||||
|
||||
// NewORBWithParams returns a new ORB algorithm with parameters
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/db/d95/classcv_1_1ORB.html#aeff0cbe668659b7ca14bb85ff1c4073b
|
||||
//
|
||||
func NewORBWithParams(nFeatures int, scaleFactor float32, nLevels int, edgeThreshold int, firstLevel int, WTAK int, scoreType ORBScoreType, patchSize int, fastThreshold int) ORB {
|
||||
return ORB{p: unsafe.Pointer(C.ORB_CreateWithParams(
|
||||
C.int(nFeatures),
|
||||
C.float(scaleFactor),
|
||||
C.int(nLevels),
|
||||
C.int(edgeThreshold),
|
||||
C.int(firstLevel),
|
||||
C.int(WTAK),
|
||||
C.int(scoreType),
|
||||
C.int(patchSize),
|
||||
C.int(fastThreshold),
|
||||
))}
|
||||
}
|
||||
|
||||
type ORBScoreType int
|
||||
|
||||
const (
|
||||
ORBScoreTypeHarris ORBScoreType = 0
|
||||
ORBScoreTypeFAST ORBScoreType = 1
|
||||
)
|
||||
|
||||
// Close ORB.
|
||||
func (o *ORB) Close() error {
|
||||
C.ORB_Close((C.ORB)(o.p))
|
||||
o.p = nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// Detect keypoints in an image using ORB.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887
|
||||
//
|
||||
func (o *ORB) Detect(src Mat) []KeyPoint {
|
||||
ret := C.ORB_Detect((C.ORB)(o.p), src.p)
|
||||
defer C.KeyPoints_Close(ret)
|
||||
|
||||
return getKeyPoints(ret)
|
||||
}
|
||||
|
||||
// DetectAndCompute detects keypoints and computes from an image using ORB.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#a8be0d1c20b08eb867184b8d74c15a677
|
||||
//
|
||||
func (o *ORB) DetectAndCompute(src Mat, mask Mat) ([]KeyPoint, Mat) {
|
||||
desc := NewMat()
|
||||
ret := C.ORB_DetectAndCompute((C.ORB)(o.p), src.p, mask.p, desc.p)
|
||||
defer C.KeyPoints_Close(ret)
|
||||
|
||||
return getKeyPoints(ret), desc
|
||||
}
|
||||
|
||||
// SimpleBlobDetector is a wrapper around the cv::SimpleBlobDetector.
|
||||
type SimpleBlobDetector struct {
|
||||
// C.SimpleBlobDetector
|
||||
p unsafe.Pointer
|
||||
}
|
||||
|
||||
// SimpleBlobDetector_Params is a wrapper around the cv::SimpleBlobdetector::Params
|
||||
type SimpleBlobDetectorParams struct {
|
||||
p C.SimpleBlobDetectorParams
|
||||
}
|
||||
|
||||
// NewSimpleBlobDetector returns a new SimpleBlobDetector algorithm
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d0/d7a/classcv_1_1SimpleBlobDetector.html
|
||||
//
|
||||
func NewSimpleBlobDetector() SimpleBlobDetector {
|
||||
return SimpleBlobDetector{p: unsafe.Pointer(C.SimpleBlobDetector_Create())}
|
||||
}
|
||||
|
||||
// NewSimpleBlobDetectorWithParams returns a new SimpleBlobDetector with custom parameters
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d0/d7a/classcv_1_1SimpleBlobDetector.html
|
||||
//
|
||||
func NewSimpleBlobDetectorWithParams(params SimpleBlobDetectorParams) SimpleBlobDetector {
|
||||
return SimpleBlobDetector{p: unsafe.Pointer(C.SimpleBlobDetector_Create_WithParams(params.p))}
|
||||
}
|
||||
|
||||
// Close SimpleBlobDetector.
|
||||
func (b *SimpleBlobDetector) Close() error {
|
||||
C.SimpleBlobDetector_Close((C.SimpleBlobDetector)(b.p))
|
||||
b.p = nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewSimpleBlobDetectorParams returns the default parameters for the SimpleBobDetector
|
||||
func NewSimpleBlobDetectorParams() SimpleBlobDetectorParams {
|
||||
return SimpleBlobDetectorParams{p: C.SimpleBlobDetectorParams_Create()}
|
||||
}
|
||||
|
||||
// SetBlobColor sets the blobColor field
|
||||
func (p *SimpleBlobDetectorParams) SetBlobColor(blobColor int) {
|
||||
p.p.blobColor = C.uchar(blobColor)
|
||||
}
|
||||
|
||||
// GetBlobColor gets the blobColor field
|
||||
func (p *SimpleBlobDetectorParams) GetBlobColor() int {
|
||||
return int(p.p.blobColor)
|
||||
}
|
||||
|
||||
// SetFilterByArea sets the filterByArea field
|
||||
func (p *SimpleBlobDetectorParams) SetFilterByArea(filterByArea bool) {
|
||||
p.p.filterByArea = C.bool(filterByArea)
|
||||
}
|
||||
|
||||
// GetFilterByArea gets the filterByArea field
|
||||
func (p *SimpleBlobDetectorParams) GetFilterByArea() bool {
|
||||
return bool(p.p.filterByArea)
|
||||
}
|
||||
|
||||
// SetFilterByCircularity sets the filterByCircularity field
|
||||
func (p *SimpleBlobDetectorParams) SetFilterByCircularity(filterByCircularity bool) {
|
||||
p.p.filterByCircularity = C.bool(filterByCircularity)
|
||||
}
|
||||
|
||||
// GetFilterByCircularity gets the filterByCircularity field
|
||||
func (p *SimpleBlobDetectorParams) GetFilterByCircularity() bool {
|
||||
return bool(p.p.filterByCircularity)
|
||||
}
|
||||
|
||||
// SetFilterByColor sets the filterByColor field
|
||||
func (p *SimpleBlobDetectorParams) SetFilterByColor(filterByColor bool) {
|
||||
p.p.filterByColor = C.bool(filterByColor)
|
||||
}
|
||||
|
||||
// GetFilterByColor gets the filterByColor field
|
||||
func (p *SimpleBlobDetectorParams) GetFilterByColor() bool {
|
||||
return bool(p.p.filterByColor)
|
||||
}
|
||||
|
||||
// SetFilterByConvexity sets the filterByConvexity field
|
||||
func (p *SimpleBlobDetectorParams) SetFilterByConvexity(filterByConvexity bool) {
|
||||
p.p.filterByConvexity = C.bool(filterByConvexity)
|
||||
}
|
||||
|
||||
// GetFilterByConvexity gets the filterByConvexity field
|
||||
func (p *SimpleBlobDetectorParams) GetFilterByConvexity() bool {
|
||||
return bool(p.p.filterByConvexity)
|
||||
}
|
||||
|
||||
// SetFilterByInertia sets the filterByInertia field
|
||||
func (p *SimpleBlobDetectorParams) SetFilterByInertia(filterByInertia bool) {
|
||||
p.p.filterByInertia = C.bool(filterByInertia)
|
||||
}
|
||||
|
||||
// GetFilterByInertia gets the filterByInertia field
|
||||
func (p *SimpleBlobDetectorParams) GetFilterByInertia() bool {
|
||||
return bool(p.p.filterByInertia)
|
||||
}
|
||||
|
||||
// SetMaxArea sets the maxArea parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) SetMaxArea(maxArea float64) {
|
||||
p.p.maxArea = C.float(maxArea)
|
||||
}
|
||||
|
||||
// GetMaxArea sets the maxArea parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) GetMaxArea() float64 {
|
||||
return float64(p.p.maxArea)
|
||||
}
|
||||
|
||||
// SetMaxCircularity sets the maxCircularity parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) SetMaxCircularity(maxCircularity float64) {
|
||||
p.p.maxCircularity = C.float(maxCircularity)
|
||||
}
|
||||
|
||||
// GetMaxCircularity sets the maxCircularity parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) GetMaxCircularity() float64 {
|
||||
return float64(p.p.maxCircularity)
|
||||
}
|
||||
|
||||
// SetMaxConvexity sets the maxConvexity parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) SetMaxConvexity(maxConvexity float64) {
|
||||
p.p.maxConvexity = C.float(maxConvexity)
|
||||
}
|
||||
|
||||
// GetMaxConvexity sets the maxConvexity parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) GetMaxConvexity() float64 {
|
||||
return float64(p.p.maxConvexity)
|
||||
}
|
||||
|
||||
// SetMaxInertiaRatio sets the maxInertiaRatio parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) SetMaxInertiaRatio(maxInertiaRatio float64) {
|
||||
p.p.maxInertiaRatio = C.float(maxInertiaRatio)
|
||||
}
|
||||
|
||||
// GetMaxInertiaRatio sets the maxCConvexity parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) GetMaxInertiaRatio() float64 {
|
||||
return float64(p.p.maxInertiaRatio)
|
||||
}
|
||||
|
||||
// SetMaxThreshold sets the maxThreshold parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) SetMaxThreshold(maxThreshold float64) {
|
||||
p.p.maxThreshold = C.float(maxThreshold)
|
||||
}
|
||||
|
||||
// GetMaxThreshold sets the maxCConvexity parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) GetMaxThreshold() float64 {
|
||||
return float64(p.p.maxThreshold)
|
||||
}
|
||||
|
||||
// SetMinArea sets the minArea parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) SetMinArea(minArea float64) {
|
||||
p.p.minArea = C.float(minArea)
|
||||
}
|
||||
|
||||
// GetMinArea sets theinArea parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) GetMinArea() float64 {
|
||||
return float64(p.p.minArea)
|
||||
}
|
||||
|
||||
// SetMinCircularity sets the minCircularity parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) SetMinCircularity(minCircularity float64) {
|
||||
p.p.minCircularity = C.float(minCircularity)
|
||||
}
|
||||
|
||||
// GetMinCircularity sets the minCircularity parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) GetMinCircularity() float64 {
|
||||
return float64(p.p.minCircularity)
|
||||
}
|
||||
|
||||
// SetMinConvexity sets the minConvexity parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) SetMinConvexity(minConvexity float64) {
|
||||
p.p.minConvexity = C.float(minConvexity)
|
||||
}
|
||||
|
||||
// GetMinConvexity sets the minConvexity parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) GetMinConvexity() float64 {
|
||||
return float64(p.p.minConvexity)
|
||||
}
|
||||
|
||||
// SetMinDistBetweenBlobs sets the minDistBetweenBlobs parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) SetMinDistBetweenBlobs(minDistBetweenBlobs float64) {
|
||||
p.p.minDistBetweenBlobs = C.float(minDistBetweenBlobs)
|
||||
}
|
||||
|
||||
// GetMinDistBetweenBlobs sets the minDistBetweenBlobs parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) GetMinDistBetweenBlobs() float64 {
|
||||
return float64(p.p.minDistBetweenBlobs)
|
||||
}
|
||||
|
||||
// SetMinInertiaRatio sets the minInertiaRatio parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) SetMinInertiaRatio(minInertiaRatio float64) {
|
||||
p.p.minInertiaRatio = C.float(minInertiaRatio)
|
||||
}
|
||||
|
||||
// GetMinInertiaRatio sets the minInertiaRatio parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) GetMinInertiaRatio() float64 {
|
||||
return float64(p.p.minInertiaRatio)
|
||||
}
|
||||
|
||||
// SetMinRepeatability sets the minRepeatability parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) SetMinRepeatability(minRepeatability int) {
|
||||
p.p.minRepeatability = C.size_t(minRepeatability)
|
||||
}
|
||||
|
||||
// GetMinInertiaRatio sets the minRepeatability parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) GetMinRepeatability() int {
|
||||
return int(p.p.minRepeatability)
|
||||
}
|
||||
|
||||
// SetMinThreshold sets the minThreshold parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) SetMinThreshold(minThreshold float64) {
|
||||
p.p.minThreshold = C.float(minThreshold)
|
||||
}
|
||||
|
||||
// GetMinThreshold sets the minInertiaRatio parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) GetMinThreshold() float64 {
|
||||
return float64(p.p.minThreshold)
|
||||
}
|
||||
|
||||
// SetMinThreshold sets the minThreshold parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) SetThresholdStep(thresholdStep float64) {
|
||||
p.p.thresholdStep = C.float(thresholdStep)
|
||||
}
|
||||
|
||||
// GetMinThreshold sets the minInertiaRatio parameter for SimpleBlobDetector_Params
|
||||
func (p *SimpleBlobDetectorParams) GetThresholdStep() float64 {
|
||||
return float64(p.p.thresholdStep)
|
||||
}
|
||||
|
||||
// Detect keypoints in an image using SimpleBlobDetector.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887
|
||||
//
|
||||
func (b *SimpleBlobDetector) Detect(src Mat) []KeyPoint {
|
||||
ret := C.SimpleBlobDetector_Detect((C.SimpleBlobDetector)(b.p), src.p)
|
||||
defer C.KeyPoints_Close(ret)
|
||||
|
||||
return getKeyPoints(ret)
|
||||
}
|
||||
|
||||
// getKeyPoints returns a slice of KeyPoint given a pointer to a C.KeyPoints
|
||||
func getKeyPoints(ret C.KeyPoints) []KeyPoint {
|
||||
cArray := ret.keypoints
|
||||
length := int(ret.length)
|
||||
hdr := reflect.SliceHeader{
|
||||
Data: uintptr(unsafe.Pointer(cArray)),
|
||||
Len: length,
|
||||
Cap: length,
|
||||
}
|
||||
s := *(*[]C.KeyPoint)(unsafe.Pointer(&hdr))
|
||||
|
||||
keys := make([]KeyPoint, length)
|
||||
for i, r := range s {
|
||||
keys[i] = KeyPoint{float64(r.x), float64(r.y), float64(r.size), float64(r.angle), float64(r.response),
|
||||
int(r.octave), int(r.classID)}
|
||||
}
|
||||
return keys
|
||||
}
|
||||
|
||||
// BFMatcher is a wrapper around the the cv::BFMatcher algorithm
|
||||
type BFMatcher struct {
|
||||
// C.BFMatcher
|
||||
p unsafe.Pointer
|
||||
}
|
||||
|
||||
// NewBFMatcher returns a new BFMatcher
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d3/da1/classcv_1_1BFMatcher.html#abe0bb11749b30d97f60d6ade665617bd
|
||||
//
|
||||
func NewBFMatcher() BFMatcher {
|
||||
return BFMatcher{p: unsafe.Pointer(C.BFMatcher_Create())}
|
||||
}
|
||||
|
||||
// NewBFMatcherWithParams creates a new BFMatchers but allows setting parameters
|
||||
// to values other than just the defaults.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d3/da1/classcv_1_1BFMatcher.html#abe0bb11749b30d97f60d6ade665617bd
|
||||
//
|
||||
func NewBFMatcherWithParams(normType NormType, crossCheck bool) BFMatcher {
|
||||
return BFMatcher{p: unsafe.Pointer(C.BFMatcher_CreateWithParams(C.int(normType), C.bool(crossCheck)))}
|
||||
}
|
||||
|
||||
// Close BFMatcher
|
||||
func (b *BFMatcher) Close() error {
|
||||
C.BFMatcher_Close((C.BFMatcher)(b.p))
|
||||
b.p = nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// KnnMatch Finds the k best matches for each descriptor from a query set.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/db/d39/classcv_1_1DescriptorMatcher.html#aa880f9353cdf185ccf3013e08210483a
|
||||
//
|
||||
func (b *BFMatcher) KnnMatch(query, train Mat, k int) [][]DMatch {
|
||||
ret := C.BFMatcher_KnnMatch((C.BFMatcher)(b.p), query.p, train.p, C.int(k))
|
||||
defer C.MultiDMatches_Close(ret)
|
||||
|
||||
return getMultiDMatches(ret)
|
||||
}
|
||||
|
||||
// FlannBasedMatcher is a wrapper around the the cv::FlannBasedMatcher algorithm
|
||||
type FlannBasedMatcher struct {
|
||||
// C.FlannBasedMatcher
|
||||
p unsafe.Pointer
|
||||
}
|
||||
|
||||
// NewFlannBasedMatcher returns a new FlannBasedMatcher
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/dc/de2/classcv_1_1FlannBasedMatcher.html#ab9114a6471e364ad221f89068ca21382
|
||||
//
|
||||
func NewFlannBasedMatcher() FlannBasedMatcher {
|
||||
return FlannBasedMatcher{p: unsafe.Pointer(C.FlannBasedMatcher_Create())}
|
||||
}
|
||||
|
||||
// Close FlannBasedMatcher
|
||||
func (f *FlannBasedMatcher) Close() error {
|
||||
C.FlannBasedMatcher_Close((C.FlannBasedMatcher)(f.p))
|
||||
f.p = nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// KnnMatch Finds the k best matches for each descriptor from a query set.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/db/d39/classcv_1_1DescriptorMatcher.html#aa880f9353cdf185ccf3013e08210483a
|
||||
//
|
||||
func (f *FlannBasedMatcher) KnnMatch(query, train Mat, k int) [][]DMatch {
|
||||
ret := C.FlannBasedMatcher_KnnMatch((C.FlannBasedMatcher)(f.p), query.p, train.p, C.int(k))
|
||||
defer C.MultiDMatches_Close(ret)
|
||||
|
||||
return getMultiDMatches(ret)
|
||||
}
|
||||
|
||||
func getMultiDMatches(ret C.MultiDMatches) [][]DMatch {
|
||||
cArray := ret.dmatches
|
||||
length := int(ret.length)
|
||||
hdr := reflect.SliceHeader{
|
||||
Data: uintptr(unsafe.Pointer(cArray)),
|
||||
Len: length,
|
||||
Cap: length,
|
||||
}
|
||||
s := *(*[]C.DMatches)(unsafe.Pointer(&hdr))
|
||||
|
||||
keys := make([][]DMatch, length)
|
||||
for i := range s {
|
||||
keys[i] = getDMatches(C.MultiDMatches_get(ret, C.int(i)))
|
||||
}
|
||||
return keys
|
||||
}
|
||||
|
||||
func getDMatches(ret C.DMatches) []DMatch {
|
||||
cArray := ret.dmatches
|
||||
length := int(ret.length)
|
||||
hdr := reflect.SliceHeader{
|
||||
Data: uintptr(unsafe.Pointer(cArray)),
|
||||
Len: length,
|
||||
Cap: length,
|
||||
}
|
||||
s := *(*[]C.DMatch)(unsafe.Pointer(&hdr))
|
||||
|
||||
keys := make([]DMatch, length)
|
||||
for i, r := range s {
|
||||
keys[i] = DMatch{int(r.queryIdx), int(r.trainIdx), int(r.imgIdx),
|
||||
float64(r.distance)}
|
||||
}
|
||||
return keys
|
||||
}
|
||||
|
||||
// DrawMatchesFlag are the flags setting drawing feature
|
||||
//
|
||||
// For further details please see:
|
||||
// https://docs.opencv.org/master/de/d30/structcv_1_1DrawMatchesFlags.html
|
||||
type DrawMatchesFlag int
|
||||
|
||||
const (
|
||||
// DrawDefault creates new image and for each keypoint only the center point will be drawn
|
||||
DrawDefault DrawMatchesFlag = 0
|
||||
// DrawOverOutImg draws matches on existing content of image
|
||||
DrawOverOutImg DrawMatchesFlag = 1
|
||||
// NotDrawSinglePoints will not draw single points
|
||||
NotDrawSinglePoints DrawMatchesFlag = 2
|
||||
// DrawRichKeyPoints draws the circle around each keypoint with keypoint size and orientation
|
||||
DrawRichKeyPoints DrawMatchesFlag = 3
|
||||
)
|
||||
|
||||
// DrawKeyPoints draws keypoints
|
||||
//
|
||||
// For further details please see:
|
||||
// https://docs.opencv.org/master/d4/d5d/group__features2d__draw.html#gab958f8900dd10f14316521c149a60433
|
||||
func DrawKeyPoints(src Mat, keyPoints []KeyPoint, dst *Mat, color color.RGBA, flag DrawMatchesFlag) {
|
||||
cKeyPointArray := make([]C.struct_KeyPoint, len(keyPoints))
|
||||
|
||||
for i, kp := range keyPoints {
|
||||
cKeyPointArray[i].x = C.double(kp.X)
|
||||
cKeyPointArray[i].y = C.double(kp.Y)
|
||||
cKeyPointArray[i].size = C.double(kp.Size)
|
||||
cKeyPointArray[i].angle = C.double(kp.Angle)
|
||||
cKeyPointArray[i].response = C.double(kp.Response)
|
||||
cKeyPointArray[i].octave = C.int(kp.Octave)
|
||||
cKeyPointArray[i].classID = C.int(kp.ClassID)
|
||||
}
|
||||
|
||||
cKeyPoints := C.struct_KeyPoints{
|
||||
keypoints: (*C.struct_KeyPoint)(&cKeyPointArray[0]),
|
||||
length: (C.int)(len(keyPoints)),
|
||||
}
|
||||
|
||||
scalar := C.struct_Scalar{
|
||||
val1: C.double(color.B),
|
||||
val2: C.double(color.G),
|
||||
val3: C.double(color.R),
|
||||
val4: C.double(color.A),
|
||||
}
|
||||
|
||||
C.DrawKeyPoints(src.p, cKeyPoints, dst.p, scalar, C.int(flag))
|
||||
}
|
||||
|
||||
// SIFT is a wrapper around the cv::SIFT algorithm.
|
||||
// Due to the patent having expired, this is now in the main OpenCV code modules.
|
||||
type SIFT struct {
|
||||
// C.SIFT
|
||||
p unsafe.Pointer
|
||||
}
|
||||
|
||||
// NewSIFT returns a new SIFT algorithm.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d5/d3c/classcv_1_1xfeatures2d_1_1SIFT.html
|
||||
//
|
||||
func NewSIFT() SIFT {
|
||||
return SIFT{p: unsafe.Pointer(C.SIFT_Create())}
|
||||
}
|
||||
|
||||
// Close SIFT.
|
||||
func (d *SIFT) Close() error {
|
||||
C.SIFT_Close((C.SIFT)(d.p))
|
||||
d.p = nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// Detect keypoints in an image using SIFT.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#aa4e9a7082ec61ebc108806704fbd7887
|
||||
//
|
||||
func (d *SIFT) Detect(src Mat) []KeyPoint {
|
||||
ret := C.SIFT_Detect((C.SIFT)(d.p), C.Mat(src.Ptr()))
|
||||
defer C.KeyPoints_Close(ret)
|
||||
|
||||
return getKeyPoints(ret)
|
||||
}
|
||||
|
||||
// DetectAndCompute detects and computes keypoints in an image using SIFT.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html#a8be0d1c20b08eb867184b8d74c15a677
|
||||
//
|
||||
func (d *SIFT) DetectAndCompute(src Mat, mask Mat) ([]KeyPoint, Mat) {
|
||||
desc := NewMat()
|
||||
ret := C.SIFT_DetectAndCompute((C.SIFT)(d.p), C.Mat(src.Ptr()), C.Mat(mask.Ptr()),
|
||||
C.Mat(desc.Ptr()))
|
||||
defer C.KeyPoints_Close(ret)
|
||||
|
||||
return getKeyPoints(ret), desc
|
||||
}
|
||||
|
||||
// DrawMatches draws matches on combined train and querry images.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d4/d5d/group__features2d__draw.html#gad8f463ccaf0dc6f61083abd8717c261a
|
||||
func DrawMatches(img1 Mat, kp1 []KeyPoint, img2 Mat, kp2 []KeyPoint, matches1to2 []DMatch, outImg *Mat, matchColor color.RGBA, singlePointColor color.RGBA, matchesMask []byte, flags DrawMatchesFlag) {
|
||||
kp1arr := make([]C.struct_KeyPoint, len(kp1))
|
||||
kp2arr := make([]C.struct_KeyPoint, len(kp2))
|
||||
|
||||
for i, kp := range kp1 {
|
||||
kp1arr[i].x = C.double(kp.X)
|
||||
kp1arr[i].y = C.double(kp.Y)
|
||||
kp1arr[i].size = C.double(kp.Size)
|
||||
kp1arr[i].angle = C.double(kp.Angle)
|
||||
kp1arr[i].response = C.double(kp.Response)
|
||||
kp1arr[i].octave = C.int(kp.Octave)
|
||||
kp1arr[i].classID = C.int(kp.ClassID)
|
||||
}
|
||||
|
||||
for i, kp := range kp2 {
|
||||
kp2arr[i].x = C.double(kp.X)
|
||||
kp2arr[i].y = C.double(kp.Y)
|
||||
kp2arr[i].size = C.double(kp.Size)
|
||||
kp2arr[i].angle = C.double(kp.Angle)
|
||||
kp2arr[i].response = C.double(kp.Response)
|
||||
kp2arr[i].octave = C.int(kp.Octave)
|
||||
kp2arr[i].classID = C.int(kp.ClassID)
|
||||
}
|
||||
|
||||
cKeyPoints1 := C.struct_KeyPoints{
|
||||
keypoints: (*C.struct_KeyPoint)(&kp1arr[0]),
|
||||
length: (C.int)(len(kp1)),
|
||||
}
|
||||
|
||||
cKeyPoints2 := C.struct_KeyPoints{
|
||||
keypoints: (*C.struct_KeyPoint)(&kp2arr[0]),
|
||||
length: (C.int)(len(kp2)),
|
||||
}
|
||||
|
||||
dMatchArr := make([]C.struct_DMatch, len(matches1to2))
|
||||
|
||||
for i, dm := range matches1to2 {
|
||||
dMatchArr[i].queryIdx = C.int(dm.QueryIdx)
|
||||
dMatchArr[i].trainIdx = C.int(dm.TrainIdx)
|
||||
dMatchArr[i].imgIdx = C.int(dm.ImgIdx)
|
||||
dMatchArr[i].distance = C.float(dm.Distance)
|
||||
}
|
||||
|
||||
cDMatches := C.struct_DMatches{
|
||||
dmatches: (*C.struct_DMatch)(&dMatchArr[0]),
|
||||
length: (C.int)(len(matches1to2)),
|
||||
}
|
||||
|
||||
scalarMatchColor := C.struct_Scalar{
|
||||
val1: C.double(matchColor.R),
|
||||
val2: C.double(matchColor.G),
|
||||
val3: C.double(matchColor.B),
|
||||
val4: C.double(matchColor.A),
|
||||
}
|
||||
|
||||
scalarPointColor := C.struct_Scalar{
|
||||
val1: C.double(singlePointColor.B),
|
||||
val2: C.double(singlePointColor.G),
|
||||
val3: C.double(singlePointColor.R),
|
||||
val4: C.double(singlePointColor.A),
|
||||
}
|
||||
|
||||
mask := make([]C.char, len(matchesMask))
|
||||
|
||||
cByteArray := C.struct_ByteArray{
|
||||
length: (C.int)(len(matchesMask)),
|
||||
}
|
||||
|
||||
if len(matchesMask) > 0 {
|
||||
cByteArray = C.struct_ByteArray{
|
||||
data: (*C.char)(&mask[0]),
|
||||
length: (C.int)(len(matchesMask)),
|
||||
}
|
||||
}
|
||||
|
||||
C.DrawMatches(img1.p, cKeyPoints1, img2.p, cKeyPoints2, cDMatches, outImg.p, scalarMatchColor, scalarPointColor, cByteArray, C.int(flags))
|
||||
}
|
105
vendor/gocv.io/x/gocv/features2d.h
generated
vendored
105
vendor/gocv.io/x/gocv/features2d.h
generated
vendored
@ -1,105 +0,0 @@
|
||||
#ifndef _OPENCV3_FEATURES2D_H_
|
||||
#define _OPENCV3_FEATURES2D_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <opencv2/opencv.hpp>
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "core.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
typedef cv::Ptr<cv::AKAZE>* AKAZE;
|
||||
typedef cv::Ptr<cv::AgastFeatureDetector>* AgastFeatureDetector;
|
||||
typedef cv::Ptr<cv::BRISK>* BRISK;
|
||||
typedef cv::Ptr<cv::FastFeatureDetector>* FastFeatureDetector;
|
||||
typedef cv::Ptr<cv::GFTTDetector>* GFTTDetector;
|
||||
typedef cv::Ptr<cv::KAZE>* KAZE;
|
||||
typedef cv::Ptr<cv::MSER>* MSER;
|
||||
typedef cv::Ptr<cv::ORB>* ORB;
|
||||
typedef cv::Ptr<cv::SimpleBlobDetector>* SimpleBlobDetector;
|
||||
typedef cv::Ptr<cv::BFMatcher>* BFMatcher;
|
||||
typedef cv::Ptr<cv::FlannBasedMatcher>* FlannBasedMatcher;
|
||||
typedef cv::Ptr<cv::SIFT>* SIFT;
|
||||
#else
|
||||
typedef void* AKAZE;
|
||||
typedef void* AgastFeatureDetector;
|
||||
typedef void* BRISK;
|
||||
typedef void* FastFeatureDetector;
|
||||
typedef void* GFTTDetector;
|
||||
typedef void* KAZE;
|
||||
typedef void* MSER;
|
||||
typedef void* ORB;
|
||||
typedef void* SimpleBlobDetector;
|
||||
typedef void* BFMatcher;
|
||||
typedef void* FlannBasedMatcher;
|
||||
typedef void* SIFT;
|
||||
#endif
|
||||
|
||||
AKAZE AKAZE_Create();
|
||||
void AKAZE_Close(AKAZE a);
|
||||
struct KeyPoints AKAZE_Detect(AKAZE a, Mat src);
|
||||
struct KeyPoints AKAZE_DetectAndCompute(AKAZE a, Mat src, Mat mask, Mat desc);
|
||||
|
||||
AgastFeatureDetector AgastFeatureDetector_Create();
|
||||
void AgastFeatureDetector_Close(AgastFeatureDetector a);
|
||||
struct KeyPoints AgastFeatureDetector_Detect(AgastFeatureDetector a, Mat src);
|
||||
|
||||
BRISK BRISK_Create();
|
||||
void BRISK_Close(BRISK b);
|
||||
struct KeyPoints BRISK_Detect(BRISK b, Mat src);
|
||||
struct KeyPoints BRISK_DetectAndCompute(BRISK b, Mat src, Mat mask, Mat desc);
|
||||
|
||||
FastFeatureDetector FastFeatureDetector_Create();
|
||||
FastFeatureDetector FastFeatureDetector_CreateWithParams(int threshold, bool nonmaxSuppression, int type);
|
||||
void FastFeatureDetector_Close(FastFeatureDetector f);
|
||||
struct KeyPoints FastFeatureDetector_Detect(FastFeatureDetector f, Mat src);
|
||||
|
||||
GFTTDetector GFTTDetector_Create();
|
||||
void GFTTDetector_Close(GFTTDetector a);
|
||||
struct KeyPoints GFTTDetector_Detect(GFTTDetector a, Mat src);
|
||||
|
||||
KAZE KAZE_Create();
|
||||
void KAZE_Close(KAZE a);
|
||||
struct KeyPoints KAZE_Detect(KAZE a, Mat src);
|
||||
struct KeyPoints KAZE_DetectAndCompute(KAZE a, Mat src, Mat mask, Mat desc);
|
||||
|
||||
MSER MSER_Create();
|
||||
void MSER_Close(MSER a);
|
||||
struct KeyPoints MSER_Detect(MSER a, Mat src);
|
||||
|
||||
ORB ORB_Create();
|
||||
ORB ORB_CreateWithParams(int nfeatures, float scaleFactor, int nlevels, int edgeThreshold, int firstLevel, int WTA_K, int scoreType, int patchSize, int fastThreshold);
|
||||
void ORB_Close(ORB o);
|
||||
struct KeyPoints ORB_Detect(ORB o, Mat src);
|
||||
struct KeyPoints ORB_DetectAndCompute(ORB o, Mat src, Mat mask, Mat desc);
|
||||
|
||||
SimpleBlobDetector SimpleBlobDetector_Create();
|
||||
SimpleBlobDetector SimpleBlobDetector_Create_WithParams(SimpleBlobDetectorParams params);
|
||||
void SimpleBlobDetector_Close(SimpleBlobDetector b);
|
||||
struct KeyPoints SimpleBlobDetector_Detect(SimpleBlobDetector b, Mat src);
|
||||
SimpleBlobDetectorParams SimpleBlobDetectorParams_Create();
|
||||
|
||||
BFMatcher BFMatcher_Create();
|
||||
BFMatcher BFMatcher_CreateWithParams(int normType, bool crossCheck);
|
||||
void BFMatcher_Close(BFMatcher b);
|
||||
struct MultiDMatches BFMatcher_KnnMatch(BFMatcher b, Mat query, Mat train, int k);
|
||||
|
||||
FlannBasedMatcher FlannBasedMatcher_Create();
|
||||
void FlannBasedMatcher_Close(FlannBasedMatcher f);
|
||||
struct MultiDMatches FlannBasedMatcher_KnnMatch(FlannBasedMatcher f, Mat query, Mat train, int k);
|
||||
|
||||
void DrawKeyPoints(Mat src, struct KeyPoints kp, Mat dst, const Scalar s, int flags);
|
||||
|
||||
SIFT SIFT_Create();
|
||||
void SIFT_Close(SIFT f);
|
||||
struct KeyPoints SIFT_Detect(SIFT f, Mat src);
|
||||
struct KeyPoints SIFT_DetectAndCompute(SIFT f, Mat src, Mat mask, Mat desc);
|
||||
|
||||
void DrawMatches(Mat img1, struct KeyPoints kp1, Mat img2, struct KeyPoints kp2, struct DMatches matches1to2, Mat outImg, const Scalar matchesColor, const Scalar pointColor, struct ByteArray matchesMask, int flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //_OPENCV3_FEATURES2D_H_
|
33
vendor/gocv.io/x/gocv/features2d_string.go
generated
vendored
33
vendor/gocv.io/x/gocv/features2d_string.go
generated
vendored
@ -1,33 +0,0 @@
|
||||
package gocv
|
||||
|
||||
/*
|
||||
#include <stdlib.h>
|
||||
#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 ""
|
||||
}
|
11
vendor/gocv.io/x/gocv/gocv.go
generated
vendored
11
vendor/gocv.io/x/gocv/gocv.go
generated
vendored
@ -1,11 +0,0 @@
|
||||
// Package gocv is a wrapper around the OpenCV 4.x computer vision library.
|
||||
// It provides a Go language interface to the latest version of OpenCV.
|
||||
//
|
||||
// OpenCV (Open Source Computer Vision Library: http://opencv.org) is an
|
||||
// open-source BSD-licensed library that includes several hundreds of
|
||||
// computer vision algorithms.
|
||||
//
|
||||
// For further details, please see:
|
||||
// http://docs.opencv.org/master/d1/dfb/intro.html
|
||||
//
|
||||
package gocv // import "gocv.io/x/gocv"
|
83
vendor/gocv.io/x/gocv/highgui.cpp
generated
vendored
83
vendor/gocv.io/x/gocv/highgui.cpp
generated
vendored
@ -1,83 +0,0 @@
|
||||
#include "highgui_gocv.h"
|
||||
|
||||
// Window
|
||||
void Window_New(const char* winname, int flags) {
|
||||
cv::namedWindow(winname, flags);
|
||||
}
|
||||
|
||||
void Window_Close(const char* winname) {
|
||||
cv::destroyWindow(winname);
|
||||
}
|
||||
|
||||
void Window_IMShow(const char* winname, Mat mat) {
|
||||
cv::imshow(winname, *mat);
|
||||
}
|
||||
|
||||
double Window_GetProperty(const char* winname, int flag) {
|
||||
return cv::getWindowProperty(winname, flag);
|
||||
}
|
||||
|
||||
void Window_SetProperty(const char* winname, int flag, double value) {
|
||||
cv::setWindowProperty(winname, flag, value);
|
||||
}
|
||||
|
||||
void Window_SetTitle(const char* winname, const char* title) {
|
||||
cv::setWindowTitle(winname, title);
|
||||
}
|
||||
|
||||
int Window_WaitKey(int delay = 0) {
|
||||
return cv::waitKey(delay);
|
||||
}
|
||||
|
||||
void Window_Move(const char* winname, int x, int y) {
|
||||
cv::moveWindow(winname, x, y);
|
||||
}
|
||||
|
||||
void Window_Resize(const char* winname, int width, int height) {
|
||||
cv::resizeWindow(winname, width, height);
|
||||
}
|
||||
|
||||
struct Rect Window_SelectROI(const char* winname, Mat img) {
|
||||
cv::Rect bRect = cv::selectROI(winname, *img);
|
||||
Rect r = {bRect.x, bRect.y, bRect.width, bRect.height};
|
||||
return r;
|
||||
}
|
||||
|
||||
struct Rects Window_SelectROIs(const char* winname, Mat img) {
|
||||
std::vector<cv::Rect> rois;
|
||||
cv::selectROIs(winname, *img, rois);
|
||||
Rect* rects = new Rect[rois.size()];
|
||||
|
||||
for (size_t i = 0; i < rois.size(); ++i) {
|
||||
Rect r = {rois[i].x, rois[i].y, rois[i].width, rois[i].height};
|
||||
rects[i] = r;
|
||||
}
|
||||
|
||||
Rects ret = {rects, (int)rois.size()};
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Trackbar
|
||||
void Trackbar_Create(const char* winname, const char* trackname, int max) {
|
||||
cv::createTrackbar(trackname, winname, NULL, max);
|
||||
}
|
||||
|
||||
void Trackbar_CreateWithValue(const char* winname, const char* trackname, int* value, int max) {
|
||||
cv::createTrackbar(trackname, winname, value, max);
|
||||
}
|
||||
|
||||
int Trackbar_GetPos(const char* winname, const char* trackname) {
|
||||
return cv::getTrackbarPos(trackname, winname);
|
||||
}
|
||||
|
||||
void Trackbar_SetPos(const char* winname, const char* trackname, int pos) {
|
||||
cv::setTrackbarPos(trackname, winname, pos);
|
||||
}
|
||||
|
||||
void Trackbar_SetMin(const char* winname, const char* trackname, int pos) {
|
||||
cv::setTrackbarMin(trackname, winname, pos);
|
||||
}
|
||||
|
||||
void Trackbar_SetMax(const char* winname, const char* trackname, int pos) {
|
||||
cv::setTrackbarMax(trackname, winname, pos);
|
||||
}
|
361
vendor/gocv.io/x/gocv/highgui.go
generated
vendored
361
vendor/gocv.io/x/gocv/highgui.go
generated
vendored
@ -1,361 +0,0 @@
|
||||
package gocv
|
||||
|
||||
/*
|
||||
#include <stdlib.h>
|
||||
#include "highgui_gocv.h"
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
"image"
|
||||
"runtime"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Window is a wrapper around OpenCV's "HighGUI" named windows.
|
||||
// While OpenCV was designed for use in full-scale applications and can be used
|
||||
// within functionally rich UI frameworks (such as Qt*, WinForms*, or Cocoa*)
|
||||
// or without any UI at all, sometimes there it is required to try functionality
|
||||
// quickly and visualize the results. This is what the HighGUI module has been designed for.
|
||||
//
|
||||
// For further details, please see:
|
||||
// http://docs.opencv.org/master/d7/dfc/group__highgui.html
|
||||
//
|
||||
type Window struct {
|
||||
name string
|
||||
open bool
|
||||
}
|
||||
|
||||
// NewWindow creates a new named OpenCV window
|
||||
//
|
||||
// For further details, please see:
|
||||
// http://docs.opencv.org/master/d7/dfc/group__highgui.html#ga5afdf8410934fd099df85c75b2e0888b
|
||||
//
|
||||
func NewWindow(name string) *Window {
|
||||
runtime.LockOSThread()
|
||||
|
||||
cName := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
C.Window_New(cName, 0)
|
||||
|
||||
return &Window{name: name, open: true}
|
||||
}
|
||||
|
||||
// Close closes and deletes a named OpenCV Window.
|
||||
//
|
||||
// For further details, please see:
|
||||
// http://docs.opencv.org/master/d7/dfc/group__highgui.html#ga851ccdd6961022d1d5b4c4f255dbab34
|
||||
//
|
||||
func (w *Window) Close() error {
|
||||
cName := C.CString(w.name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
C.Window_Close(cName)
|
||||
w.open = false
|
||||
|
||||
runtime.UnlockOSThread()
|
||||
return nil
|
||||
}
|
||||
|
||||
// IsOpen checks to see if the Window seems to be open.
|
||||
func (w *Window) IsOpen() bool {
|
||||
return w.open
|
||||
}
|
||||
|
||||
// WindowFlag value for SetWindowProperty / GetWindowProperty.
|
||||
type WindowFlag float32
|
||||
|
||||
const (
|
||||
// WindowNormal indicates a normal window.
|
||||
WindowNormal WindowFlag = 0x00000000
|
||||
|
||||
// WindowAutosize indicates a window sized based on the contents.
|
||||
WindowAutosize WindowFlag = 0x00000001
|
||||
|
||||
// WindowFullscreen indicates a full-screen window.
|
||||
WindowFullscreen WindowFlag = 1
|
||||
|
||||
// WindowFreeRatio indicates allow the user to resize without maintaining aspect ratio.
|
||||
WindowFreeRatio WindowFlag = 0x00000100
|
||||
|
||||
// WindowKeepRatio indicates always maintain an aspect ratio that matches the contents.
|
||||
WindowKeepRatio WindowFlag = 0x00000000
|
||||
)
|
||||
|
||||
// WindowPropertyFlag flags for SetWindowProperty / GetWindowProperty.
|
||||
type WindowPropertyFlag int
|
||||
|
||||
const (
|
||||
// WindowPropertyFullscreen fullscreen property
|
||||
// (can be WINDOW_NORMAL or WINDOW_FULLSCREEN).
|
||||
WindowPropertyFullscreen WindowPropertyFlag = 0
|
||||
|
||||
// WindowPropertyAutosize is autosize property
|
||||
// (can be WINDOW_NORMAL or WINDOW_AUTOSIZE).
|
||||
WindowPropertyAutosize WindowPropertyFlag = 1
|
||||
|
||||
// WindowPropertyAspectRatio window's aspect ration
|
||||
// (can be set to WINDOW_FREERATIO or WINDOW_KEEPRATIO).
|
||||
WindowPropertyAspectRatio WindowPropertyFlag = 2
|
||||
|
||||
// WindowPropertyOpenGL opengl support.
|
||||
WindowPropertyOpenGL WindowPropertyFlag = 3
|
||||
|
||||
// WindowPropertyVisible or not.
|
||||
WindowPropertyVisible WindowPropertyFlag = 4
|
||||
)
|
||||
|
||||
// GetWindowProperty returns properties of a window.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d7/dfc/group__highgui.html#gaaf9504b8f9cf19024d9d44a14e461656
|
||||
//
|
||||
func (w *Window) GetWindowProperty(flag WindowPropertyFlag) float64 {
|
||||
cName := C.CString(w.name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
return float64(C.Window_GetProperty(cName, C.int(flag)))
|
||||
}
|
||||
|
||||
// SetWindowProperty changes parameters of a window dynamically.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d7/dfc/group__highgui.html#ga66e4a6db4d4e06148bcdfe0d70a5df27
|
||||
//
|
||||
func (w *Window) SetWindowProperty(flag WindowPropertyFlag, value WindowFlag) {
|
||||
cName := C.CString(w.name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
C.Window_SetProperty(cName, C.int(flag), C.double(value))
|
||||
}
|
||||
|
||||
// SetWindowTitle updates window title.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d7/dfc/group__highgui.html#ga56f8849295fd10d0c319724ddb773d96
|
||||
//
|
||||
func (w *Window) SetWindowTitle(title string) {
|
||||
cName := C.CString(w.name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
cTitle := C.CString(title)
|
||||
defer C.free(unsafe.Pointer(cTitle))
|
||||
|
||||
C.Window_SetTitle(cName, cTitle)
|
||||
}
|
||||
|
||||
// IMShow displays an image Mat in the specified window.
|
||||
// This function should be followed by the WaitKey function which displays
|
||||
// the image for specified milliseconds. Otherwise, it won't display the image.
|
||||
//
|
||||
// For further details, please see:
|
||||
// http://docs.opencv.org/master/d7/dfc/group__highgui.html#ga453d42fe4cb60e5723281a89973ee563
|
||||
//
|
||||
func (w *Window) IMShow(img Mat) {
|
||||
cName := C.CString(w.name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
C.Window_IMShow(cName, img.p)
|
||||
}
|
||||
|
||||
// WaitKey waits for a pressed key.
|
||||
// This function is the only method in OpenCV's HighGUI that can fetch
|
||||
// and handle events, so it needs to be called periodically
|
||||
// for normal event processing
|
||||
//
|
||||
// For further details, please see:
|
||||
// http://docs.opencv.org/master/d7/dfc/group__highgui.html#ga5628525ad33f52eab17feebcfba38bd7
|
||||
//
|
||||
func (w *Window) WaitKey(delay int) int {
|
||||
return int(C.Window_WaitKey(C.int(delay)))
|
||||
}
|
||||
|
||||
// MoveWindow moves window to the specified position.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d7/dfc/group__highgui.html#ga8d86b207f7211250dbe6e28f76307ffb
|
||||
//
|
||||
func (w *Window) MoveWindow(x, y int) {
|
||||
cName := C.CString(w.name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
C.Window_Move(cName, C.int(x), C.int(y))
|
||||
}
|
||||
|
||||
// ResizeWindow resizes window to the specified size.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d7/dfc/group__highgui.html#ga9e80e080f7ef33f897e415358aee7f7e
|
||||
//
|
||||
func (w *Window) ResizeWindow(width, height int) {
|
||||
cName := C.CString(w.name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
C.Window_Resize(cName, C.int(width), C.int(height))
|
||||
}
|
||||
|
||||
// SelectROI selects a Region Of Interest (ROI) on the given image.
|
||||
// It creates a window and allows user to select a ROI using mouse.
|
||||
//
|
||||
// Controls:
|
||||
// use space or enter to finish selection,
|
||||
// use key c to cancel selection (function will return a zero Rect).
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d7/dfc/group__highgui.html#ga8daf4730d3adf7035b6de9be4c469af5
|
||||
//
|
||||
func (w *Window) SelectROI(img Mat) image.Rectangle {
|
||||
cName := C.CString(w.name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
r := C.Window_SelectROI(cName, img.p)
|
||||
rect := image.Rect(int(r.x), int(r.y), int(r.x+r.width), int(r.y+r.height))
|
||||
return rect
|
||||
}
|
||||
|
||||
// SelectROIs selects multiple Regions Of Interest (ROI) on the given image.
|
||||
// It creates a window and allows user to select ROIs using mouse.
|
||||
//
|
||||
// Controls:
|
||||
// use space or enter to finish current selection and start a new one
|
||||
// use esc to terminate multiple ROI selection process
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d7/dfc/group__highgui.html#ga0f11fad74a6432b8055fb21621a0f893
|
||||
//
|
||||
func (w *Window) SelectROIs(img Mat) []image.Rectangle {
|
||||
cName := C.CString(w.name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
ret := C.Window_SelectROIs(cName, img.p)
|
||||
defer C.Rects_Close(ret)
|
||||
|
||||
return toRectangles(ret)
|
||||
}
|
||||
|
||||
// Deprecated: use Window.SelectROI instead
|
||||
func SelectROI(name string, img Mat) image.Rectangle {
|
||||
cName := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
r := C.Window_SelectROI(cName, img.p)
|
||||
rect := image.Rect(int(r.x), int(r.y), int(r.x+r.width), int(r.y+r.height))
|
||||
return rect
|
||||
}
|
||||
|
||||
// Deprecated: use Window.SelectROIs instead
|
||||
func SelectROIs(name string, img Mat) []image.Rectangle {
|
||||
cName := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
ret := C.Window_SelectROIs(cName, img.p)
|
||||
defer C.Rects_Close(ret)
|
||||
|
||||
return toRectangles(ret)
|
||||
}
|
||||
|
||||
// WaitKey that is not attached to a specific Window.
|
||||
// Only use when no Window exists in your application, e.g. command line app.
|
||||
//
|
||||
func WaitKey(delay int) int {
|
||||
return int(C.Window_WaitKey(C.int(delay)))
|
||||
}
|
||||
|
||||
// Trackbar is a wrapper around OpenCV's "HighGUI" window Trackbars.
|
||||
type Trackbar struct {
|
||||
name string
|
||||
parent *Window
|
||||
}
|
||||
|
||||
// CreateTrackbar creates a trackbar and attaches it to the specified window.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d7/dfc/group__highgui.html#gaf78d2155d30b728fc413803745b67a9b
|
||||
//
|
||||
func (w *Window) CreateTrackbar(name string, max int) *Trackbar {
|
||||
cName := C.CString(w.name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
tName := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(tName))
|
||||
|
||||
C.Trackbar_Create(cName, tName, C.int(max))
|
||||
return &Trackbar{name: name, parent: w}
|
||||
}
|
||||
|
||||
// CreateTrackbarWithValue works like CreateTrackbar but also assigns a
|
||||
// variable value to be a position synchronized with the trackbar.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d7/dfc/group__highgui.html#gaf78d2155d30b728fc413803745b67a9b
|
||||
//
|
||||
func (w *Window) CreateTrackbarWithValue(name string, value *int, max int) *Trackbar {
|
||||
cName := C.CString(w.name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
tName := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(tName))
|
||||
|
||||
C.Trackbar_CreateWithValue(cName, tName, (*C.int)(unsafe.Pointer(value)), C.int(max))
|
||||
return &Trackbar{name: name, parent: w}
|
||||
}
|
||||
|
||||
// GetPos returns the trackbar position.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d7/dfc/group__highgui.html#ga122632e9e91b9ec06943472c55d9cda8
|
||||
//
|
||||
func (t *Trackbar) GetPos() int {
|
||||
cName := C.CString(t.parent.name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
tName := C.CString(t.name)
|
||||
defer C.free(unsafe.Pointer(tName))
|
||||
|
||||
return int(C.Trackbar_GetPos(cName, tName))
|
||||
}
|
||||
|
||||
// SetPos sets the trackbar position.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d7/dfc/group__highgui.html#ga67d73c4c9430f13481fd58410d01bd8d
|
||||
//
|
||||
func (t *Trackbar) SetPos(pos int) {
|
||||
cName := C.CString(t.parent.name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
tName := C.CString(t.name)
|
||||
defer C.free(unsafe.Pointer(tName))
|
||||
|
||||
C.Trackbar_SetPos(cName, tName, C.int(pos))
|
||||
}
|
||||
|
||||
// SetMin sets the trackbar minimum position.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d7/dfc/group__highgui.html#gabe26ffe8d2b60cc678895595a581b7aa
|
||||
//
|
||||
func (t *Trackbar) SetMin(pos int) {
|
||||
cName := C.CString(t.parent.name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
tName := C.CString(t.name)
|
||||
defer C.free(unsafe.Pointer(tName))
|
||||
|
||||
C.Trackbar_SetMin(cName, tName, C.int(pos))
|
||||
}
|
||||
|
||||
// SetMax sets the trackbar maximum position.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d7/dfc/group__highgui.html#ga7e5437ccba37f1154b65210902fc4480
|
||||
//
|
||||
func (t *Trackbar) SetMax(pos int) {
|
||||
cName := C.CString(t.parent.name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
tName := C.CString(t.name)
|
||||
defer C.free(unsafe.Pointer(tName))
|
||||
|
||||
C.Trackbar_SetMax(cName, tName, C.int(pos))
|
||||
}
|
36
vendor/gocv.io/x/gocv/highgui_gocv.h
generated
vendored
36
vendor/gocv.io/x/gocv/highgui_gocv.h
generated
vendored
@ -1,36 +0,0 @@
|
||||
#ifndef _OPENCV3_HIGHGUI_H_
|
||||
#define _OPENCV3_HIGHGUI_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <opencv2/opencv.hpp>
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "core.h"
|
||||
|
||||
// Window
|
||||
void Window_New(const char* winname, int flags);
|
||||
void Window_Close(const char* winname);
|
||||
void Window_IMShow(const char* winname, Mat mat);
|
||||
double Window_GetProperty(const char* winname, int flag);
|
||||
void Window_SetProperty(const char* winname, int flag, double value);
|
||||
void Window_SetTitle(const char* winname, const char* title);
|
||||
int Window_WaitKey(int);
|
||||
void Window_Move(const char* winname, int x, int y);
|
||||
void Window_Resize(const char* winname, int width, int height);
|
||||
struct Rect Window_SelectROI(const char* winname, Mat img);
|
||||
struct Rects Window_SelectROIs(const char* winname, Mat img);
|
||||
|
||||
// Trackbar
|
||||
void Trackbar_Create(const char* winname, const char* trackname, int max);
|
||||
void Trackbar_CreateWithValue(const char* winname, const char* trackname, int* value, int max);
|
||||
int Trackbar_GetPos(const char* winname, const char* trackname);
|
||||
void Trackbar_SetPos(const char* winname, const char* trackname, int pos);
|
||||
void Trackbar_SetMin(const char* winname, const char* trackname, int pos);
|
||||
void Trackbar_SetMax(const char* winname, const char* trackname, int pos);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //_OPENCV3_HIGHGUI_H_
|
35
vendor/gocv.io/x/gocv/highgui_string.go
generated
vendored
35
vendor/gocv.io/x/gocv/highgui_string.go
generated
vendored
@ -1,35 +0,0 @@
|
||||
package gocv
|
||||
|
||||
/*
|
||||
#include <stdlib.h>
|
||||
#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 ""
|
||||
}
|
44
vendor/gocv.io/x/gocv/imgcodecs.cpp
generated
vendored
44
vendor/gocv.io/x/gocv/imgcodecs.cpp
generated
vendored
@ -1,44 +0,0 @@
|
||||
#include "imgcodecs.h"
|
||||
|
||||
// Image
|
||||
Mat Image_IMRead(const char* filename, int flags) {
|
||||
cv::Mat img = cv::imread(filename, flags);
|
||||
return new cv::Mat(img);
|
||||
}
|
||||
|
||||
|
||||
bool Image_IMWrite(const char* filename, Mat img) {
|
||||
return cv::imwrite(filename, *img);
|
||||
}
|
||||
|
||||
bool Image_IMWrite_WithParams(const char* filename, Mat img, IntVector params) {
|
||||
std::vector<int> compression_params;
|
||||
|
||||
for (int i = 0, *v = params.val; i < params.length; ++v, ++i) {
|
||||
compression_params.push_back(*v);
|
||||
}
|
||||
|
||||
return cv::imwrite(filename, *img, compression_params);
|
||||
}
|
||||
|
||||
void Image_IMEncode(const char* fileExt, Mat img, void* vector) {
|
||||
auto vectorPtr = reinterpret_cast<std::vector<uchar> *>(vector);
|
||||
cv::imencode(fileExt, *img, *vectorPtr);
|
||||
}
|
||||
|
||||
void Image_IMEncode_WithParams(const char* fileExt, Mat img, IntVector params, void* vector) {
|
||||
auto vectorPtr = reinterpret_cast<std::vector<uchar> *>(vector);
|
||||
std::vector<int> compression_params;
|
||||
|
||||
for (int i = 0, *v = params.val; i < params.length; ++v, ++i) {
|
||||
compression_params.push_back(*v);
|
||||
}
|
||||
|
||||
cv::imencode(fileExt, *img, *vectorPtr, compression_params);
|
||||
}
|
||||
|
||||
Mat Image_IMDecode(ByteArray buf, int flags) {
|
||||
std::vector<uchar> data(buf.data, buf.data + buf.length);
|
||||
cv::Mat img = cv::imdecode(data, flags);
|
||||
return new cv::Mat(img);
|
||||
}
|
252
vendor/gocv.io/x/gocv/imgcodecs.go
generated
vendored
252
vendor/gocv.io/x/gocv/imgcodecs.go
generated
vendored
@ -1,252 +0,0 @@
|
||||
package gocv
|
||||
|
||||
/*
|
||||
#include <stdlib.h>
|
||||
#include "imgcodecs.h"
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// IMReadFlag is one of the valid flags to use for the IMRead function.
|
||||
type IMReadFlag int
|
||||
|
||||
const (
|
||||
// IMReadUnchanged return the loaded image as is (with alpha channel,
|
||||
// otherwise it gets cropped).
|
||||
IMReadUnchanged IMReadFlag = -1
|
||||
|
||||
// IMReadGrayScale always convert image to the single channel
|
||||
// grayscale image.
|
||||
IMReadGrayScale IMReadFlag = 0
|
||||
|
||||
// IMReadColor always converts image to the 3 channel BGR color image.
|
||||
IMReadColor IMReadFlag = 1
|
||||
|
||||
// IMReadAnyDepth returns 16-bit/32-bit image when the input has the corresponding
|
||||
// depth, otherwise convert it to 8-bit.
|
||||
IMReadAnyDepth IMReadFlag = 2
|
||||
|
||||
// IMReadAnyColor the image is read in any possible color format.
|
||||
IMReadAnyColor IMReadFlag = 4
|
||||
|
||||
// IMReadLoadGDAL uses the gdal driver for loading the image.
|
||||
IMReadLoadGDAL IMReadFlag = 8
|
||||
|
||||
// IMReadReducedGrayscale2 always converts image to the single channel grayscale image
|
||||
// and the image size reduced 1/2.
|
||||
IMReadReducedGrayscale2 IMReadFlag = 16
|
||||
|
||||
// IMReadReducedColor2 always converts image to the 3 channel BGR color image and the
|
||||
// image size reduced 1/2.
|
||||
IMReadReducedColor2 IMReadFlag = 17
|
||||
|
||||
// IMReadReducedGrayscale4 always converts image to the single channel grayscale image and
|
||||
// the image size reduced 1/4.
|
||||
IMReadReducedGrayscale4 IMReadFlag = 32
|
||||
|
||||
// IMReadReducedColor4 always converts image to the 3 channel BGR color image and
|
||||
// the image size reduced 1/4.
|
||||
IMReadReducedColor4 IMReadFlag = 33
|
||||
|
||||
// IMReadReducedGrayscale8 always convert image to the single channel grayscale image and
|
||||
// the image size reduced 1/8.
|
||||
IMReadReducedGrayscale8 IMReadFlag = 64
|
||||
|
||||
// IMReadReducedColor8 always convert image to the 3 channel BGR color image and the
|
||||
// image size reduced 1/8.
|
||||
IMReadReducedColor8 IMReadFlag = 65
|
||||
|
||||
// IMReadIgnoreOrientation do not rotate the image according to EXIF's orientation flag.
|
||||
IMReadIgnoreOrientation IMReadFlag = 128
|
||||
)
|
||||
|
||||
// TODO: Define IMWriteFlag type?
|
||||
|
||||
const (
|
||||
//IMWriteJpegQuality is the quality from 0 to 100 for JPEG (the higher is the better). Default value is 95.
|
||||
IMWriteJpegQuality = 1
|
||||
|
||||
// IMWriteJpegProgressive enables JPEG progressive feature, 0 or 1, default is False.
|
||||
IMWriteJpegProgressive = 2
|
||||
|
||||
// IMWriteJpegOptimize enables JPEG optimization, 0 or 1, default is False.
|
||||
IMWriteJpegOptimize = 3
|
||||
|
||||
// IMWriteJpegRstInterval is the JPEG restart interval, 0 - 65535, default is 0 - no restart.
|
||||
IMWriteJpegRstInterval = 4
|
||||
|
||||
// IMWriteJpegLumaQuality separates luma quality level, 0 - 100, default is 0 - don't use.
|
||||
IMWriteJpegLumaQuality = 5
|
||||
|
||||
// IMWriteJpegChromaQuality separates chroma quality level, 0 - 100, default is 0 - don't use.
|
||||
IMWriteJpegChromaQuality = 6
|
||||
|
||||
// IMWritePngCompression is the compression level from 0 to 9 for PNG. A
|
||||
// higher value means a smaller size and longer compression time.
|
||||
// If specified, strategy is changed to IMWRITE_PNG_STRATEGY_DEFAULT (Z_DEFAULT_STRATEGY).
|
||||
// Default value is 1 (best speed setting).
|
||||
IMWritePngCompression = 16
|
||||
|
||||
// IMWritePngStrategy is one of cv::IMWritePNGFlags, default is IMWRITE_PNG_STRATEGY_RLE.
|
||||
IMWritePngStrategy = 17
|
||||
|
||||
// IMWritePngBilevel is the binary level PNG, 0 or 1, default is 0.
|
||||
IMWritePngBilevel = 18
|
||||
|
||||
// IMWritePxmBinary for PPM, PGM, or PBM can be a binary format flag, 0 or 1. Default value is 1.
|
||||
IMWritePxmBinary = 32
|
||||
|
||||
// IMWriteWebpQuality is the quality from 1 to 100 for WEBP (the higher is
|
||||
// the better). By default (without any parameter) and for quality above
|
||||
// 100 the lossless compression is used.
|
||||
IMWriteWebpQuality = 64
|
||||
|
||||
// IMWritePamTupletype sets the TUPLETYPE field to the corresponding string
|
||||
// value that is defined for the format.
|
||||
IMWritePamTupletype = 128
|
||||
|
||||
// IMWritePngStrategyDefault is the value to use for normal data.
|
||||
IMWritePngStrategyDefault = 0
|
||||
|
||||
// IMWritePngStrategyFiltered is the value to use for data produced by a
|
||||
// filter (or predictor). Filtered data consists mostly of small values
|
||||
// with a somewhat random distribution. In this case, the compression
|
||||
// algorithm is tuned to compress them better.
|
||||
IMWritePngStrategyFiltered = 1
|
||||
|
||||
// IMWritePngStrategyHuffmanOnly forces Huffman encoding only (no string match).
|
||||
IMWritePngStrategyHuffmanOnly = 2
|
||||
|
||||
// IMWritePngStrategyRle is the value to use to limit match distances to
|
||||
// one (run-length encoding).
|
||||
IMWritePngStrategyRle = 3
|
||||
|
||||
// IMWritePngStrategyFixed is the value to prevent the use of dynamic
|
||||
// Huffman codes, allowing for a simpler decoder for special applications.
|
||||
IMWritePngStrategyFixed = 4
|
||||
)
|
||||
|
||||
// IMRead reads an image from a file into a Mat.
|
||||
// The flags param is one of the IMReadFlag flags.
|
||||
// If the image cannot be read (because of missing file, improper permissions,
|
||||
// unsupported or invalid format), the function returns an empty Mat.
|
||||
//
|
||||
// For further details, please see:
|
||||
// http://docs.opencv.org/master/d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56
|
||||
//
|
||||
func IMRead(name string, flags IMReadFlag) Mat {
|
||||
cName := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
return newMat(C.Image_IMRead(cName, C.int(flags)))
|
||||
}
|
||||
|
||||
// IMWrite writes a Mat to an image file.
|
||||
//
|
||||
// For further details, please see:
|
||||
// http://docs.opencv.org/master/d4/da8/group__imgcodecs.html#gabbc7ef1aa2edfaa87772f1202d67e0ce
|
||||
//
|
||||
func IMWrite(name string, img Mat) bool {
|
||||
cName := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
return bool(C.Image_IMWrite(cName, img.p))
|
||||
}
|
||||
|
||||
// IMWriteWithParams writes a Mat to an image file. With that func you can
|
||||
// pass compression parameters.
|
||||
//
|
||||
// For further details, please see:
|
||||
// http://docs.opencv.org/master/d4/da8/group__imgcodecs.html#gabbc7ef1aa2edfaa87772f1202d67e0ce
|
||||
//
|
||||
func IMWriteWithParams(name string, img Mat, params []int) bool {
|
||||
cName := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
cparams := []C.int{}
|
||||
|
||||
for _, v := range params {
|
||||
cparams = append(cparams, C.int(v))
|
||||
}
|
||||
|
||||
paramsVector := C.struct_IntVector{}
|
||||
paramsVector.val = (*C.int)(&cparams[0])
|
||||
paramsVector.length = (C.int)(len(cparams))
|
||||
|
||||
return bool(C.Image_IMWrite_WithParams(cName, img.p, paramsVector))
|
||||
}
|
||||
|
||||
// FileExt represents a file extension.
|
||||
type FileExt string
|
||||
|
||||
const (
|
||||
// PNGFileExt is the file extension for PNG.
|
||||
PNGFileExt FileExt = ".png"
|
||||
// JPEGFileExt is the file extension for JPEG.
|
||||
JPEGFileExt FileExt = ".jpg"
|
||||
// GIFFileExt is the file extension for GIF.
|
||||
GIFFileExt FileExt = ".gif"
|
||||
)
|
||||
|
||||
// IMEncode encodes an image Mat into a memory buffer.
|
||||
// This function compresses the image and stores it in the returned memory buffer,
|
||||
// using the image format passed in in the form of a file extension string.
|
||||
//
|
||||
// For further details, please see:
|
||||
// http://docs.opencv.org/master/d4/da8/group__imgcodecs.html#ga461f9ac09887e47797a54567df3b8b63
|
||||
//
|
||||
func IMEncode(fileExt FileExt, img Mat) (buf *NativeByteBuffer, err error) {
|
||||
cfileExt := C.CString(string(fileExt))
|
||||
defer C.free(unsafe.Pointer(cfileExt))
|
||||
|
||||
buffer := newNativeByteBuffer()
|
||||
C.Image_IMEncode(cfileExt, img.Ptr(), buffer.nativePointer())
|
||||
return buffer, nil
|
||||
}
|
||||
|
||||
// IMEncodeWithParams encodes an image Mat into a memory buffer.
|
||||
// This function compresses the image and stores it in the returned memory buffer,
|
||||
// using the image format passed in in the form of a file extension string.
|
||||
//
|
||||
// Usage example:
|
||||
// buffer, err := gocv.IMEncodeWithParams(gocv.JPEGFileExt, img, []int{gocv.IMWriteJpegQuality, quality})
|
||||
//
|
||||
// For further details, please see:
|
||||
// http://docs.opencv.org/master/d4/da8/group__imgcodecs.html#ga461f9ac09887e47797a54567df3b8b63
|
||||
//
|
||||
func IMEncodeWithParams(fileExt FileExt, img Mat, params []int) (buf *NativeByteBuffer, err error) {
|
||||
cfileExt := C.CString(string(fileExt))
|
||||
defer C.free(unsafe.Pointer(cfileExt))
|
||||
|
||||
cparams := []C.int{}
|
||||
|
||||
for _, v := range params {
|
||||
cparams = append(cparams, C.int(v))
|
||||
}
|
||||
|
||||
paramsVector := C.struct_IntVector{}
|
||||
paramsVector.val = (*C.int)(&cparams[0])
|
||||
paramsVector.length = (C.int)(len(cparams))
|
||||
|
||||
b := newNativeByteBuffer()
|
||||
C.Image_IMEncode_WithParams(cfileExt, img.Ptr(), paramsVector, b.nativePointer())
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// IMDecode reads an image from a buffer in memory.
|
||||
// The function IMDecode reads an image from the specified buffer in memory.
|
||||
// If the buffer is too short or contains invalid data, the function
|
||||
// returns an empty matrix.
|
||||
//
|
||||
// For further details, please see:
|
||||
// https://docs.opencv.org/master/d4/da8/group__imgcodecs.html#ga26a67788faa58ade337f8d28ba0eb19e
|
||||
//
|
||||
func IMDecode(buf []byte, flags IMReadFlag) (Mat, error) {
|
||||
data, err := toByteArray(buf)
|
||||
if err != nil {
|
||||
return Mat{}, err
|
||||
}
|
||||
return newMat(C.Image_IMDecode(*data, C.int(flags))), nil
|
||||
}
|
25
vendor/gocv.io/x/gocv/imgcodecs.h
generated
vendored
25
vendor/gocv.io/x/gocv/imgcodecs.h
generated
vendored
@ -1,25 +0,0 @@
|
||||
#ifndef _OPENCV3_IMGCODECS_H_
|
||||
#define _OPENCV3_IMGCODECS_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <opencv2/opencv.hpp>
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "core.h"
|
||||
|
||||
Mat Image_IMRead(const char* filename, int flags);
|
||||
bool Image_IMWrite(const char* filename, Mat img);
|
||||
bool Image_IMWrite_WithParams(const char* filename, Mat img, IntVector params);
|
||||
void Image_IMEncode(const char* fileExt, Mat img, void* vector);
|
||||
|
||||
void Image_IMEncode_WithParams(const char* fileExt, Mat img, IntVector params, void* vector);
|
||||
Mat Image_IMDecode(ByteArray buf, int flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //_OPENCV3_IMGCODECS_H_
|
671
vendor/gocv.io/x/gocv/imgproc.cpp
generated
vendored
671
vendor/gocv.io/x/gocv/imgproc.cpp
generated
vendored
@ -1,671 +0,0 @@
|
||||
#include "imgproc.h"
|
||||
|
||||
double ArcLength(PointVector curve, bool is_closed) {
|
||||
return cv::arcLength(*curve, is_closed);
|
||||
}
|
||||
|
||||
PointVector ApproxPolyDP(PointVector curve, double epsilon, bool closed) {
|
||||
PointVector approxCurvePts = new std::vector<cv::Point>;
|
||||
cv::approxPolyDP(*curve, *approxCurvePts, epsilon, closed);
|
||||
|
||||
return approxCurvePts;
|
||||
}
|
||||
|
||||
void CvtColor(Mat src, Mat dst, int code) {
|
||||
cv::cvtColor(*src, *dst, code);
|
||||
}
|
||||
|
||||
void EqualizeHist(Mat src, Mat dst) {
|
||||
cv::equalizeHist(*src, *dst);
|
||||
}
|
||||
|
||||
void CalcHist(struct Mats mats, IntVector chans, Mat mask, Mat hist, IntVector sz, FloatVector rng, bool acc) {
|
||||
std::vector<cv::Mat> images;
|
||||
|
||||
for (int i = 0; i < mats.length; ++i) {
|
||||
images.push_back(*mats.mats[i]);
|
||||
}
|
||||
|
||||
std::vector<int> channels;
|
||||
|
||||
for (int i = 0, *v = chans.val; i < chans.length; ++v, ++i) {
|
||||
channels.push_back(*v);
|
||||
}
|
||||
|
||||
std::vector<int> histSize;
|
||||
|
||||
for (int i = 0, *v = sz.val; i < sz.length; ++v, ++i) {
|
||||
histSize.push_back(*v);
|
||||
}
|
||||
|
||||
std::vector<float> ranges;
|
||||
|
||||
float* f;
|
||||
int i;
|
||||
for (i = 0, f = rng.val; i < rng.length; ++f, ++i) {
|
||||
ranges.push_back(*f);
|
||||
}
|
||||
|
||||
cv::calcHist(images, channels, *mask, *hist, histSize, ranges, acc);
|
||||
}
|
||||
|
||||
void CalcBackProject(struct Mats mats, IntVector chans, Mat hist, Mat backProject, FloatVector rng, bool uniform){
|
||||
std::vector<cv::Mat> images;
|
||||
|
||||
for (int i = 0; i < mats.length; ++i) {
|
||||
images.push_back(*mats.mats[i]);
|
||||
}
|
||||
|
||||
std::vector<int> channels;
|
||||
for (int i = 0, *v = chans.val; i < chans.length; ++v, ++i) {
|
||||
channels.push_back(*v);
|
||||
}
|
||||
|
||||
std::vector<float> ranges;
|
||||
|
||||
float* f;
|
||||
int i;
|
||||
for (i = 0, f = rng.val; i < rng.length; ++f, ++i) {
|
||||
ranges.push_back(*f);
|
||||
}
|
||||
|
||||
cv::calcBackProject(images, channels, *hist, *backProject, ranges, uniform);
|
||||
}
|
||||
|
||||
double CompareHist(Mat hist1, Mat hist2, int method) {
|
||||
return cv::compareHist(*hist1, *hist2, method);
|
||||
}
|
||||
|
||||
struct RotatedRect FitEllipse(PointVector pts)
|
||||
{
|
||||
cv::RotatedRect bRect = cv::fitEllipse(*pts);
|
||||
|
||||
Rect r = {bRect.boundingRect().x, bRect.boundingRect().y, bRect.boundingRect().width, bRect.boundingRect().height};
|
||||
Point centrpt = {int(lroundf(bRect.center.x)), int(lroundf(bRect.center.y))};
|
||||
Size szsz = {int(lroundf(bRect.size.width)), int(lroundf(bRect.size.height))};
|
||||
|
||||
cv::Point2f* pts4 = new cv::Point2f[4];
|
||||
bRect.points(pts4);
|
||||
Point* rpts = new Point[4];
|
||||
for (size_t j = 0; j < 4; j++) {
|
||||
Point pt = {int(lroundf(pts4[j].x)), int(lroundf(pts4[j].y))};
|
||||
rpts[j] = pt;
|
||||
}
|
||||
|
||||
delete[] pts4;
|
||||
|
||||
RotatedRect rotRect = {Points{rpts, 4}, r, centrpt, szsz, bRect.angle};
|
||||
return rotRect;
|
||||
}
|
||||
|
||||
void ConvexHull(PointVector points, Mat hull, bool clockwise, bool returnPoints) {
|
||||
cv::convexHull(*points, *hull, clockwise, returnPoints);
|
||||
}
|
||||
|
||||
void ConvexityDefects(PointVector points, Mat hull, Mat result) {
|
||||
cv::convexityDefects(*points, *hull, *result);
|
||||
}
|
||||
|
||||
void BilateralFilter(Mat src, Mat dst, int d, double sc, double ss) {
|
||||
cv::bilateralFilter(*src, *dst, d, sc, ss);
|
||||
}
|
||||
|
||||
void Blur(Mat src, Mat dst, Size ps) {
|
||||
cv::Size sz(ps.width, ps.height);
|
||||
cv::blur(*src, *dst, sz);
|
||||
}
|
||||
|
||||
void BoxFilter(Mat src, Mat dst, int ddepth, Size ps) {
|
||||
cv::Size sz(ps.width, ps.height);
|
||||
cv::boxFilter(*src, *dst, ddepth, sz);
|
||||
}
|
||||
|
||||
void SqBoxFilter(Mat src, Mat dst, int ddepth, Size ps) {
|
||||
cv::Size sz(ps.width, ps.height);
|
||||
cv::sqrBoxFilter(*src, *dst, ddepth, sz);
|
||||
}
|
||||
|
||||
void Dilate(Mat src, Mat dst, Mat kernel) {
|
||||
cv::dilate(*src, *dst, *kernel);
|
||||
}
|
||||
|
||||
void DilateWithParams(Mat src, Mat dst, Mat kernel, Point anchor, int iterations, int borderType, Scalar borderValue) {
|
||||
cv::Point pt1(anchor.x, anchor.y);
|
||||
cv::Scalar c = cv::Scalar(borderValue.val1, borderValue.val2, borderValue.val3, borderValue.val4);
|
||||
|
||||
cv::dilate(*src, *dst, *kernel, pt1, iterations, borderType, c);
|
||||
}
|
||||
|
||||
void DistanceTransform(Mat src, Mat dst, Mat labels, int distanceType, int maskSize, int labelType) {
|
||||
cv::distanceTransform(*src, *dst, *labels, distanceType, maskSize, labelType);
|
||||
}
|
||||
|
||||
void Erode(Mat src, Mat dst, Mat kernel) {
|
||||
cv::erode(*src, *dst, *kernel);
|
||||
}
|
||||
|
||||
void ErodeWithParams(Mat src, Mat dst, Mat kernel, Point anchor, int iterations, int borderType) {
|
||||
cv::Point pt1(anchor.x, anchor.y);
|
||||
|
||||
cv::erode(*src, *dst, *kernel, pt1, iterations, borderType, cv::morphologyDefaultBorderValue());
|
||||
}
|
||||
|
||||
void MatchTemplate(Mat image, Mat templ, Mat result, int method, Mat mask) {
|
||||
cv::matchTemplate(*image, *templ, *result, method, *mask);
|
||||
}
|
||||
|
||||
struct Moment Moments(Mat src, bool binaryImage) {
|
||||
cv::Moments m = cv::moments(*src, binaryImage);
|
||||
Moment mom = {m.m00, m.m10, m.m01, m.m20, m.m11, m.m02, m.m30, m.m21, m.m12, m.m03,
|
||||
m.mu20, m.mu11, m.mu02, m.mu30, m.mu21, m.mu12, m.mu03,
|
||||
m.nu20, m.nu11, m.nu02, m.nu30, m.nu21, m.nu12, m.nu03
|
||||
};
|
||||
return mom;
|
||||
}
|
||||
|
||||
void PyrDown(Mat src, Mat dst, Size size, int borderType) {
|
||||
cv::Size cvSize(size.width, size.height);
|
||||
cv::pyrDown(*src, *dst, cvSize, borderType);
|
||||
}
|
||||
|
||||
void PyrUp(Mat src, Mat dst, Size size, int borderType) {
|
||||
cv::Size cvSize(size.width, size.height);
|
||||
cv::pyrUp(*src, *dst, cvSize, borderType);
|
||||
}
|
||||
|
||||
struct Rect BoundingRect(PointVector pts) {
|
||||
cv::Rect bRect = cv::boundingRect(*pts);
|
||||
Rect r = {bRect.x, bRect.y, bRect.width, bRect.height};
|
||||
return r;
|
||||
}
|
||||
|
||||
void BoxPoints(RotatedRect rect, Mat boxPts){
|
||||
cv::Point2f centerPt(rect.center.x , rect.center.y);
|
||||
cv::Size2f rSize(rect.size.width, rect.size.height);
|
||||
cv::RotatedRect rotatedRectangle(centerPt, rSize, rect.angle);
|
||||
cv::boxPoints(rotatedRectangle, *boxPts);
|
||||
}
|
||||
|
||||
double ContourArea(PointVector pts) {
|
||||
return cv::contourArea(*pts);
|
||||
}
|
||||
|
||||
struct RotatedRect MinAreaRect(PointVector pts){
|
||||
cv::RotatedRect cvrect = cv::minAreaRect(*pts);
|
||||
|
||||
Point* rpts = new Point[4];
|
||||
cv::Point2f* pts4 = new cv::Point2f[4];
|
||||
cvrect.points(pts4);
|
||||
|
||||
for (size_t j = 0; j < 4; j++) {
|
||||
Point pt = {int(lroundf(pts4[j].x)), int(lroundf(pts4[j].y))};
|
||||
rpts[j] = pt;
|
||||
}
|
||||
|
||||
delete[] pts4;
|
||||
|
||||
cv::Rect bRect = cvrect.boundingRect();
|
||||
Rect r = {bRect.x, bRect.y, bRect.width, bRect.height};
|
||||
Point centrpt = {int(lroundf(cvrect.center.x)), int(lroundf(cvrect.center.y))};
|
||||
Size szsz = {int(lroundf(cvrect.size.width)), int(lroundf(cvrect.size.height))};
|
||||
|
||||
RotatedRect retrect = {(Contour){rpts, 4}, r, centrpt, szsz, cvrect.angle};
|
||||
return retrect;
|
||||
}
|
||||
|
||||
void MinEnclosingCircle(PointVector pts, Point2f* center, float* radius){
|
||||
cv::Point2f center2f;
|
||||
cv::minEnclosingCircle(*pts, center2f, *radius);
|
||||
center->x = center2f.x;
|
||||
center->y = center2f.y;
|
||||
}
|
||||
|
||||
PointsVector FindContours(Mat src, Mat hierarchy, int mode, int method) {
|
||||
PointsVector contours = new std::vector<std::vector<cv::Point> >;
|
||||
cv::findContours(*src, *contours, *hierarchy, mode, method);
|
||||
|
||||
return contours;
|
||||
}
|
||||
|
||||
double PointPolygonTest(PointVector pts, Point pt, bool measureDist) {
|
||||
cv::Point2f pt1(pt.x, pt.y);
|
||||
|
||||
return cv::pointPolygonTest(*pts, pt1, measureDist);
|
||||
}
|
||||
|
||||
int ConnectedComponents(Mat src, Mat labels, int connectivity, int ltype, int ccltype){
|
||||
return cv::connectedComponents(*src, *labels, connectivity, ltype, ccltype);
|
||||
}
|
||||
|
||||
|
||||
int ConnectedComponentsWithStats(Mat src, Mat labels, Mat stats, Mat centroids,
|
||||
int connectivity, int ltype, int ccltype){
|
||||
return cv::connectedComponentsWithStats(*src, *labels, *stats, *centroids, connectivity, ltype, ccltype);
|
||||
}
|
||||
|
||||
Mat GetStructuringElement(int shape, Size ksize) {
|
||||
cv::Size sz(ksize.width, ksize.height);
|
||||
return new cv::Mat(cv::getStructuringElement(shape, sz));
|
||||
}
|
||||
|
||||
Scalar MorphologyDefaultBorderValue(){
|
||||
cv::Scalar cs = cv::morphologyDefaultBorderValue();
|
||||
return (Scalar){cs[0],cs[1],cs[2],cs[3]};
|
||||
}
|
||||
|
||||
void MorphologyEx(Mat src, Mat dst, int op, Mat kernel) {
|
||||
cv::morphologyEx(*src, *dst, op, *kernel);
|
||||
}
|
||||
|
||||
void MorphologyExWithParams(Mat src, Mat dst, int op, Mat kernel, Point pt, int iterations, int borderType) {
|
||||
cv::Point pt1(pt.x, pt.y);
|
||||
cv::morphologyEx(*src, *dst, op, *kernel, pt1, iterations, borderType);
|
||||
}
|
||||
|
||||
void GaussianBlur(Mat src, Mat dst, Size ps, double sX, double sY, int bt) {
|
||||
cv::Size sz(ps.width, ps.height);
|
||||
cv::GaussianBlur(*src, *dst, sz, sX, sY, bt);
|
||||
}
|
||||
|
||||
Mat GetGaussianKernel(int ksize, double sigma, int ktype){
|
||||
return new cv::Mat(cv::getGaussianKernel(ksize, sigma, ktype));
|
||||
}
|
||||
|
||||
void Laplacian(Mat src, Mat dst, int dDepth, int kSize, double scale, double delta,
|
||||
int borderType) {
|
||||
cv::Laplacian(*src, *dst, dDepth, kSize, scale, delta, borderType);
|
||||
}
|
||||
|
||||
void Scharr(Mat src, Mat dst, int dDepth, int dx, int dy, double scale, double delta,
|
||||
int borderType) {
|
||||
cv::Scharr(*src, *dst, dDepth, dx, dy, scale, delta, borderType);
|
||||
}
|
||||
|
||||
void MedianBlur(Mat src, Mat dst, int ksize) {
|
||||
cv::medianBlur(*src, *dst, ksize);
|
||||
}
|
||||
|
||||
void Canny(Mat src, Mat edges, double t1, double t2) {
|
||||
cv::Canny(*src, *edges, t1, t2);
|
||||
}
|
||||
|
||||
void CornerSubPix(Mat img, Mat corners, Size winSize, Size zeroZone, TermCriteria criteria) {
|
||||
cv::Size wsz(winSize.width, winSize.height);
|
||||
cv::Size zsz(zeroZone.width, zeroZone.height);
|
||||
cv::cornerSubPix(*img, *corners, wsz, zsz, *criteria);
|
||||
}
|
||||
|
||||
void GoodFeaturesToTrack(Mat img, Mat corners, int maxCorners, double quality, double minDist) {
|
||||
cv::goodFeaturesToTrack(*img, *corners, maxCorners, quality, minDist);
|
||||
}
|
||||
|
||||
void GrabCut(Mat img, Mat mask, Rect r, Mat bgdModel, Mat fgdModel, int iterCount, int mode) {
|
||||
cv::Rect cvRect = cv::Rect(r.x, r.y, r.width, r.height);
|
||||
cv::grabCut(*img, *mask, cvRect, *bgdModel, *fgdModel, iterCount, mode);
|
||||
}
|
||||
|
||||
void HoughCircles(Mat src, Mat circles, int method, double dp, double minDist) {
|
||||
cv::HoughCircles(*src, *circles, method, dp, minDist);
|
||||
}
|
||||
|
||||
void HoughCirclesWithParams(Mat src, Mat circles, int method, double dp, double minDist,
|
||||
double param1, double param2, int minRadius, int maxRadius) {
|
||||
cv::HoughCircles(*src, *circles, method, dp, minDist, param1, param2, minRadius, maxRadius);
|
||||
}
|
||||
|
||||
void HoughLines(Mat src, Mat lines, double rho, double theta, int threshold) {
|
||||
cv::HoughLines(*src, *lines, rho, theta, threshold);
|
||||
}
|
||||
|
||||
void HoughLinesP(Mat src, Mat lines, double rho, double theta, int threshold) {
|
||||
cv::HoughLinesP(*src, *lines, rho, theta, threshold);
|
||||
}
|
||||
|
||||
void HoughLinesPWithParams(Mat src, Mat lines, double rho, double theta, int threshold, double minLineLength, double maxLineGap) {
|
||||
cv::HoughLinesP(*src, *lines, rho, theta, threshold, minLineLength, maxLineGap);
|
||||
}
|
||||
|
||||
void HoughLinesPointSet(Mat points, Mat lines, int linesMax, int threshold,
|
||||
double minRho, double maxRho, double rhoStep,
|
||||
double minTheta, double maxTheta, double thetaStep) {
|
||||
cv::HoughLinesPointSet(*points, *lines, linesMax, threshold,
|
||||
minRho, maxRho, rhoStep, minTheta, maxTheta, thetaStep );
|
||||
}
|
||||
|
||||
void Integral(Mat src, Mat sum, Mat sqsum, Mat tilted) {
|
||||
cv::integral(*src, *sum, *sqsum, *tilted);
|
||||
}
|
||||
|
||||
double Threshold(Mat src, Mat dst, double thresh, double maxvalue, int typ) {
|
||||
return cv::threshold(*src, *dst, thresh, maxvalue, typ);
|
||||
}
|
||||
|
||||
void AdaptiveThreshold(Mat src, Mat dst, double maxValue, int adaptiveMethod, int thresholdType,
|
||||
int blockSize, double c) {
|
||||
cv::adaptiveThreshold(*src, *dst, maxValue, adaptiveMethod, thresholdType, blockSize, c);
|
||||
}
|
||||
|
||||
void ArrowedLine(Mat img, Point pt1, Point pt2, Scalar color, int thickness) {
|
||||
cv::Point p1(pt1.x, pt1.y);
|
||||
cv::Point p2(pt2.x, pt2.y);
|
||||
cv::Scalar c = cv::Scalar(color.val1, color.val2, color.val3, color.val4);
|
||||
|
||||
cv::arrowedLine(*img, p1, p2, c, thickness);
|
||||
}
|
||||
|
||||
bool ClipLine(Size imgSize, Point pt1, Point pt2) {
|
||||
cv::Size sz(imgSize.width, imgSize.height);
|
||||
cv::Point p1(pt1.x, pt1.y);
|
||||
cv::Point p2(pt2.x, pt2.y);
|
||||
|
||||
return cv::clipLine(sz, p1, p2);
|
||||
}
|
||||
|
||||
void Circle(Mat img, Point center, int radius, Scalar color, int thickness) {
|
||||
cv::Point p1(center.x, center.y);
|
||||
cv::Scalar c = cv::Scalar(color.val1, color.val2, color.val3, color.val4);
|
||||
|
||||
cv::circle(*img, p1, radius, c, thickness);
|
||||
}
|
||||
|
||||
void CircleWithParams(Mat img, Point center, int radius, Scalar color, int thickness, int lineType, int shift) {
|
||||
cv::Point p1(center.x, center.y);
|
||||
cv::Scalar c = cv::Scalar(color.val1, color.val2, color.val3, color.val4);
|
||||
|
||||
cv::circle(*img, p1, radius, c, thickness, lineType, shift);
|
||||
}
|
||||
|
||||
void Ellipse(Mat img, Point center, Point axes, double angle, double
|
||||
startAngle, double endAngle, Scalar color, int thickness) {
|
||||
cv::Point p1(center.x, center.y);
|
||||
cv::Point p2(axes.x, axes.y);
|
||||
cv::Scalar c = cv::Scalar(color.val1, color.val2, color.val3, color.val4);
|
||||
|
||||
cv::ellipse(*img, p1, p2, angle, startAngle, endAngle, c, thickness);
|
||||
}
|
||||
|
||||
void EllipseWithParams(Mat img, Point center, Point axes, double angle, double
|
||||
startAngle, double endAngle, Scalar color, int thickness, int lineType, int shift) {
|
||||
cv::Point p1(center.x, center.y);
|
||||
cv::Point p2(axes.x, axes.y);
|
||||
cv::Scalar c = cv::Scalar(color.val1, color.val2, color.val3, color.val4);
|
||||
|
||||
cv::ellipse(*img, p1, p2, angle, startAngle, endAngle, c, thickness, lineType, shift);
|
||||
}
|
||||
|
||||
void Line(Mat img, Point pt1, Point pt2, Scalar color, int thickness) {
|
||||
cv::Point p1(pt1.x, pt1.y);
|
||||
cv::Point p2(pt2.x, pt2.y);
|
||||
cv::Scalar c = cv::Scalar(color.val1, color.val2, color.val3, color.val4);
|
||||
|
||||
cv::line(*img, p1, p2, c, thickness);
|
||||
}
|
||||
|
||||
void Rectangle(Mat img, Rect r, Scalar color, int thickness) {
|
||||
cv::Scalar c = cv::Scalar(color.val1, color.val2, color.val3, color.val4);
|
||||
cv::rectangle(
|
||||
*img,
|
||||
cv::Point(r.x, r.y),
|
||||
cv::Point(r.x + r.width, r.y + r.height),
|
||||
c,
|
||||
thickness,
|
||||
cv::LINE_AA
|
||||
);
|
||||
}
|
||||
|
||||
void RectangleWithParams(Mat img, Rect r, Scalar color, int thickness, int lineType, int shift) {
|
||||
cv::Scalar c = cv::Scalar(color.val1, color.val2, color.val3, color.val4);
|
||||
cv::rectangle(
|
||||
*img,
|
||||
cv::Point(r.x, r.y),
|
||||
cv::Point(r.x + r.width, r.y + r.height),
|
||||
c,
|
||||
thickness,
|
||||
lineType,
|
||||
shift
|
||||
);
|
||||
}
|
||||
|
||||
void FillPoly(Mat img, PointsVector pts, Scalar color) {
|
||||
cv::Scalar c = cv::Scalar(color.val1, color.val2, color.val3, color.val4);
|
||||
|
||||
cv::fillPoly(*img, *pts, c);
|
||||
}
|
||||
|
||||
void FillPolyWithParams(Mat img, PointsVector pts, Scalar color, int lineType, int shift, Point offset) {
|
||||
cv::Scalar c = cv::Scalar(color.val1, color.val2, color.val3, color.val4);
|
||||
|
||||
cv::fillPoly(*img, *pts, c, lineType, shift, cv::Point(offset.x, offset.y));
|
||||
}
|
||||
|
||||
void Polylines(Mat img, PointsVector pts, bool isClosed, Scalar color,int thickness) {
|
||||
cv::Scalar c = cv::Scalar(color.val1, color.val2, color.val3, color.val4);
|
||||
|
||||
cv::polylines(*img, *pts, isClosed, c, thickness);
|
||||
}
|
||||
|
||||
struct Size GetTextSize(const char* text, int fontFace, double fontScale, int thickness) {
|
||||
return GetTextSizeWithBaseline(text, fontFace, fontScale, thickness, NULL);
|
||||
}
|
||||
|
||||
struct Size GetTextSizeWithBaseline(const char* text, int fontFace, double fontScale, int thickness, int* baesline) {
|
||||
cv::Size sz = cv::getTextSize(text, fontFace, fontScale, thickness, baesline);
|
||||
Size size = {sz.width, sz.height};
|
||||
return size;
|
||||
}
|
||||
|
||||
void PutText(Mat img, const char* text, Point org, int fontFace, double fontScale,
|
||||
Scalar color, int thickness) {
|
||||
cv::Point pt(org.x, org.y);
|
||||
cv::Scalar c = cv::Scalar(color.val1, color.val2, color.val3, color.val4);
|
||||
cv::putText(*img, text, pt, fontFace, fontScale, c, thickness);
|
||||
}
|
||||
|
||||
void PutTextWithParams(Mat img, const char* text, Point org, int fontFace, double fontScale,
|
||||
Scalar color, int thickness, int lineType, bool bottomLeftOrigin) {
|
||||
cv::Point pt(org.x, org.y);
|
||||
cv::Scalar c = cv::Scalar(color.val1, color.val2, color.val3, color.val4);
|
||||
cv::putText(*img, text, pt, fontFace, fontScale, c, thickness, lineType, bottomLeftOrigin);
|
||||
}
|
||||
|
||||
void Resize(Mat src, Mat dst, Size dsize, double fx, double fy, int interp) {
|
||||
cv::Size sz(dsize.width, dsize.height);
|
||||
cv::resize(*src, *dst, sz, fx, fy, interp);
|
||||
}
|
||||
|
||||
void GetRectSubPix(Mat src, Size patchSize, Point center, Mat dst) {
|
||||
cv::Size sz(patchSize.width, patchSize.height);
|
||||
cv::Point pt(center.x, center.y);
|
||||
cv::getRectSubPix(*src, sz, pt, *dst);
|
||||
}
|
||||
|
||||
Mat GetRotationMatrix2D(Point center, double angle, double scale) {
|
||||
cv::Point pt(center.x, center.y);
|
||||
return new cv::Mat(cv::getRotationMatrix2D(pt, angle, scale));
|
||||
}
|
||||
|
||||
void WarpAffine(Mat src, Mat dst, Mat m, Size dsize) {
|
||||
cv::Size sz(dsize.width, dsize.height);
|
||||
cv::warpAffine(*src, *dst, *m, sz);
|
||||
}
|
||||
|
||||
void WarpAffineWithParams(Mat src, Mat dst, Mat rot_mat, Size dsize, int flags, int borderMode,
|
||||
Scalar borderValue) {
|
||||
cv::Size sz(dsize.width, dsize.height);
|
||||
cv::Scalar c = cv::Scalar(borderValue.val1, borderValue.val2, borderValue.val3, borderValue.val4);
|
||||
cv::warpAffine(*src, *dst, *rot_mat, sz, flags, borderMode, c);
|
||||
}
|
||||
|
||||
void WarpPerspective(Mat src, Mat dst, Mat m, Size dsize) {
|
||||
cv::Size sz(dsize.width, dsize.height);
|
||||
cv::warpPerspective(*src, *dst, *m, sz);
|
||||
}
|
||||
|
||||
void WarpPerspectiveWithParams(Mat src, Mat dst, Mat rot_mat, Size dsize, int flags, int borderMode,
|
||||
Scalar borderValue) {
|
||||
cv::Size sz(dsize.width, dsize.height);
|
||||
cv::Scalar c = cv::Scalar(borderValue.val1, borderValue.val2, borderValue.val3, borderValue.val4);
|
||||
cv::warpPerspective(*src, *dst, *rot_mat, sz, flags, borderMode, c);
|
||||
}
|
||||
|
||||
void Watershed(Mat image, Mat markers) {
|
||||
cv::watershed(*image, *markers);
|
||||
}
|
||||
|
||||
void ApplyColorMap(Mat src, Mat dst, int colormap) {
|
||||
cv::applyColorMap(*src, *dst, colormap);
|
||||
}
|
||||
|
||||
void ApplyCustomColorMap(Mat src, Mat dst, Mat colormap) {
|
||||
cv::applyColorMap(*src, *dst, *colormap);
|
||||
}
|
||||
|
||||
Mat GetPerspectiveTransform(PointVector src, PointVector dst) {
|
||||
std::vector<cv::Point2f> src_pts;
|
||||
copyPointVectorToPoint2fVector(src, &src_pts);
|
||||
|
||||
std::vector<cv::Point2f> dst_pts;
|
||||
copyPointVectorToPoint2fVector(dst, &dst_pts);
|
||||
|
||||
return new cv::Mat(cv::getPerspectiveTransform(src_pts, dst_pts));
|
||||
}
|
||||
|
||||
Mat GetPerspectiveTransform2f(Point2fVector src, Point2fVector dst) {
|
||||
return new cv::Mat(cv::getPerspectiveTransform(*src, *dst));
|
||||
}
|
||||
|
||||
Mat GetAffineTransform(PointVector src, PointVector dst) {
|
||||
std::vector<cv::Point2f> src_pts;
|
||||
copyPointVectorToPoint2fVector(src, &src_pts);
|
||||
|
||||
std::vector<cv::Point2f> dst_pts;
|
||||
copyPointVectorToPoint2fVector(dst, &dst_pts);
|
||||
|
||||
return new cv::Mat(cv::getAffineTransform(src_pts, dst_pts));
|
||||
}
|
||||
|
||||
Mat GetAffineTransform2f(Point2fVector src, Point2fVector dst) {
|
||||
return new cv::Mat(cv::getAffineTransform(*src, *dst));
|
||||
}
|
||||
|
||||
Mat FindHomography(Mat src, Mat dst, int method, double ransacReprojThreshold, Mat mask, const int maxIters, const double confidence) {
|
||||
return new cv::Mat(cv::findHomography(*src, *dst, method, ransacReprojThreshold, *mask, maxIters, confidence));
|
||||
}
|
||||
|
||||
void DrawContours(Mat src, PointsVector contours, int contourIdx, Scalar color, int thickness) {
|
||||
cv::Scalar c = cv::Scalar(color.val1, color.val2, color.val3, color.val4);
|
||||
cv::drawContours(*src, *contours, contourIdx, c, thickness);
|
||||
}
|
||||
|
||||
void DrawContoursWithParams(Mat src, PointsVector contours, int contourIdx, Scalar color, int thickness, int lineType, Mat hierarchy, int maxLevel, Point offset) {
|
||||
cv::Scalar c = cv::Scalar(color.val1, color.val2, color.val3, color.val4);
|
||||
cv::Point offsetPt(offset.x, offset.y);
|
||||
|
||||
std::vector<cv::Vec4i> vecHierarchy;
|
||||
if (hierarchy->empty() == 0) {
|
||||
for (int j = 0; j < hierarchy->cols; ++j) {
|
||||
vecHierarchy.push_back(hierarchy->at<cv::Vec4i>(0, j));
|
||||
}
|
||||
}
|
||||
cv::drawContours(*src, *contours, contourIdx, c, thickness, lineType, vecHierarchy, maxLevel, offsetPt);
|
||||
}
|
||||
|
||||
void Sobel(Mat src, Mat dst, int ddepth, int dx, int dy, int ksize, double scale, double delta, int borderType) {
|
||||
cv::Sobel(*src, *dst, ddepth, dx, dy, ksize, scale, delta, borderType);
|
||||
}
|
||||
|
||||
void SpatialGradient(Mat src, Mat dx, Mat dy, int ksize, int borderType) {
|
||||
cv::spatialGradient(*src, *dx, *dy, ksize, borderType);
|
||||
}
|
||||
|
||||
|
||||
void Remap(Mat src, Mat dst, Mat map1, Mat map2, int interpolation, int borderMode, Scalar borderValue) {
|
||||
cv::Scalar c = cv::Scalar(borderValue.val1, borderValue.val2, borderValue.val3, borderValue.val4);
|
||||
cv::remap(*src, *dst, *map1, *map2, interpolation, borderMode, c);
|
||||
}
|
||||
|
||||
void Filter2D(Mat src, Mat dst, int ddepth, Mat kernel, Point anchor, double delta, int borderType) {
|
||||
cv::Point anchorPt(anchor.x, anchor.y);
|
||||
cv::filter2D(*src, *dst, ddepth, *kernel, anchorPt, delta, borderType);
|
||||
}
|
||||
|
||||
void SepFilter2D(Mat src, Mat dst, int ddepth, Mat kernelX, Mat kernelY, Point anchor, double delta, int borderType) {
|
||||
cv::Point anchorPt(anchor.x, anchor.y);
|
||||
cv::sepFilter2D(*src, *dst, ddepth, *kernelX, *kernelY, anchorPt, delta, borderType);
|
||||
}
|
||||
|
||||
void LogPolar(Mat src, Mat dst, Point center, double m, int flags) {
|
||||
cv::Point2f centerPt(center.x, center.y);
|
||||
cv::logPolar(*src, *dst, centerPt, m, flags);
|
||||
}
|
||||
|
||||
void FitLine(PointVector pts, Mat line, int distType, double param, double reps, double aeps) {
|
||||
cv::fitLine(*pts, *line, distType, param, reps, aeps);
|
||||
}
|
||||
|
||||
void LinearPolar(Mat src, Mat dst, Point center, double maxRadius, int flags) {
|
||||
cv::Point2f centerPt(center.x, center.y);
|
||||
cv::linearPolar(*src, *dst, centerPt, maxRadius, flags);
|
||||
}
|
||||
|
||||
CLAHE CLAHE_Create() {
|
||||
return new cv::Ptr<cv::CLAHE>(cv::createCLAHE());
|
||||
}
|
||||
|
||||
CLAHE CLAHE_CreateWithParams(double clipLimit, Size tileGridSize) {
|
||||
cv::Size sz(tileGridSize.width, tileGridSize.height);
|
||||
return new cv::Ptr<cv::CLAHE>(cv::createCLAHE(clipLimit, sz));
|
||||
}
|
||||
|
||||
void CLAHE_Close(CLAHE c) {
|
||||
delete c;
|
||||
}
|
||||
|
||||
void CLAHE_Apply(CLAHE c, Mat src, Mat dst) {
|
||||
(*c)->apply(*src, *dst);
|
||||
}
|
||||
|
||||
void InvertAffineTransform(Mat src, Mat dst) {
|
||||
cv::invertAffineTransform(*src, *dst);
|
||||
}
|
||||
|
||||
Point2f PhaseCorrelate(Mat src1, Mat src2, Mat window, double* response) {
|
||||
cv::Point2d result = cv::phaseCorrelate(*src1, *src2, *window, response);
|
||||
|
||||
Point2f result2f = {
|
||||
.x = float(result.x),
|
||||
.y = float(result.y),
|
||||
};
|
||||
return result2f;
|
||||
}
|
||||
|
||||
void Mat_Accumulate(Mat src, Mat dst) {
|
||||
cv::accumulate(*src, *dst);
|
||||
}
|
||||
void Mat_AccumulateWithMask(Mat src, Mat dst, Mat mask) {
|
||||
cv::accumulate(*src, *dst, *mask);
|
||||
}
|
||||
|
||||
void Mat_AccumulateSquare(Mat src, Mat dst) {
|
||||
cv::accumulateSquare(*src, *dst);
|
||||
}
|
||||
|
||||
void Mat_AccumulateSquareWithMask(Mat src, Mat dst, Mat mask) {
|
||||
cv::accumulateSquare(*src, *dst, *mask);
|
||||
}
|
||||
|
||||
void Mat_AccumulateProduct(Mat src1, Mat src2, Mat dst) {
|
||||
cv::accumulateProduct(*src1, *src2, *dst);
|
||||
}
|
||||
|
||||
void Mat_AccumulateProductWithMask(Mat src1, Mat src2, Mat dst, Mat mask) {
|
||||
cv::accumulateProduct(*src1, *src2, *dst, *mask);
|
||||
}
|
||||
|
||||
void Mat_AccumulatedWeighted(Mat src, Mat dst, double alpha) {
|
||||
cv::accumulateWeighted(*src, *dst, alpha);
|
||||
}
|
||||
|
||||
void Mat_AccumulatedWeightedWithMask(Mat src, Mat dst, double alpha, Mat mask) {
|
||||
cv::accumulateWeighted(*src, *dst, alpha, *mask);
|
||||
}
|
2240
vendor/gocv.io/x/gocv/imgproc.go
generated
vendored
2240
vendor/gocv.io/x/gocv/imgproc.go
generated
vendored
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user