Python: module telemetry.internal.image_processing.screen_finder

telemetry.internal.image_processing.screen_finder | index telemetry/internal/image_processing/screen_finder.py

`# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# This script attempts to detect the region of a camera's field of view that
# contains the screen of the device we are testing.
#
# Usage: ./screen_finder.py path_to_video 0 0 --verbose`

Modules
`` |  |
copy cv2 telemetry.internal.image_processing.cv_util | telemetry.internal.util.external_modules telemetry.internal.image_processing.frame_generator logging | numpy os sys | telemetry.internal.image_processing.video_file_frame_generator

Classes
`` |  | __builtin__.object ScreenFinder
class ScreenFinder(__builtin__.object)
`` | `Finds and extracts device screens from video. Sample Usage: sf = ScreenFinder(sys.argv[1]) while sf.HasNext(): ret, screen = sf.GetNext() Attributes: _lost_corners: Each index represents whether or not we lost track of that corner on the previous frame. Ordered by [top-right, top-left, bottom-left, bottom-right] _frame: An unmodified copy of the frame we're currently processing. _frame_debug: A copy of the frame we're currently processing, may be modified at any time, used for debugging. _frame_grey: A greyscale copy of the frame we're currently processing. _frame_edges: A Canny Edge detected copy of the frame we're currently processing. _screen_size: The size of device screen in the video when first detected. _avg_corners: Exponentially weighted average of the previous corner locations. _prev_corners: The location of the corners in the previous frame. _lost_corner_frames: A counter of the number of successive frames in which we've lost a corner location. _border: See |border| above. _min_line_length: The minimum length a line must be before we consider it a possible screen edge. _frame_generator: See |frame_generator| above. _width, _height: The width and height of the frame. _anglesp5, _anglesm5: The angles for each point we look at in the grid when computing brightness, constant across frames.`
| Methods defined here: GetNext(self) `Gets the next screen image. Returns: A numpy matrix containing the screen surrounded by the number of border pixels specified in initialization, and the location of the detected screen corners in the current frame, if a screen is found. The returned screen is guaranteed to be the same size at each frame. 'None' and 'None' if no screen was found on the current frame. Raises: FrameReadError: An error occurred in the FrameGenerator. RuntimeError: This method was called when no frames were available.` HasNext(self) `True if there are more frames available to process.` __init__(self, frame_generator, border=5) `Initializes the ScreenFinder object. Args: frame_generator: FrameGenerator, An initialized Video Frame Generator. border: int, number of pixels of border to be kept when cropping the detected screen. Raises: FrameReadError: The frame generator may output a read error during initialization.` Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` Data and other attributes defined here: CANNY_HYSTERESIS_THRESH_HIGH = 500 CANNY_HYSTERESIS_THRESH_LOW = 300 CORNER_AVERAGE_WEIGHT = 0.5 CornerData = <class 'telemetry.internal.image_processing.screen_finder.CornerData'> DEBUG = False MAX_INTERFRAME_MOTION = 25 MIN_CORNER_ABSOLUTE_BRIGHTNESS = 60 MIN_RELATIVE_BRIGHTNESS_FACTOR = 1.5 MIN_SCREEN_WIDTH = 40 RESET_AFTER_N_BAD_FRAMES = 2 SMALL_ANGLE = 0.08726646259971647 ScreenNotFoundError = <class 'telemetry.internal.image_processing.screen_finder.ScreenNotFoundError'>

Functions
`` |  | main()

Data
`` |  | division = _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)