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

Side by Side Diff: telemetry/telemetry/internal/image_processing/image_util_numpy_impl.py

Issue 2988553002: Fixed errors related to bad-continuation pt.11 (Closed)
Patch Set: Fix additional errors Created 3 years, 5 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 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from __future__ import division 5 from __future__ import division
6 6
7 import warnings 7 import warnings
8 8
9 from telemetry.internal.util import external_modules 9 from telemetry.internal.util import external_modules
10 from telemetry.util import color_histogram 10 from telemetry.util import color_histogram
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 filtered = image.reshape(-1, 3) 171 filtered = image.reshape(-1, 3)
172 if ignore_color is not None: 172 if ignore_color is not None:
173 color = np.array([ignore_color.b, ignore_color.g, ignore_color.r]) 173 color = np.array([ignore_color.b, ignore_color.g, ignore_color.r])
174 colorm = np.array(color) - tolerance 174 colorm = np.array(color) - tolerance
175 colorp = np.array(color) + tolerance 175 colorp = np.array(color) + tolerance
176 in_range = ((filtered[:, 0] < colorm[0]) | (filtered[:, 0] > colorp[0]) | 176 in_range = ((filtered[:, 0] < colorm[0]) | (filtered[:, 0] > colorp[0]) |
177 (filtered[:, 1] < colorm[1]) | (filtered[:, 1] > colorp[1]) | 177 (filtered[:, 1] < colorm[1]) | (filtered[:, 1] > colorp[1]) |
178 (filtered[:, 2] < colorm[2]) | (filtered[:, 2] > colorp[2])) 178 (filtered[:, 2] < colorm[2]) | (filtered[:, 2] > colorp[2]))
179 filtered = np.compress(in_range, filtered, axis=0) 179 filtered = np.compress(in_range, filtered, axis=0)
180 if len(filtered[:, 0]) == 0: 180 if len(filtered[:, 0]) == 0:
181 return color_histogram.ColorHistogram(np.zeros((256)), np.zeros((256)), 181 return color_histogram.ColorHistogram(
182 np.zeros((256)), ignore_color) 182 np.zeros((256)), np.zeros((256)),
183 np.zeros((256)), ignore_color)
183 hist_b = np.bincount(filtered[:, 0], minlength=256) 184 hist_b = np.bincount(filtered[:, 0], minlength=256)
184 hist_g = np.bincount(filtered[:, 1], minlength=256) 185 hist_g = np.bincount(filtered[:, 1], minlength=256)
185 hist_r = np.bincount(filtered[:, 2], minlength=256) 186 hist_r = np.bincount(filtered[:, 2], minlength=256)
186 187
187 return color_histogram.ColorHistogram(hist_r, hist_g, hist_b, ignore_color) 188 return color_histogram.ColorHistogram(hist_r, hist_g, hist_b, ignore_color)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698