Skip to content

Commit

Permalink
Refactoring: rename variable
Browse files Browse the repository at this point in the history
  • Loading branch information
jabriffa committed Jun 13, 2018
1 parent ca921d4 commit 796a2c0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pyshared/jbcr2.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,25 @@ def decode_lossless_jpeg(filename):
# 472 pixels from each of 4 colors (last one)

# interpret output to determine the number of color components and precision
components = []
component_list = []
for line in out.split('\n'):
if line.startswith('>> '):
record = line.split()
f = record[4]
w = int(record[6])
h = int(record[8])
components.append((f,w,h))
component_list.append((f,w,h))
elif line.startswith('Caution: precision type:'):
record = line.split()
print "RAW data precision: %d" % int(record[3])
# number of color components
n = len(components)
n = len(component_list)
# first assemble color components
width = sum([w for f,w,h in components])
height = components[0][2]
assert all([h == height for f,w,h in components])
width = sum([w for f,w,h in component_list])
height = component_list[0][2]
assert all([h == height for f,w,h in component_list])
a = np.zeros((height, width), dtype=np.dtype('>H'))
for i, (f,w,h) in enumerate(components):
for i, (f,w,h) in enumerate(component_list):
# read raw data for this component
b = np.fromfile(f, dtype=np.dtype('>H'))
b.shape = (h,w)
Expand All @@ -98,7 +98,7 @@ def decode_lossless_jpeg(filename):
# remove (empty) temporary folder
os.rmdir(tmpfolder)

return a, len(components)
return a, len(component_list)

## unslice sensor image

Expand Down

0 comments on commit 796a2c0

Please sign in to comment.