Skip to content

Commit

Permalink
docs (Data structure) WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
OmerShubi committed Oct 7, 2019
1 parent 19efb5b commit 060ae56
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 16 deletions.
4 changes: 1 addition & 3 deletions CameraNetwork/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -1586,9 +1586,7 @@ def handle_loop(self, capture_settings, frames_num, hdr_mode, img_data):
#
# Capture the array.
#
img_array, exposure_us, gain_db = self.safe_capture(
capture_settings, frames_num
)
img_array, exposure_us, gain_db = self.safe_capture(capture_settings, frames_num)

#
# update image data object.
Expand Down
8 changes: 4 additions & 4 deletions CameraNetwork/global_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,17 @@
UPLOAD_JPG_FILE: False,
UPLOAD_MAT_FILE: False,
DAY_SETTINGS: {
LOOP_DELAY: 300,
IMAGE_EXPOSURE: 50,
LOOP_DELAY: 300, # [sec]
IMAGE_EXPOSURE: 50, # [usec]
IMAGE_GAIN: 0,
GAIN_BOOST: False,
FRAMES_NUM: 5,
COLOR_MODE: COLOR_RAW,
HDR_MODE: 4
},
NIGHT_SETTINGS: {
LOOP_DELAY: 1800,
IMAGE_EXPOSURE: 8000000,
LOOP_DELAY: 1800, # [sec]
IMAGE_EXPOSURE: 8000000, # [usec]
IMAGE_GAIN: 0,
GAIN_BOOST: True,
FRAMES_NUM: 1,
Expand Down
6 changes: 2 additions & 4 deletions CameraNetwork/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ def loop_timer(self):
# Store time here so that hopefully it will be as synchronized
# as possible.
#
name_time=datetime.utcnow()
name_time = datetime.utcnow()

#
# Select capture settings according day night.
Expand Down Expand Up @@ -548,9 +548,7 @@ def loop_timer(self):
#
capture_delay = max(1, capture_settings[gs.LOOP_DELAY])

next_capture_time = (
int(time.time() / capture_delay) + 1
) * capture_delay - time.time()
next_capture_time = (int(time.time() / capture_delay) + 1) * capture_delay - time.time()

nxt = gen.sleep(next_capture_time)

Expand Down
8 changes: 3 additions & 5 deletions CameraNetwork/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,13 @@ def upload_file_to_proxy(
return scp_proc


def save_camera_data(
general_settings_path,
capture_settings_path,
camera_settings=None,
capture_settings=None):
def save_camera_data(general_settings_path, capture_settings_path,
camera_settings=None, capture_settings=None):

if camera_settings is not None:
with open(general_settings_path, 'wb') as f:
json.dump(camera_settings, f, sort_keys=True, indent=4, separators=(',', ': '))

if capture_settings is not None:
with open(capture_settings_path, 'wb') as f:
json.dump(capture_settings, f, sort_keys=True, indent=4, separators=(',', ': '))
Expand Down
Binary file added docs/source/images/img_data_sample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions docs/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,32 @@ Useful commands
- ``sudo dd if=/dev/sdb of=~/xu4_lab.img status=progress`` to create an image of odroid
- `etcher <https://www.balena.io/etcher/>`_ to flash image onto the SD card

Data Structures
===============
When looking at a specific camera, under `captured_images`,
for each that the camera recorded a folder `<%Y-%M-%D>` is created.
Inside, the images are stored as `.mat` files. In addition there is a thumbnail `.jpg` version, add metadata as `.pkl`.
The name is `utctime_date+exact time`.
The `.pkl` file stores the following data::

img = pd.read_pickle('/media/shubi/rootfs/home/odroid/captured_images/2019_10_02/1570011900.0_2019_10_02_10_25_00_3.pkl')

.. image:: images/img_data_sample.png

In addition, one `database.pkl` is created and stored per day::

database = pd.read_pickle('/media/shubi/rootfs/home/odroid/captured_images/2019_10_02/database.pkl')
database.head()

Time hdr path longitude latitude altitude serial_num
2019-10-02 00:00:00 0 /home/odroid/captured_images/2019_10_02/1569974400.05_2019_10_02_00_00_00_0.mat 35.024963 32.775776 229 4103098529
2019-10-02 00:30:00 0 /home/odroid/captured_images/2019_10_02/1569976200.05_2019_10_02_00_30_00_0.mat 35.024963 32.775776 229 4103098529
2019-10-02 01:00:00 0 /home/odroid/captured_images/2019_10_02/1569978000.05_2019_10_02_01_00_00_0.mat 35.024963 32.775776 229 4103098529
2019-10-02 01:30:00 0 /home/odroid/captured_images/2019_10_02/1569979800.05_2019_10_02_01_30_00_0.mat 35.024963 32.775776 229 4103098529
2019-10-02 08:48:03 0 /home/odroid/captured_images/2019_10_02/1570006083.33_2019_10_02_08_48_03_0.mat 35.024963 32.775776 229 4103098529




Analyzing Results
=================
Expand Down

0 comments on commit 060ae56

Please sign in to comment.