Skip to content
This repository has been archived by the owner on Feb 14, 2018. It is now read-only.

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

Merged
merged 1 commit into from
Nov 26, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions client/plugins/efficiency/efficiency.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions client/test/testclient.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2512,22 +2512,22 @@ require.define("/plugins/efficiency/efficiency.js",function(require,module,expor
return div.find('p:first').text("" + (value.toFixed(1)) + "%"); return div.find('p:first').text("" + (value.toFixed(1)) + "%");
}; };
getImageData = function(div) { getImageData = function(div) {
var c, d, h, imageData, img, w; var can, ctx, h, imageData, img, w;
img = new Image; img = new Image;
img.src = $(div).data('item').url; img.src = $(div).data('item').url;
w = img.width; w = img.width;
h = img.height; h = img.height;
c = $('<canvas id="myCanvas" width="#{w}" height="#{h}">'); can = $('<canvas id="myCanvas" width="#{w}" height="#{h}">');
d = c.get(0).getContext("2d"); ctx = can.get(0).getContext("2d");
d.drawImage(img, 0, 0); ctx.drawImage(img, 0, 0);
wiki.log('efficiency img w, h', w, h, 'c w, h ', c.width(), c.height()); wiki.log('efficiency img w, h', w, h, 'c w, h ', can.width(), can.height());
imageData = d.getImageData(0, 0, w, h); imageData = ctx.getImageData(0, 0, w, h);
return imageData.data; return imageData.data;
}; };
calculatePercentage = function(data) { calculatePercentage = function(data) {
var lumas; var lumas;
lumas = window.plugins.efficiency.getGrayLumaFromRGBT(data); lumas = window.plugins.efficiency.getGrayLumaFromRGBT(data);
return window.plugins.efficiency.calculateStrategy_GrayIterativeClustering(lumas); return window.plugins.efficiency.calculateStrategy_GrayBinary(lumas);
}; };
return display(calculate(locate())); return display(calculate(locate()));
}, },
Expand Down