| OLD | NEW |
| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 'zxing.exe, you should keep the default value to ' | 253 'zxing.exe, you should keep the default value to ' |
| 254 'avoid problems. Default: %default')) | 254 'avoid problems. Default: %default')) |
| 255 options, _ = parser.parse_args() | 255 options, _ = parser.parse_args() |
| 256 return options | 256 return options |
| 257 | 257 |
| 258 | 258 |
| 259 def main(): | 259 def main(): |
| 260 """The main function. | 260 """The main function. |
| 261 | 261 |
| 262 A simple invocation is: | 262 A simple invocation is: |
| 263 ./webrtc/tools/barcode_tools/barcode_decoder.py | 263 ./webrtc/rtc_tools/barcode_tools/barcode_decoder.py |
| 264 --yuv_file=<path_and_name_of_overlaid_yuv_video> | 264 --yuv_file=<path_and_name_of_overlaid_yuv_video> |
| 265 --yuv_frame_width=640 --yuv_frame_height=480 | 265 --yuv_frame_width=640 --yuv_frame_height=480 |
| 266 --stats_file=<path_and_name_to_stats_file> | 266 --stats_file=<path_and_name_to_stats_file> |
| 267 """ | 267 """ |
| 268 options = _ParseArgs() | 268 options = _ParseArgs() |
| 269 | 269 |
| 270 # Convert the overlaid YUV video into a set of PNG frames. | 270 # Convert the overlaid YUV video into a set of PNG frames. |
| 271 if not ConvertYuvToPngFiles(options.yuv_file, options.yuv_frame_width, | 271 if not ConvertYuvToPngFiles(options.yuv_file, options.yuv_frame_width, |
| 272 options.yuv_frame_height, | 272 options.yuv_frame_height, |
| 273 output_directory=options.png_working_dir, | 273 output_directory=options.png_working_dir, |
| 274 ffmpeg_path=options.ffmpeg_path): | 274 ffmpeg_path=options.ffmpeg_path): |
| 275 print 'An error occurred converting from YUV to PNG frames.' | 275 print 'An error occurred converting from YUV to PNG frames.' |
| 276 return -1 | 276 return -1 |
| 277 | 277 |
| 278 # Decode the barcodes from the PNG frames. | 278 # Decode the barcodes from the PNG frames. |
| 279 if not DecodeFrames(input_directory=options.png_working_dir, | 279 if not DecodeFrames(input_directory=options.png_working_dir, |
| 280 zxing_path=options.zxing_path): | 280 zxing_path=options.zxing_path): |
| 281 print 'An error occurred decoding barcodes from PNG frames.' | 281 print 'An error occurred decoding barcodes from PNG frames.' |
| 282 return -2 | 282 return -2 |
| 283 | 283 |
| 284 # Generate statistics file. | 284 # Generate statistics file. |
| 285 _GenerateStatsFile(options.stats_file, | 285 _GenerateStatsFile(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()) |
| OLD | NEW |