https://github.com/lddl/gocv-blob
Basic of blob tracking using GoCV + OpenCV
https://github.com/lddl/gocv-blob
blob-tracking computer-vision gocv
Last synced: 5 months ago
JSON representation
Basic of blob tracking using GoCV + OpenCV
- Host: GitHub
- URL: https://github.com/lddl/gocv-blob
- Owner: LdDl
- Created: 2018-10-08T10:26:49.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-06-23T15:49:57.000Z (almost 2 years ago)
- Last Synced: 2024-06-21T20:08:50.521Z (10 months ago)
- Topics: blob-tracking, computer-vision, gocv
- Language: Go
- Homepage:
- Size: 58.6 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gocv-blob [](https://godoc.org/github.com/LdDl/gocv-blob)[](https://sourcegraph.com/github.com/LdDl/gocv-blob?badge)[](https://goreportcard.com/report/github.com/LdDl/gocv-blob)[](https://github.com/LdDl/gocv-blob/releases)
Blob tracking via GoCV package## Important notice: It is better to use [mot-go](https://github.com/LdDl/mot-go) now for tracking tasks.
## Table of Contents
- [About](#about)
- [Installation](#installation)
- [Usage](#usage)
- [Support](#support)
- [Thanks](#thanks)## About
This small package implements basics of blob tracking: simple centroid and [Kalman filter](https://en.wikipedia.org/wiki/Kalman_filter)-based trackingThere are additional functions for checking if blob crossed horizontal (or even oblique) line.
## Installation
First of all you need OpenCV to be installed on your operation system. Also you need [GoCV](https://github.com/hybridgroup/gocv) package to be installed too. Please see ref. here https://github.com/hybridgroup/gocv#how-to-install
Then you are good to go with:
```shell
go get github.com/LdDl/gocv-blob/v2
## or (if you want to use legacy version):
## go get github.com/LdDl/gocv-blob
```p.s. do not be worried when you see *can't load package: package github.com/LdDl/gocv-blob: no Go files....* - this is just warning.
## Usage
It's pretty straightforward (pseudocode'ish).
```go
// 1. Define global set of blobs
global_blobs = blob.NewBlobiesDefaults()// 2. Define new blob objects
new_blob1 = blob.NewSimpleBlobie(image.Rectangle, how many points to store in track, class ID of object , class name of object)
new_blob2 = blob.NewSimpleBlobie(image.Rectangle, how many points to store in track, class ID of object , class name of object)
// You can use NewKalmanBlobie if needed// 3. Append data to temporary set of blobs
tmp_blobs = []*blob.Blobie{new_blob1, new_blob2}// 4. Compare blobs ()
global_blobs.MatchToExisting(tmp_blobs)// 5. Repeat steps 2-4 every time when you find new objects on images. MatchToExisting() will update existing blobs and register new ones.
```More informative example is here: [v2/array_tracker_test.go](v2/array_tracker_test.go)
**FOR LEGACY v1**:
Click to expand
```go
// 1. Define global set of blobs
global_blobs = blob.NewBlobiesDefaults()// 2. Define new blob objects
new_blob1 = blob.NewBlobie(image.Rectangle, how many points to store in track, class ID of object , class name of object)
new_blob2 = blob.NewBlobie(image.Rectangle, how many points to store in track, class ID of object , class name of object)// 3. Append data to temporary set of blobs
tmp_blobs = []*blob.Blobie{}
tmp_blobs = append(tmp_blobs, new_blob1)
tmp_blobs = append(tmp_blobs, new_blob2)// 4. Compare blobs ()
global_blobs.MatchToExisting(tmp_blobs)// 5. Repeat steps 2-4 every time when you find new objects on images. MatchToExisting() will update existing blobs and register new ones.
```## Support
If you have troubles or questions please [open an issue](https://github.com/LdDl/gocv-blob/issues/new).
## Thanks
Big thanks to creators and developers of [GoCV](https://gocv.io/) for providing bindings to OpenCV