Skip to content

GhostUser/coin-detection-api

Repository files navigation

Coin Detection API

This API is created using OpenCV and Django. It uses The Circle Hough Transform technique to find the circles and marks the center and radius of each circle.

The API returns response in JSON format i.e.

Test Image: {'success': True, 'Number of Coins': 17, 'coins(x,y,r)': [[847, 2357, 185], [1367, 2361, 190], [2699, 1153, 226], [2001, 667, 220], [2229, 1235, 189], [1771, 1467, 181], [1409, 1931, 190], [2777, 2263, 202], [2459, 1819, 186], [1125, 793, 221], [1585, 1077, 188], [3037, 1657, 222], [1925, 1931, 188], [795, 1709, 182], [585, 1183, 183], [1275, 1459, 191], [1839, 2519, 185]]}

Requirements

Libraries and frameowrks required for the API to run are:

  1. Django pip install django
  2. OpenCV pip install OpenCV

Run

To run the api on your local server, you need to install the requirements and run the following command by opening command line from the project directory.

python manage.py runserver

Test

The API can be tested using curl or the included api_test.py file.

Using api_test.py also displays the result image. Result image

Using curl we get the response in JSON. JSON Response

  1. To test the API using included test_api python file,

    • run the api_test.py with path to the image as second argument .i.e
      python api_test.py [path_to_image]
  2. To test the file using curl, use the following command

TODO

Need to add some more funtionality. Will add soon

About

Coin detection api using django

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published