# 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. from __future__ import division from telemetry.core import util from telemetry.image_processing import histogram from telemetry.image_processing import rgba_color from telemetry.util import external_modules util.AddDirToPythonPath(util.GetTelemetryDir(), 'third_party', 'png') import png # pylint: disable=F0401 cv2 = external_modules.ImportOptionalModule('cv2') np = external_modules.ImportRequiredModule('numpy') def Channels(image): return image.shape[2] def Width(image): return image.shape[1] def Height(image): return image.shape[0] def Pixels(image):
from telemetry.core.backends import adb_commands from telemetry.core.forwarders import android_forwarder from telemetry.core import platform from telemetry.core.platform import android_device from telemetry.core.platform import android_platform from telemetry.core.platform import linux_based_platform_backend from telemetry.core.platform.power_monitor import android_ds2784_power_monitor from telemetry.core.platform.power_monitor import android_dumpsys_power_monitor from telemetry.core.platform.power_monitor import android_temperature_monitor from telemetry.core.platform.power_monitor import monsoon_power_monitor from telemetry.core.platform.power_monitor import power_monitor_controller from telemetry.core.platform.profiler import android_prebuilt_profiler_helper from telemetry.util import exception_formatter from telemetry.util import external_modules psutil = external_modules.ImportOptionalModule('psutil') util.AddDirToPythonPath(util.GetChromiumSrcDir(), 'third_party', 'webpagereplay') import adb_install_cert # pylint: disable=F0401 import certutils # pylint: disable=F0401 # Get build/android scripts into our path. util.AddDirToPythonPath(util.GetChromiumSrcDir(), 'build', 'android') from pylib import screenshot # pylint: disable=F0401 from pylib.device import device_errors # pylint: disable=F0401 from pylib.perf import cache_control # pylint: disable=F0401 from pylib.perf import perf_control # pylint: disable=F0401 from pylib.perf import thermal_throttle # pylint: disable=F0401 try: from pylib.perf import surface_stats_collector # pylint: disable=F0401
# Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Provides implementations of basic image processing functions. Implements basic image processing functions, such as reading/writing images, cropping, finding the bounding box of a color and diffing images. When numpy is present, image_util_numpy_impl is used for the implementation of this interface. The old bitmap implementation (image_util_bitmap_impl) is used as a fallback when numpy is not present.""" import base64 from telemetry.util import external_modules np = external_modules.ImportOptionalModule('numpy') if np is None: from telemetry.image_processing import image_util_bitmap_impl impl = image_util_bitmap_impl else: from telemetry.image_processing import image_util_numpy_impl impl = image_util_numpy_impl def Channels(image): """Number of color channels in the image.""" return impl.Channels(image) def Width(image):