{"id":37192104,"url":"https://github.com/netbrain/gocv","last_synced_at":"2026-01-14T22:17:04.395Z","repository":{"id":57588137,"uuid":"175623873","full_name":"netbrain/gocv","owner":"netbrain","description":"Go package for computer vision using OpenCV 4 and beyond.","archived":false,"fork":true,"pushed_at":"2023-03-23T14:18:34.000Z","size":6056,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-20T02:01:18.743Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://gocv.io","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"hybridgroup/gocv","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/netbrain.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-14T13:06:21.000Z","updated_at":"2022-01-28T03:06:36.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/netbrain/gocv","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/netbrain/gocv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netbrain%2Fgocv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netbrain%2Fgocv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netbrain%2Fgocv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netbrain%2Fgocv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/netbrain","download_url":"https://codeload.github.com/netbrain/gocv/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netbrain%2Fgocv/sbom","scorecard":{"id":680635,"data":{"date":"2025-08-11","repo":{"name":"github.com/netbrain/gocv","commit":"c5e68f57bb20eaa82fe3dc423d5bd29686981d0c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: containerImage not pinned by hash: Dockerfile:1","Warn: containerImage not pinned by hash: Dockerfile:41","Warn: goCommand not pinned by hash: Dockerfile:60","Info:   0 out of   1 goCommand dependencies pinned","Info:   0 out of   2 containerImage dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}}]},"last_synced_at":"2025-08-21T23:01:21.385Z","repository_id":57588137,"created_at":"2025-08-21T23:01:21.385Z","updated_at":"2025-08-21T23:01:21.385Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28436268,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T21:32:52.117Z","status":"ssl_error","status_checked_at":"2026-01-14T21:32:33.442Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-14T22:17:03.430Z","updated_at":"2026-01-14T22:17:04.388Z","avatar_url":"https://github.com/netbrain.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GoCV\n\n[![GoCV](https://raw.githubusercontent.com/hybridgroup/gocv/master/images/gocvlogo.jpg)](http://gocv.io/)\n\n[![GoDoc](https://godoc.org/gocv.io/x/gocv?status.svg)](https://godoc.org/github.com/hybridgroup/gocv)\n[![Travis Build Status](https://travis-ci.org/hybridgroup/gocv.svg?branch=dev)](https://travis-ci.org/hybridgroup/gocv)\n[![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/9asd5foet54ru69q/branch/dev?svg=true)](https://ci.appveyor.com/project/deadprogram/gocv/branch/dev)\n[![codecov](https://codecov.io/gh/hybridgroup/gocv/branch/dev/graph/badge.svg)](https://codecov.io/gh/hybridgroup/gocv)\n[![Go Report Card](https://goreportcard.com/badge/github.com/hybridgroup/gocv)](https://goreportcard.com/report/github.com/hybridgroup/gocv)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/hybridgroup/gocv/blob/master/LICENSE.txt)\n\nThe GoCV package provides Go language bindings for the [OpenCV 4](http://opencv.org/) computer vision library.\n\nThe GoCV package supports the latest releases of Go and OpenCV (v4.0.1) 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.\n\nGoCV 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.\n\n## How to use\n\n### Hello, video\n\nThis example opens a video capture device using device \"0\", reads frames, and shows the video in a GUI window:\n\n```go\npackage main\n\nimport (\n\t\"gocv.io/x/gocv\"\n)\n\nfunc main() {\n\twebcam, _ := gocv.OpenVideoCapture(0)\n\twindow := gocv.NewWindow(\"Hello\")\n\timg := gocv.NewMat()\n\n\tfor {\n\t\twebcam.Read(\u0026img)\n\t\twindow.IMShow(img)\n\t\twindow.WaitKey(1)\n\t}\n}\n```\n\n### Face detect\n\n![GoCV](https://raw.githubusercontent.com/hybridgroup/gocv/master/images/face-detect.jpg)\n\nThis 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:\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"image/color\"\n\n\t\"gocv.io/x/gocv\"\n)\n\nfunc main() {\n    // set to use a video capture device 0\n    deviceID := 0\n\n\t// open webcam\n\twebcam, err := gocv.OpenVideoCapture(deviceID)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tdefer webcam.Close()\n\n\t// open display window\n\twindow := gocv.NewWindow(\"Face Detect\")\n\tdefer window.Close()\n\n\t// prepare image matrix\n\timg := gocv.NewMat()\n\tdefer img.Close()\n\n\t// color for the rect when faces detected\n\tblue := color.RGBA{0, 0, 255, 0}\n\n\t// load classifier to recognize faces\n\tclassifier := gocv.NewCascadeClassifier()\n\tdefer classifier.Close()\n\n\tif !classifier.Load(\"data/haarcascade_frontalface_default.xml\") {\n\t\tfmt.Println(\"Error reading cascade file: data/haarcascade_frontalface_default.xml\")\n\t\treturn\n\t}\n\n\tfmt.Printf(\"start reading camera device: %v\\n\", deviceID)\n\tfor {\n\t\tif ok := webcam.Read(\u0026img); !ok {\n\t\t\tfmt.Printf(\"cannot read device %v\\n\", deviceID)\n\t\t\treturn\n\t\t}\n\t\tif img.Empty() {\n\t\t\tcontinue\n\t\t}\n\n\t\t// detect faces\n\t\trects := classifier.DetectMultiScale(img)\n\t\tfmt.Printf(\"found %d faces\\n\", len(rects))\n\n\t\t// draw a rectangle around each face on the original image\n\t\tfor _, r := range rects {\n\t\t\tgocv.Rectangle(\u0026img, r, blue, 3)\n\t\t}\n\n\t\t// show the image in the window, and wait 1 millisecond\n\t\twindow.IMShow(img)\n\t\twindow.WaitKey(1)\n\t}\n}\n```\n\n### More examples\n\nThere 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).\n\n## How to install\n\nTo install GoCV, run the following command:\n\n```\ngo get -u -d gocv.io/x/gocv\n```\n\nTo run code that uses the GoCV package, you must also install OpenCV 4.0.0 on your system. Here are instructions for Ubuntu, Raspian, macOS, and Windows.\n\n## Ubuntu/Linux\n\n### Installation\n\nYou can use `make` to install OpenCV 4.0.1 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.\n\n#### Quick Install\n\nThe following commands should do everything to download and install OpenCV 4.0.1 on Linux:\n\n\tcd $GOPATH/src/gocv.io/x/gocv\n\tmake install\n\nIf it works correctly, at the end of the entire process, the following message should be displayed:\n\n\tgocv version: 0.19.0\n\topencv lib version: 4.0.1\n\nThat's it, now you are ready to use GoCV.\n\n#### Complete Install\n\nIf 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`.\n\n##### Install required packages\n\nFirst, you need to change the current directory to the location of the GoCV repo, so you can access the `Makefile`:\n\n\tcd $GOPATH/src/gocv.io/x/gocv\n\nNext, you need to update the system, and install any required packages:\n\n\tmake deps\n\n#### Download source\n\nNow, download the OpenCV 4.0.1 and OpenCV Contrib source code:\n\n\tmake download\n\n#### Build\n\nBuild everything. This will take quite a while:\n\n\tmake build\n\n#### Install\n\nOnce the code is built, you are ready to install:\n\n\tmake sudo_install\n\n### Verifying the installation\n\nTo verify your installation you can run one of the included examples.\n\nFirst, change the current directory to the location of the GoCV repo:\n\n\tcd $GOPATH/src/gocv.io/x/gocv\n\nNow you should be able to build or run any of the examples:\n\n\tgo run ./cmd/version/main.go\n\nThe version program should output the following:\n\n\tgocv version: 0.19.0\n\topencv lib version: 4.0.1\n\n#### Cleanup extra files\n\nAfter the installation is complete, you can remove the extra files and folders:\n\n\tmake clean\n\n### Cache builds\n\nIf you are running a version of Go older than v1.10 and not modifying GoCV source, precompile the GoCV package to significantly decrease your build times:\n\n\tgo install gocv.io/x/gocv\n\n### Custom Environment\n\nBy 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.\n\nFor example:\n\n\texport CGO_CPPFLAGS=\"-I/usr/local/include\"\n\texport 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\"\n\nPlease 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:\n\n\tgo run -tags customenv ./cmd/version/main.go\n\n### Docker\n\nThe 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:\n\n```\nmake docker\n```\n\nBy default Docker image built by running the command above ships [Go](https://golang.org/) version `1.11.2`, 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:\n\n```\nmake docker GOVERSION='1.11.1'\n```\n\n#### Running GUI programs in Docker on macOS\n\nSometimes 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:\n* install [xquartz](https://www.xquartz.org/). You can also install xquartz using [homebrew](https://brew.sh/) by running `brew install cask xquartz`\n* install [socat](https://linux.die.net/man/1/socat) `brew install socat`\n\nNote, 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.\n\nOnce 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:\n\n```shell\nopen -a xquartz\n```\nClick on *Security* tab in preferences and check the \"Allow connections\" box:\n\n![app image](./images/xquartz.png)\n\nNext, 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:\n\n```shell\nlsof -i TCP:6000\n```\nNow you can start a local proxy which will proxy the X Window traffic into xquartz which acts a your local X server:\n\n```shell\nsocat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\\\"$DISPLAY\\\"\n```\n\nYou 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:\n\n```shell\ndocker run -it --rm -e DISPLAY=docker.for.mac.host.internal:0 your-gocv-app\n```\n\n**Note, since Docker for MacOS does not provide any video device support, you won't be able run GoCV apps which require camera.**\n\n### Alpine 3.7 Docker image\n\nThere 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).\n\n## Raspbian\n\n### Installation\n\nWe have a special installation for the Raspberry Pi that includes some hardware optimizations. You use `make` to install OpenCV 4.0.1 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.\n\n#### Quick Install\n\nThe following commands should do everything to download and install OpenCV 4.0.1 on Raspbian:\n\n\tcd $GOPATH/src/gocv.io/x/gocv\n\tmake install_raspi\n\nIf it works correctly, at the end of the entire process, the following message should be displayed:\n\n\tgocv version: 0.19.0\n\topencv lib version: 4.0.1\n\nThat's it, now you are ready to use GoCV.\n\n## macOS\n\n### Installation\n\nYou can install OpenCV 4.0.1 using Homebrew.\n\nIf you already have an earlier version of OpenCV (3.4.x) installed, you should probably remove it before installing the new version:\n\n\tbrew uninstall opencv\n\nYou can then install OpenCV 4.0.1:\n\n\tbrew install opencv\n\nIf you prefer, there is also an alternative Homebrew recipe will install only OpenCV 4.0.1 without all of the Python dependencies:\n\n\tbrew install hybridgroup/tools/opencv\n\nNOTE: Do not install both of these. Choose one.\n\n### pkgconfig Installation\npkg-config is used to determine the correct flags for compiling and linking OpenCV.\nYou can install it by using Homebrew:\n\n    brew install pkgconfig\n\n### Verifying the installation\n\nTo verify your installation you can run one of the included examples.\n\nFirst, change the current directory to the location of the GoCV repo:\n\n\tcd $GOPATH/src/gocv.io/x/gocv\n\nNow you should be able to build or run any of the examples:\n\n\tgo run ./cmd/version/main.go\n\nThe version program should output the following:\n\n\tgocv version: 0.19.0\n\topencv lib version: 4.0.1\n\n### Cache builds\n\nIf you are running a version of Go older than v1.10 and not modifying GoCV source, precompile the GoCV package to significantly decrease your build times:\n\n\tgo install gocv.io/x/gocv\n\n### Custom Environment\n\nBy 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.\n\nFor example:\n\n\texport CGO_CXXFLAGS=\"--std=c++11\"\n\texport CGO_CPPFLAGS=\"-I/usr/local/Cellar/opencv/4.0.1/include\"\n\texport CGO_LDFLAGS=\"-L/usr/local/Cellar/opencv/4.0.1/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\"\n\nPlease 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:\n\n\tgo run -tags customenv ./cmd/version/main.go\n\n## Windows\n\n### Installation\n\nThe following assumes that you are running a 64-bit version of Windows 10.\n\nIn order to build and install OpenCV 4.0.1 on Windows, you must first download and install MinGW-W64 and CMake, as follows.\n\n#### MinGW-W64\n\nDownload and run the MinGW-W64 compiler installer from [https://sourceforge.net/projects/mingw-w64/?source=typ_redirect](https://sourceforge.net/projects/mingw-w64/?source=typ_redirect).\n\nThe latest version of the MinGW-W64 toolchain is `7.3.0`, but any version from `7.X` on should work.\n\nChoose the options for \"posix\" threads, and for \"seh\" exceptions handling, then install to the default location `c:\\Program Files\\mingw-w64\\x86_64-7.3.0-posix-seh-rt_v5-rev2`.\n\nAdd the `C:\\Program Files\\mingw-w64\\x86_64-7.3.0-posix-seh-rt_v5-rev2\\mingw64\\bin` path to your System Path.\n\n#### CMake\n\nDownload and install CMake [https://cmake.org/download/](https://cmake.org/download/) to the default location. CMake installer will add CMake to your system path.\n\n#### OpenCV 4.0.1 and OpenCV Contrib Modules\n\nThe following commands should do everything to download and install OpenCV 4.0.1 on Windows:\n\n\tchdir %GOPATH%\\src\\gocv.io\\x\\gocv\n\twin_build_opencv.cmd\n\nIt might take up to one hour.\n\nLast, add `C:\\opencv\\build\\install\\x64\\mingw\\bin` to your System Path.\n\n### Verifying the installation\n\nChange the current directory to the location of the GoCV repo:\n\n\tchdir %GOPATH%\\src\\gocv.io\\x\\gocv\n\nNow you should be able to build or run any of the command examples:\n\n\tgo run cmd\\version\\main.go\n\nThe version program should output the following:\n\n\tgocv version: 0.19.0\n\topencv lib version: 4.0.1\n\nThat's it, now you are ready to use GoCV.\n\n### Cache builds\n\nIf you are running a version of Go older than v1.10 and not modifying GoCV source, precompile the GoCV package to significantly decrease your build times:\n\n\tgo install gocv.io/x/gocv\n\n### Custom Environment\n\nBy 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.\n\nDue 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.\n\nFor example:\n\n\tset CGO_CXXFLAGS=\"--std=c++11\"\n\tset CGO_CPPFLAGS=-IC:\\opencv\\build\\install\\include\n\tset CGO_LDFLAGS=-LC:\\opencv\\build\\install\\x64\\mingw\\lib -lopencv_core401 -lopencv_face401 -lopencv_videoio401 -lopencv_imgproc401 -lopencv_highgui401 -lopencv_imgcodecs401 -lopencv_objdetect401 -lopencv_features2d401 -lopencv_video401 -lopencv_dnn401 -lopencv_xfeatures2d401 -lopencv_plot401 -lopencv_tracking401 -lopencv_img_hash401\n\nPlease 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:\n\n\tgo run -tags customenv cmd\\version\\main.go\n\n## Android\n\nThere is some work in progress for running GoCV on Android using Gomobile. For information on how to install OpenCV/GoCV for Android, please see:\nhttps://gist.github.com/ogero/c19458cf64bd3e91faae85c3ac887481\n\nSee original discussion here:\nhttps://github.com/hybridgroup/gocv/issues/235\n\n## Profiling\n\nSince 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.\n\nTo 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).\n\nIn order to include the MatProfile custom profiler, you MUST build or run your application or tests using the `-tags matprofile` build tag. For example:\n\n\tgo run -tags matprofile cmd/version/main.go\n\nYou can get the profile's count at any time using:\n\n```go\ngocv.MatProfile.Count()\n```\n\nYou can display the current entries (the stack traces) with:\n\n```go\nvar b bytes.Buffer\ngocv.MatProfile.WriteTo(\u0026b, 1)\nfmt.Print(b.String())\n```\n\nThis can be very helpful to track down a leak.  For example, suppose you have\nthe following nonsense program:\n\n```go\npackage main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\n\t\"gocv.io/x/gocv\"\n)\n\nfunc leak() {\n\tgocv.NewMat()\n}\n\nfunc main() {\n\tfmt.Printf(\"initial MatProfile count: %v\\n\", gocv.MatProfile.Count())\n\tleak()\n\n\tfmt.Printf(\"final MatProfile count: %v\\n\", gocv.MatProfile.Count())\n\tvar b bytes.Buffer\n\tgocv.MatProfile.WriteTo(\u0026b, 1)\n\tfmt.Print(b.String())\n}\n```\n\nRunning this program produces the following output:\n\n```\ninitial MatProfile count: 0\nfinal MatProfile count: 1\ngocv.io/x/gocv.Mat profile: total 1\n1 @ 0x40b936c 0x40b93b7 0x40b94e2 0x40b95af 0x402cd87 0x40558e1\n#\t0x40b936b\tgocv.io/x/gocv.newMat+0x4b\t/go/src/gocv.io/x/gocv/core.go:153\n#\t0x40b93b6\tgocv.io/x/gocv.NewMat+0x26\t/go/src/gocv.io/x/gocv/core.go:159\n#\t0x40b94e1\tmain.leak+0x21\t\t\t/go/src/github.com/dougnd/gocvprofexample/main.go:11\n#\t0x40b95ae\tmain.main+0xae\t\t\t/go/src/github.com/dougnd/gocvprofexample/main.go:16\n#\t0x402cd86\truntime.main+0x206\t\t/usr/local/Cellar/go/1.11.1/libexec/src/runtime/proc.go:201\n```\n\nWe 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()`).\n\nFurthermore, 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:\n\n```go\npackage main\n\nimport (\n\t\"net/http\"\n\t_ \"net/http/pprof\"\n\t\"time\"\n\n\t\"gocv.io/x/gocv\"\n)\n\nfunc leak() {\n\tgocv.NewMat()\n}\n\nfunc main() {\n\tgo func() {\n\t\tticker := time.NewTicker(time.Second)\n\t\tfor {\n\t\t\t\u003c-ticker.C\n\t\t\tleak()\n\t\t}\n\t}()\n\n\thttp.ListenAndServe(\"localhost:6060\", nil)\n}\n\n```\n\nThis 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).\n\n\n## How to contribute\n\nPlease take a look at our [CONTRIBUTING.md](./CONTRIBUTING.md) document to understand our contribution guidelines.\n\nThen check out our [ROADMAP.md](./ROADMAP.md) document to know what to work on next.\n\n## Why this project exists\n\nThe [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.\n\nThe 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.\n\nFor 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.\n\nThis 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!\n\n## License\n\nLicensed under the Apache 2.0 license. Copyright (c) 2017-2018 The Hybrid Group.\n\nLogo generated by GopherizeMe - https://gopherize.me\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetbrain%2Fgocv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetbrain%2Fgocv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetbrain%2Fgocv/lists"}