https://github.com/nathanleiby/superset
Play Set better, with technology (www.setgame.com)
https://github.com/nathanleiby/superset
computer-vision opencv
Last synced: 2 months ago
JSON representation
Play Set better, with technology (www.setgame.com)
- Host: GitHub
- URL: https://github.com/nathanleiby/superset
- Owner: nathanleiby
- Created: 2016-03-06T21:50:33.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-01-09T03:06:16.000Z (over 9 years ago)
- Last Synced: 2025-05-19T00:11:20.406Z (about 1 year ago)
- Topics: computer-vision, opencv
- Language: Python
- Size: 10.1 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Superset
====
## Setup
### Python Setup
Make a virtual env.
Install requirements.
```
mkvirtualenv superset
make deps
```
### OpenCV2 Setup
Followed these steps http://www.learnopencv.com/install-opencv-3-on-yosemite-osx-10-10-x/
Install OpenCV 2 on Mac OSX
```
brew tap homebrew/science
brew install opencv
```
Because running in a Python Virtualenv, we need to get access to OpenCV (installed as a system package). This is possible to do by creating a few symlinks.
```
ln /usr/local/lib/python2.7/site-packages/cv.py cv.py
ln /usr/local/lib/python2.7/site-packages/cv2.so cv2.so
```
Alternately, could try setting up a Virtualenv with the `--system-site-packages` flag.
## Tests
```
make test
```
## Running locally
```
make run
```
**Detect cards**
Find all cards in an image:
```
python vision.py -c find -f images/game/game001.jpg
```
**Analyze features**
Analyze a single card:
```
python vision.py -c analyze -f images/single-card/green-full-oval-1.png
```
You can pass the `--display` flag to open a window with images analysis steps.
```
python vision.py -c analyze -f images/single-card/green-full-oval-1.png --display
```
It's also possible to pass a directory.
`vision.py` will iterate over all `.png` images in that directory.
```
python vision.py -c analyze -f images/single-card/
```
-----------
## TODOS
- add more images, and continue tuning algorithm
- rename fns to better explain the pipeline of steps
- detection - find card shaped items in an image
- classifaction - is it a card?
- feature extraction - given a card, what are its features (shape, number, etc)?
## Ideas to Explore
- morphology ex (for estimated rectangle shape of set cards)
- http://docs.opencv.org/2.4/modules/imgproc/doc/filtering.html#createmorphologyfilter
- Template matching
- http://docs.opencv.org/2.4/doc/tutorials/imgproc/histograms/template_matching/template_matching.html
- http://docs.opencv.org/3.1.0/d4/dc6/tutorial_py_template_matching.html
- with scaling - http://www.pyimagesearch.com/2015/01/26/multi-scale-template-matching-using-python-opencv/
- Shape Detection
- http://www.pyimagesearch.com/2016/02/08/opencv-shape-detection/
- http://stackoverflow.com/questions/11424002/how-to-detect-simple-geometric-shapes-using-opencv
- Square detection
- http://stackoverflow.com/questions/8667818/opencv-c-obj-c-detecting-a-sheet-of-paper-square-detection
- http://stackoverflow.com/questions/10533233/opencv-c-obj-c-advanced-square-detection
- Circle detection
- http://docs.opencv.org/2.4/doc/tutorials/imgproc/imgtrans/hough_circle/hough_circle.html#hough-circle
- OpenCV Python examples
- https://github.com/opencv/opencv/tree/master/samples/python