Permalink
Browse files

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

Plus minor renaming for some single-letter variables.
  • Loading branch information...
1 parent f9b496e commit f392f94f4d6852a86a162dc7502cac793e1d7a7d @mkelleyharris committed Nov 26, 2012
@@ -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) {
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -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()));
},

0 comments on commit f392f94

Please sign in to comment.