diff options
author | Naushir Patuck <naush@raspberrypi.com> | 2022-07-18 09:16:00 +0100 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-07-28 13:47:51 +0300 |
commit | 73c1a1d69762c7bcdf13612970179eb02826bd62 (patch) | |
tree | 234a3083396d410ce9e15cc8ef30f97f6553f0fc /utils/raspberrypi/ctt/ctt.py | |
parent | 2ef6eafb6f4efc8a9ae7381253c7121d488d123d (diff) |
utils: raspberrypi: ctt: Output version 2.0 format tuning files
Update the ctt_pretty_print_json.py script to generate the new version 2.0
format camera tuning file. This script can be called through the command line
to prettify an existing JSON file, or programatically by the CTT to format a
new JSON config dictionary.
Update the CTT to produce a version 2.0 format json structure and use
ctt_pretty_print_json.pretty_print to prettify the output.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>
Diffstat (limited to 'utils/raspberrypi/ctt/ctt.py')
-rwxr-xr-x | utils/raspberrypi/ctt/ctt.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/utils/raspberrypi/ctt/ctt.py b/utils/raspberrypi/ctt/ctt.py index 13765b5d..df98db80 100755 --- a/utils/raspberrypi/ctt/ctt.py +++ b/utils/raspberrypi/ctt/ctt.py @@ -15,7 +15,7 @@ from ctt_alsc import * from ctt_lux import * from ctt_noise import * from ctt_geq import * -from ctt_pretty_print_json import * +from ctt_pretty_print_json import pretty_print import random import json import re @@ -511,13 +511,17 @@ class Camera: """ def write_json(self): """ - Write json dictionary to file + Write json dictionary to file using our version 2 format """ - jstring = json.dumps(self.json, sort_keys=False) - """ - make it pretty :) - """ - pretty_print_json(jstring, self.jf) + + out_json = { + "version": 2.0, + 'target': 'bcm2835', + "algorithms": [{name: data} for name, data in self.json.items()], + } + + with open(self.jf, 'w') as f: + f.write(pretty_print(out_json)) """ add a new section to the log file |