Skip to content

Commit 145ba86

Browse files
committed
readme
1 parent 658a6e6 commit 145ba86

1 file changed

Lines changed: 61 additions & 23 deletions

File tree

README.md

Lines changed: 61 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,78 @@
11
# CityScoPy
2+
23
### [=> Download latest release here <=](https://github.com/CityScope/CS_Scanner_Python/releases/)
34

5+
## Table Initiation, Scanning & Networking Module for MIT CityScope Project in Python
6+
7+
CityScoPy is a tool for initiating a CityScope instance for any arbitrary geolocated area in the world. CityScoPy can create a GeoJSON grid, capture, key-stone, scan and send uniquely tagged arrays of 2-dimension physical bricks. This is the main compom MIT CityScope.
8+
9+
---
10+
11+
## Usage
412

5-
## Scanning and Networking Module for MIT CityScope Project in Python
13+
- install python 3.4^, clone this repo, install packages.
14+
- tweak `__settings__.json` to fit your cityIO table setup. Read [cityIO documentation](https://github.com/cityscope/cs_cityio_backend/wiki) for proper data structure
15+
- setup a path to your settings file
616

7-
This tool is for capturing, key-stoning, scanning and sending uniquely tagged arrays of 2-dimension physical Lego bricks. CityScope Scanner will detect colors in arrays of 2d-pixel arrays. Than, these color arrays will be compared to list of `tags` attribute of a given `cityio.json` file. At last, the tool will return a list of `type` and `rotation` for each of the scanned arrays. This list is then converted to cityIO acceptable JSON format and can be sent using POST request.
17+
```
18+
cityscopy_settings_path = "__path__/__settings__.json"
19+
```
820

9-
## Quick-Run
21+
- initiate the `Cityscopy` class
1022

11-
- From terminal, run the tool using `$ run.py`
12-
- Tool will start scanning using whatever keystone data was stored in `keystone.txt`
13-
- make corrections to the key stone using the sliders or keyboard using `1,2,3,4` to select a corner and `[w,a,s,d]` to move `[up,left,down,right]` the selected corner. Press `k` to save change to file and `ctrl-c` twice [in the terminal window] to exit program
23+
```
24+
cityscopy = Cityscopy(cityscopy_settings_path)
25+
```
1426

15-
Note: Running the tool in this way will involve some fail safe mechanisms that will auto-restart the tool when it crashes [such as camera disconnect, slider failure or networking issue]
27+
- use one or more of the main methods
1628

17-
## Setup and Calibration On First Time Usage | Full Setup
29+
| Method | Usage | Blocking? |
30+
| -------------------------- | ------------------------------------- | --------- |
31+
| `cityscopy.keystone()` | initial keystone and save to file | x |
32+
| `cityscopy.gridMaker()` | make GeoJSON grids and sent to CityIO | |
33+
| `cityscopy.scan()` | main scanning and sending method | x |
34+
| `cityscopy.udp_listener()` | emulate local UDP server listener | x |
1835

19-
- get python 3.4 and above, clone this repo, install relevant libs [see `main.py`]
20-
- tweek `cityio.json` to fit your cityIO table setup [read https://github.com/CityScope/CS_CityIO_Backend/wiki to understand cityIO data structure]
21-
- Run with `$ python[3] main.py`.
22-
- Tool will start scanning using the key stone data created with`keystone.py`
23-
- make corrections to the key stone using the sliders. Press `s` to save changes to file and `ctrl-c` to close program
36+
- in terminal run the tool using `$ run.py`
2437

25-
### options in `cityio.json` , `objects` field
26-
- `gui` 0 or 1 -- turn on or of webcam display
27-
- `interval` 0 to inf -- send rate to UDP/HTTP in ms
28-
- `cityio` 0 or 1 -- send to UDP [0] or HTTP cityIO[1]
29-
- `tags` ["1000000100000000"] -- 16 digit strings, repesenting of the types of being scanned
38+
---
39+
40+
## Class methods
41+
42+
### `Cityscopy.keystone()`
3043

31-
## Optional
44+
##### Initial keystone and save to file
3245

33-
- Run `keystone` with: `$ python[3] keystone.py`
34-
- the tool will start, assuming a webcam is connected and working
46+
- the tool will start given a cam is connected and working
3547
- Select 4 corners [up right, up left, bottom right, bottom left, at this order] of keystone region
36-
Note: no need to exactly select the corners, as these are only initial guides for `scanner` tool
37-
- `keystone.py` will create `keystone.txt` and close
48+
Note: no need to exactly select the corners, as these are only initial guides for `scanner` method
49+
- `keystone.txt` and close
50+
51+
### `Cityscopy.gridMaker()`
52+
53+
##### make GeoJSON grids and sent to CityIO
54+
55+
### `Cityscopy.scan()`
56+
57+
##### main scanning and sending method
58+
59+
Scanner will detect colors in arrays of 2d-pixel arrays. Than, these color arrays will be compared to list of `tags` attribute of a given `__settings__.json` file. Then the tool will return a list of `type` and `rotation` for each of the scanned arrays. This list is then converted to cityIO acceptable JSON format and can be sent using POST request.
60+
61+
##### options in `__settings__.json`
62+
63+
- `gui` turn on or of webcam display
64+
- `interval` send rate to UDP/HTTP in ms
65+
- `cityio` send to UDP or HTTP cityIO
66+
- `tags` 16 digit strings of types being scanned [`1000000100000000`]
67+
68+
Tool will start scanning using whatever keystone data was stored in `keystone.txt`
69+
make corrections to the key stone using the sliders or keyboard using `1,2,3,4` to select a corner and `[w,a,s,d]` to move `[up,left,down,right]` the selected corner. Press `k` to save change to file and `ctrl-c` twice [in the terminal window] to exit program
70+
71+
### `Cityscopy.udp_listener()`
72+
73+
##### emulates local UDP server listener
74+
75+
---
3876

3977
## License
4078

0 commit comments

Comments
 (0)