get("#348") -- bright and rgb function getContrast(img) local w, h = img.width, img.height local min, max = 1, 0 for y = 0, h-1 do for x = 0, w-1 do local b = bright(rgb(img.getInt(x, y))) min, max = math.min(min, b), math.max(max, b) end end local minp = math.floor(min*100+0.5) local maxp = math.floor(max*100+0.5) return minp, maxp, min, max end
Began life as a copy of #371
test run test run with input download show line numbers
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
ID | Author/Program | Comment | Date | |
---|---|---|---|---|
627 | #1000610 | Edit suggestion: !636 !629 main { static Object androidContext; static String programID; public static void main(String[] args) throws Exception { get("#348") -- bright and rgb function getContrast(img) local w, h = img.width, img.height local min, max = 1, 0 for y = 0, h-1 do for x = 0, w-1 do local b = bright(rgb(img.getInt(x, y))) min, max = math.min(min, b), math.max(max, b) end end local minp = math.floor(min*100+0.5) local maxp = math.floor(max*100+0.5) return minp, maxp, min, max end }} | 2015-08-19 01:14:41 | delete |
625 | #1000604 (pitcher) | 2015-08-18 00:07:22 |
Snippet ID: | #372 |
Snippet name: | Brightness range (contrast), embeddable |
Eternal ID of this version: | #372/1 |
Text MD5: | d9bb2f37d64d5385605e158ae1f09eea |
Author: | stefan |
Category: | feature extractor |
Type: | Lua code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-01-31 23:55:30 |
Source code size: | 407 bytes / 18 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 1033 / 187 |
Referenced in: | [show references] |