Skip to content

LdDl/goparking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goparking

This project is targeted to detect which parking lot (actually any user defined polygon) are occupied by any object.
It uses good computer vision package GoCV (see https://github.com/hybridgroup/gocv) as bindings to Opencv 3.x (https://github.com/opencv/opencv)

Table of Contents

Installation

As it uses GoCV, first of all you have to install it. Please see steps described here https://gocv.io/getting-started/.

If you successfully installed everything (GoCV, OpenCV, OpenCV-contrib), then you good to go. Just install it via get:

go get github.com/LdDl/goparking

Usage

  • Build
    Go to $GOPATH/src/LdDl/goparking folder.
    Open terminal in that folder and type:
go build main.go
  • Configuration
    Open example.json file in main project folder and edit fields to fit your needs.
{
  // videoType - type of input. It can be either local file or web-service ("url") or connected camera to your PC ("device")
  "videoType": "url",
  // videoSource - link to your video. If your videoType is "device", then just provide number of that device: for example "0"
  "videoSource": "/datasets/parkinglot_1_480p.mp4",
  // imageResizing - parameter to scale your image (for fast proccessing or other needs). In example it is same as input.
  "imageResizing": [
    854,
    480
  ],
  // showImage - display image or not
  "showImage": true,
  // laplacian - parameter for Laplace Operator (https://en.wikipedia.org/wiki/Laplace_operator)
  // Please see https://docs.opencv.org/3.4.0/d5/db5/tutorial_laplace_operator.html
  // While playng with "imageResizing" you have to change this parameter too to get good results.
  "laplacian": 2.0,
  // areas - array of parking lots.
  // each area has ID (string) and set of coordinates.
  // There are no setMouseCallback() in GoCV package (see https://github.com/hybridgroup/gocv/issues/211), 
  // so I can not implement good "GUI" for extracting clicked points on image.
  // For extracting needed points you need to use some 3-d party applications like Paint (Windows) or KolourPaint (Linux).
  "areas": [
    {
      "id": "1t_lot",
      "coords": [
        [
          368,
          329
        ],
        [
          410,
          328
        ],
        [
          437,
          350
        ],
        [
          387,
          353
        ]
      ]
    }
  ]
}
  • Run
    For Linux:
./main -cfg=example.json

For Windows:

main.exe -cfg=example.json
  • Enjoy - - - - -

Support

If you have troubles please open an issue.

Thanks

Big thanks to creators and developers of GoCV for providing bindings to OpenCV
And thanks to this project for algorithm template.

About

This project is targeted to detect which parking lot (actually any user defined polygon) are occupied by any object.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages