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 a key component of the MIT CityScope platform for interaction.
- install python 3.4^, clone this repo, install packages.
- tweak
__settings__.jsonto fit your cityIO table setup. Read cityIO documentation for proper data structure - setup a path to your settings file
cityscopy_settings_path = "__path__/__settings__.json"
- initiate the
Cityscopyclass
cityscopy = Cityscopy(cityscopy_settings_path)
- use one or more of the main methods. 'Blocking' means the method will run forever (while true loop). Advanced users can parallel blocking methods using multithreading.
| Method | Usage | Blocking? |
|---|---|---|
cityscopy.keystone() |
initial keystone and save to file | x |
cityscopy.gridMaker() |
make GeoJSON grids and sent to CityIO | |
cityscopy.scan() |
main scanning and sending method | x |
cityscopy.udp_listener() |
emulate local UDP server listener | x |
- in terminal run the tool using
$ run.py
- the tool will start given a cam is connected and working
- Select 4 corners [up right, up left, bottom right, bottom left, at this order] of keystone region
Note: no need to exactly select the corners, as these are only initial guides for
scannermethod keystone.txtand close
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.
guiturn on or of webcam displayintervalsend rate to UDP/HTTP in mscityiosend to UDP or HTTP cityIOtags16 digit strings of types being scanned [1000000100000000]
Tool will start scanning using whatever keystone data was stored in keystone.txt
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
Please see LICENSE file for more details.This tool may require libraries which are subject to own licensing.
Please use GitHub Issues and PR interface for contributions.
Maintained by Ariel Noyman