Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Side by Side Diff: webrtc/tools/barcode_tools/barcode_decoder.py

Issue 2666333003: Better comparison for frame analyzer (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 # 3 #
4 # Use of this source code is governed by a BSD-style license 4 # Use of this source code is governed by a BSD-style license
5 # that can be found in the LICENSE file in the root of the source 5 # that can be found in the LICENSE file in the root of the source
6 # tree. An additional intellectual property rights grant can be found 6 # tree. An additional intellectual property rights grant can be found
7 # in the file PATENTS. All contributing project authors may 7 # in the file PATENTS. All contributing project authors may
8 # be found in the AUTHORS file in the root of the source tree. 8 # be found in the AUTHORS file in the root of the source tree.
9 9
10 import optparse 10 import optparse
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 and the helper .txt files are removed after they have been used. 125 and the helper .txt files are removed after they have been used.
126 """ 126 """
127 file_prefix = os.path.join(input_directory, 'frame_') 127 file_prefix = os.path.join(input_directory, 'frame_')
128 stats_file = open(stats_file_name, 'w') 128 stats_file = open(stats_file_name, 'w')
129 129
130 print 'Generating stats file: %s' % stats_file_name 130 print 'Generating stats file: %s' % stats_file_name
131 for i in range(1, _count_frames_in(input_directory=input_directory) + 1): 131 for i in range(1, _count_frames_in(input_directory=input_directory) + 1):
132 frame_number = helper_functions.zero_pad(i) 132 frame_number = helper_functions.zero_pad(i)
133 barcode_file_name = file_prefix + frame_number + '.txt' 133 barcode_file_name = file_prefix + frame_number + '.txt'
134 png_frame = file_prefix + frame_number + '.png' 134 png_frame = file_prefix + frame_number + '.png'
135 entry_frame_number = helper_functions.zero_pad(i-1) 135 entry_frame_number = helper_functions.zero_pad(i)
kjellander_webrtc 2017/02/06 12:30:38 So this means we start numbering frames from 1 ins
mandermo 2017/02/07 14:25:27 jansson@ is working on this change in another CL,
136 entry = 'frame_' + entry_frame_number + ' ' 136 entry = 'frame_' + entry_frame_number + ' '
137 137
138 if os.path.isfile(barcode_file_name): 138 if os.path.isfile(barcode_file_name):
139 barcode = _read_barcode_from_text_file(barcode_file_name) 139 barcode = _read_barcode_from_text_file(barcode_file_name)
140 os.remove(barcode_file_name) 140 os.remove(barcode_file_name)
141 141
142 if _check_barcode(barcode): 142 if _check_barcode(barcode):
143 entry += (helper_functions.zero_pad(int(barcode[0:11])) + '\n') 143 entry += (helper_functions.zero_pad(int(barcode[0:11])) + '\n')
144 else: 144 else:
145 entry += 'Barcode error\n' # Barcode is wrongly detected. 145 entry += 'Barcode error\n' # Barcode is wrongly detected.
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 return -2 282 return -2
283 283
284 # Generate statistics file. 284 # Generate statistics file.
285 _generate_stats_file(options.stats_file, 285 _generate_stats_file(options.stats_file,
286 input_directory=options.png_working_dir) 286 input_directory=options.png_working_dir)
287 print 'Completed barcode decoding.' 287 print 'Completed barcode decoding.'
288 return 0 288 return 0
289 289
290 if __name__ == '__main__': 290 if __name__ == '__main__':
291 sys.exit(_main()) 291 sys.exit(_main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698