Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix the 140px test image to be exactly 50%. Results correct for it. #325

Merged
merged 1 commit into from

2 participants

@mkelleyharris

Plus minor renaming for some single-letter variables.

@WardCunningham WardCunningham merged commit 730cdb3 into WardCunningham:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 26, 2012
  1. @mkelleyharris

    Fix the 140px test image to be exactly 50%. Results correct for it.

    mkelleyharris authored
    Plus minor renaming for some single-letter variables.
This page is out of date. Refresh to see the latest.
View
12 client/plugins/efficiency/efficiency.js
@@ -28,16 +28,16 @@
return div.find('p:first').text("" + (value.toFixed(1)) + "%");
};
getImageData = function(div) {
- var c, d, h, imageData, img, w;
+ var can, ctx, h, imageData, img, w;
img = new Image;
img.src = $(div).data('item').url;
w = img.width;
h = img.height;
- c = $('<canvas id="myCanvas" width="#{w}" height="#{h}">');
- d = c.get(0).getContext("2d");
- d.drawImage(img, 0, 0);
- wiki.log('efficiency img w, h', w, h, 'c w, h ', c.width(), c.height());
- imageData = d.getImageData(0, 0, w, h);
+ can = $('<canvas id="myCanvas" width="#{w}" height="#{h}">');
+ ctx = can.get(0).getContext("2d");
+ ctx.drawImage(img, 0, 0);
+ wiki.log('efficiency img w, h', w, h, 'canvas w, h ', can.width(), can.height());
+ imageData = ctx.getImageData(0, 0, w, h);
return imageData.data;
};
calculatePercentage = function(data) {
View
BIN  client/plugins/efficiency/pages/high-contrast-test-image-white-area-50per-140px.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
14 client/test/testclient.js
@@ -2512,22 +2512,22 @@ require.define("/plugins/efficiency/efficiency.js",function(require,module,expor
return div.find('p:first').text("" + (value.toFixed(1)) + "%");
};
getImageData = function(div) {
- var c, d, h, imageData, img, w;
+ var can, ctx, h, imageData, img, w;
img = new Image;
img.src = $(div).data('item').url;
w = img.width;
h = img.height;
- c = $('<canvas id="myCanvas" width="#{w}" height="#{h}">');
- d = c.get(0).getContext("2d");
- d.drawImage(img, 0, 0);
- wiki.log('efficiency img w, h', w, h, 'c w, h ', c.width(), c.height());
- imageData = d.getImageData(0, 0, w, h);
+ can = $('<canvas id="myCanvas" width="#{w}" height="#{h}">');
+ ctx = can.get(0).getContext("2d");
+ ctx.drawImage(img, 0, 0);
+ wiki.log('efficiency img w, h', w, h, 'c w, h ', can.width(), can.height());
+ imageData = ctx.getImageData(0, 0, w, h);
return imageData.data;
};
calculatePercentage = function(data) {
var lumas;
lumas = window.plugins.efficiency.getGrayLumaFromRGBT(data);
- return window.plugins.efficiency.calculateStrategy_GrayIterativeClustering(lumas);
+ return window.plugins.efficiency.calculateStrategy_GrayBinary(lumas);
};
return display(calculate(locate()));
},
Something went wrong with that request. Please try again.