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

Unified Diff: gm/rebaseline_server/imagediffdb.py

Issue 131453017: Revert of Add the perceptual difference metric to the rebaseline server (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gm/rebaseline_server/imagediffdb_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/rebaseline_server/imagediffdb.py
diff --git a/gm/rebaseline_server/imagediffdb.py b/gm/rebaseline_server/imagediffdb.py
index d168c888a7eceb9a8be9001213a473b56b8b6ec8..936301e1cdef393e736ad852283768482037a63c 100644
--- a/gm/rebaseline_server/imagediffdb.py
+++ b/gm/rebaseline_server/imagediffdb.py
@@ -10,28 +10,16 @@
"""
import contextlib
-import csv
import logging
import os
import re
import shutil
-import sys
-import tempfile
import urllib
try:
from PIL import Image, ImageChops
except ImportError:
raise ImportError('Requires PIL to be installed; see '
+ 'http://www.pythonware.com/products/pil/')
-
-# Set the PYTHONPATH to include the tools directory.
-sys.path.append(
- os.path.join(
- os.path.dirname(os.path.realpath(__file__)), os.pardir, os.pardir,
- 'tools'))
-import find_run_binary
-
-SKPDIFF_BINARY_NAME = 'skpdiff'
DEFAULT_IMAGE_SUFFIX = '.png'
DEFAULT_IMAGES_SUBDIR = 'images'
@@ -111,27 +99,6 @@
whitediff_image = (graydiff_image.point(lambda p: p > 0 and VALUES_PER_BAND)
.convert('1', dither=Image.NONE))
- # Calculate the perceptual difference percentage.
- skpdiff_csv_dir = tempfile.mkdtemp()
- try:
- skpdiff_csv_output = os.path.join(skpdiff_csv_dir, 'skpdiff-output.csv')
- skpdiff_binary = find_run_binary.find_path_to_program(SKPDIFF_BINARY_NAME)
- expected_img = os.path.join(storage_root, expected_images_subdir,
- str(expected_image_locator) + image_suffix)
- actual_img = os.path.join(storage_root, actual_images_subdir,
- str(actual_image_locator) + image_suffix)
- find_run_binary.run_command(
- [skpdiff_binary, '-p', expected_img, actual_img,
- '--csv', skpdiff_csv_output, '-d', 'perceptual'])
- with contextlib.closing(open(skpdiff_csv_output)) as csv_file:
- for row in csv.DictReader(csv_file):
- perceptual_similarity = float(row[' perceptual'].strip())
- # skpdiff returns the perceptual similarity, convert it to get the
- # perceptual difference percentage.
- self._perceptual_difference = 100 - (perceptual_similarity * 100)
- finally:
- shutil.rmtree(skpdiff_csv_dir)
-
# Final touches on diff_image: use whitediff_image as an alpha mask.
# Unchanged pixels are transparent; differing pixels are opaque.
diff_image.putalpha(whitediff_image)
@@ -160,10 +127,6 @@
0 and 100 (inclusive)."""
return ((float(self._num_pixels_differing) * 100) /
(self._width * self._height))
-
- def get_perceptual_difference(self):
- """Returns the perceptual difference percentage."""
- return self._perceptual_difference
def get_weighted_diff_measure(self):
"""Returns a weighted measure of image diffs, as a float between 0 and 100
« no previous file with comments | « no previous file | gm/rebaseline_server/imagediffdb_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698