utils: raspberrypi: ctt: Fix pycodestyle E302
E302 expected 2 blank lines, found 0 Note that issues are still flagged, due to the use of docstrings as multi-lines comments. This will be addressed separately. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
This commit is contained in:
parent
33c4221e87
commit
e8655c2161
12 changed files with 20 additions and 0 deletions
|
@ -34,6 +34,7 @@ blank json file. This has been done to avoid reproducing the entire json file
|
||||||
in the code here, thereby avoiding unecessary clutter.
|
in the code here, thereby avoiding unecessary clutter.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Get the colour and lux values from the strings of each inidvidual image
|
Get the colour and lux values from the strings of each inidvidual image
|
||||||
"""
|
"""
|
||||||
|
@ -702,6 +703,7 @@ class Camera:
|
||||||
self.log += '\nERROR: Images are from different cameras'
|
self.log += '\nERROR: Images are from different cameras'
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
def run_ctt(json_output, directory, config, log_output):
|
def run_ctt(json_output, directory, config, log_output):
|
||||||
"""
|
"""
|
||||||
check input files are jsons
|
check input files are jsons
|
||||||
|
|
|
@ -9,6 +9,7 @@ import matplotlib.pyplot as plt
|
||||||
from matplotlib import cm
|
from matplotlib import cm
|
||||||
from mpl_toolkits.mplot3d import Axes3D
|
from mpl_toolkits.mplot3d import Axes3D
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
preform alsc calibration on a set of images
|
preform alsc calibration on a set of images
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -9,6 +9,7 @@ import matplotlib.pyplot as plt
|
||||||
from bisect import bisect_left
|
from bisect import bisect_left
|
||||||
from scipy.optimize import fmin
|
from scipy.optimize import fmin
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
obtain piecewise linear approximation for colour curve
|
obtain piecewise linear approximation for colour curve
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
from ctt_image_load import *
|
from ctt_image_load import *
|
||||||
from ctt_awb import get_alsc_patches
|
from ctt_awb import get_alsc_patches
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
takes 8-bit macbeth chart values, degammas and returns 16 bit
|
takes 8-bit macbeth chart values, degammas and returns 16 bit
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -8,6 +8,7 @@ from ctt_tools import *
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import scipy.optimize as optimize
|
import scipy.optimize as optimize
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Uses green differences in macbeth patches to fit green equalisation threshold
|
Uses green differences in macbeth patches to fit green equalisation threshold
|
||||||
model. Ideally, all macbeth chart centres would fall below the threshold as
|
model. Ideally, all macbeth chart centres would fall below the threshold as
|
||||||
|
|
|
@ -210,6 +210,7 @@ class Image:
|
||||||
self.patches = all_patches
|
self.patches = all_patches
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
def brcm_load_image(Cam, im_str):
|
def brcm_load_image(Cam, im_str):
|
||||||
"""
|
"""
|
||||||
Load image where raw data and metadata is in the BRCM format
|
Load image where raw data and metadata is in the BRCM format
|
||||||
|
@ -290,6 +291,7 @@ def brcm_load_image(Cam, im_str):
|
||||||
|
|
||||||
return Img
|
return Img
|
||||||
|
|
||||||
|
|
||||||
def dng_load_image(Cam, im_str):
|
def dng_load_image(Cam, im_str):
|
||||||
try:
|
try:
|
||||||
Img = Image(None)
|
Img = Image(None)
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
# ctt_lux.py - camera tuning tool for lux level
|
# ctt_lux.py - camera tuning tool for lux level
|
||||||
|
|
||||||
from ctt_tools import *
|
from ctt_tools import *
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Find lux values from metadata and calculate Y
|
Find lux values from metadata and calculate Y
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -13,6 +13,7 @@ NOTE: some custom functions have been used here to make the code more readable.
|
||||||
These are defined in tools.py if they are needed for reference.
|
These are defined in tools.py if they are needed for reference.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Some inconsistencies between packages cause runtime warnings when running
|
Some inconsistencies between packages cause runtime warnings when running
|
||||||
the clustering algorithm. This catches these warnings so they don't flood the
|
the clustering algorithm. This catches these warnings so they don't flood the
|
||||||
|
@ -291,6 +292,7 @@ def find_macbeth(Cam, img, mac_config=(0, 0)):
|
||||||
|
|
||||||
return(coords_fit)
|
return(coords_fit)
|
||||||
|
|
||||||
|
|
||||||
def get_macbeth_chart(img, ref_data):
|
def get_macbeth_chart(img, ref_data):
|
||||||
"""
|
"""
|
||||||
function returns coordinates of macbeth chart vertices and square centres,
|
function returns coordinates of macbeth chart vertices and square centres,
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
from ctt_image_load import *
|
from ctt_image_load import *
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Find noise standard deviation and fit to model:
|
Find noise standard deviation and fit to model:
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#
|
#
|
||||||
# ctt_pretty_print_json.py - camera tuning tool JSON formatter
|
# ctt_pretty_print_json.py - camera tuning tool JSON formatter
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
takes a collapsed json file and makes it more readable
|
takes a collapsed json file and makes it more readable
|
||||||
"""
|
"""
|
||||||
|
@ -11,10 +12,12 @@ def process_file(string, fout, state):
|
||||||
for c in string:
|
for c in string:
|
||||||
process_char(c, fout, state)
|
process_char(c, fout, state)
|
||||||
|
|
||||||
|
|
||||||
def print_newline(fout, state):
|
def print_newline(fout, state):
|
||||||
fout.write('\n')
|
fout.write('\n')
|
||||||
fout.write(' '*state["indent"]*4)
|
fout.write(' '*state["indent"]*4)
|
||||||
|
|
||||||
|
|
||||||
def process_char(c, fout, state):
|
def process_char(c, fout, state):
|
||||||
if c == '{':
|
if c == '{':
|
||||||
if not state["skipnewline"]:
|
if not state["skipnewline"]:
|
||||||
|
@ -61,6 +64,7 @@ def process_char(c, fout, state):
|
||||||
fout.write(c)
|
fout.write(c)
|
||||||
state["skipnewline"] = (c == '[')
|
state["skipnewline"] = (c == '[')
|
||||||
|
|
||||||
|
|
||||||
def pretty_print_json(str_in, output_filename):
|
def pretty_print_json(str_in, output_filename):
|
||||||
state = {"indent": 0, "inarray": [False], "arraycount": [], "skipnewline": True}
|
state = {"indent": 0, "inarray": [False], "arraycount": [], "skipnewline": True}
|
||||||
with open(output_filename, "w") as fout:
|
with open(output_filename, "w") as fout:
|
||||||
|
|
|
@ -8,6 +8,7 @@ import numpy as np
|
||||||
|
|
||||||
scale = 2
|
scale = 2
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
constructs normalised macbeth chart corners for ransac algorithm
|
constructs normalised macbeth chart corners for ransac algorithm
|
||||||
"""
|
"""
|
||||||
|
@ -57,6 +58,7 @@ def get_square_verts(c_err=0.05, scale=scale):
|
||||||
# print(square_verts)
|
# print(square_verts)
|
||||||
return np.array(square_verts, np.float32), mac_norm
|
return np.array(square_verts, np.float32), mac_norm
|
||||||
|
|
||||||
|
|
||||||
def get_square_centres(c_err=0.05, scale=scale):
|
def get_square_centres(c_err=0.05, scale=scale):
|
||||||
"""
|
"""
|
||||||
define macbeth square centres
|
define macbeth square centres
|
||||||
|
|
|
@ -22,6 +22,7 @@ understanding of the code. They ar collated here to attempt to improve code
|
||||||
readability in the main files.
|
readability in the main files.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
obtain config values, unless it doesnt exist, in which case pick default
|
obtain config values, unless it doesnt exist, in which case pick default
|
||||||
Furthermore, it can check if the input is the correct type
|
Furthermore, it can check if the input is the correct type
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue