This is a computer vision python project that solves the card game Set. The sets are identified from an uploaded image.
- Go to https://charleskolozsvary.github.io/setcgs
- Upload an image (with cards from Set).1
- For best results, ensure the photo is well-lit, the background is relatively uniform, and there is minimal glare. But these conditions are forunately not too strict---image quality is generally more important, but any modern phone camera provides plenty of resolution.2
- Click
run main.pyand view the labelled cards and sets!3- If the cards were labelled correctly and no sets are highlighted, there were none.
Example4
Here's an image with some sets:
Every card in Set has four features, each of which have three varieties.
| color | shape | number | filling |
|---|---|---|---|
| purple | squiggle | 1 | empty |
| red | rhombus | 2 | dashed |
| green | oval | 3 | full |
The card features as identified by the program are pictured below. Each feature is abbreviated by its first or first two letters ('P' is for 'purple', 'OV' is for 'oval', 'E' is for empty, and so on). You can check for yourself that they are correct.
There end up being 5 sets among those cards. Here they are highlighted (as outputted by the program):
Footnotes
-
Currently, .HEIC images (what Apple uses) are not supported, so a picture uploaded directly from an apple device camera roll will not work. If you take a screenshot of the image then upload it, it will work, though. ↩
-
I'm relatively happy with this program's success rate. It correctly identifies cards most of the time, but there's definitely room for improvement. If the image resolution is low, lighting is poor, cards are touching or obscurred, the background is unusual, or glare is prevalent, the cards may not be identified correctly (and so neither will the sets). ↩
-
If there are any. ↩
-
You can also view the printed-page output for this example at examples/exampleoutput.pdf. ↩
