tools/perf/contrib/cluster_telemetry/screenshot.py
def IsScreenshotWithinDynamicContentThreshold(base_screenshot, next_screenshot,
  content_pixels, num_total_pixels, dynamic_content_threshold):
  """Compares two screenshot images and updates the bytearray of RGB values
     that will be used to create the final output image if it finds an
     inconsistency. Returns False if the percentage of pixels with dynamic
     content is greater than the given threshold, and True otherwise."""
  base_pixels = image_util.Pixels(base_screenshot)
  next_pixels = image_util.Pixels(next_screenshot)

  num_dynamic_pixels = 0.0
  i = 0
  while i < len(base_pixels):
    # If the RGB values of the two screenshots do not match, make the
    # corresponding pixel in the accumulated bytearray cyan and increment the
    # count of dynamic pixels.
    if (base_pixels[i] != next_pixels[i] or
        base_pixels[i+1] != next_pixels[i+1] or
        base_pixels[i+2] != next_pixels[i+2]):
      content_pixels[i] = 0
      content_pixels[i+1] = 255
      content_pixels[i+2] = 255
      num_dynamic_pixels += 1
    i += 3

  if (num_dynamic_pixels / num_total_pixels) >= dynamic_content_threshold:
    logging.error("Percentage of pixels with dynamic content: %f",
                  num_dynamic_pixels / num_total_pixels)
    return False
  return True
Compares two screenshot images and updates the bytearray of RGB values
     that will be used to create the final output image if it finds an
     inconsistency. Returns False if the percentage of pixels with dynamic
     content is greater than the given threshold, and True otherwise.
Compares two screenshot images and updates the bytearray of RGB values
that will be used to create the final output image if it finds an
inconsistency. Returns False if the percentage of pixels with dynamic
content is greater than the given threshold, and True otherwise.
Compares two screenshot images and updates the bytearray of RGB values that will be used to create the final output image if it finds an inconsistency . Returns False if the percentage of pixels with dynamic content is greater than the given threshold and True otherwise .
def IsScreenshotWithinDynamicContentThreshold(base_screenshot, next_screenshot,
  content_pixels, num_total_pixels, dynamic_content_threshold):
  base_pixels = image_util.Pixels(base_screenshot)
  next_pixels = image_util.Pixels(next_screenshot)
  num_dynamic_pixels = 0.0
  i = 0
  while i < len(base_pixels):
    if (base_pixels[i] != next_pixels[i] or
        base_pixels[i+1] != next_pixels[i+1] or
        base_pixels[i+2] != next_pixels[i+2]):
      content_pixels[i] = 0
      content_pixels[i+1] = 255
      content_pixels[i+2] = 255
      num_dynamic_pixels += 1
    i += 3
  if (num_dynamic_pixels / num_total_pixels) >= dynamic_content_threshold:
    logging.error("Percentage of pixels with dynamic content: %f",
                  num_dynamic_pixels / num_total_pixels)
    return False
  return True
def IsScreenshotWithinDynamicContentThreshold ( base_screenshot , next_screenshot , content_pixels , num_total_pixels , dynamic_content_threshold ) : base_pixels = image_util . Pixels ( base_screenshot ) next_pixels = image_util . Pixels ( next_screenshot ) num_dynamic_pixels = 0.0 i = 0 while i < len ( base_pixels ) : if ( base_pixels [ i ] != next_pixels [ i ] or base_pixels [ i + 1 ] != next_pixels [ i + 1 ] or base_pixels [ i + 2 ] != next_pixels [ i + 2 ] ) : content_pixels [ i ] = 0 content_pixels [ i + 1 ] = 255 content_pixels [ i + 2 ] = 255 num_dynamic_pixels += 1 i += 3 if ( num_dynamic_pixels / num_total_pixels ) >= dynamic_content_threshold : logging . error ( "Percentage of pixels with dynamic content: %f" , num_dynamic_pixels / num_total_pixels ) return False return True
Compares two screenshot images and updates the bytearray of RGB values
that will be used to create the final output image if it finds an
inconsistency.
Compares two screenshot images and updates the bytearray of RGB values that will be used to create the final output image if it finds an inconsistency .
"""Compares two screenshot images and updates the bytearray of RGB values
     that will be used to create the final output image if it finds an
     inconsistency. Returns False if the percentage of pixels with dynamic
     content is greater than the given threshold, and True otherwise.""" # If the RGB values of the two screenshots do not match, make the # corresponding pixel in the accumulated bytearray cyan and increment the # count of dynamic pixels.
base_screenshot
next_screenshot
content_pixels
num_total_pixels
dynamic_content_threshold