get("#372") -- getContrast brightnessThreshold = 0.5 -- convert pixel by pixel w, h = img.width, img.height pixels = {} for y = 0, h-1 do for x = 0, w-1 do b = bright(rgb(img.getInt(x, y))) pixels[y*w+x+1] = b >= brightnessThreshold and -1 or 0 end end
Began life as a copy of #373
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 | |
---|---|---|---|---|
487 | #1000610 | Edit suggestion: !636 !629 main { static Object androidContext; static String programID; public static void main(String[] args) throws Exception { get("#372") -- getContrast brightnessThreshold = 0.5 -- convert pixel by pixel w, h = img.width, img.height pixels = {} for y = 0, h-1 do for x = 0, w-1 do b = bright(rgb(img.getInt(x, y))) pixels[y*w+x+1] = b >= brightnessThreshold and -1 or 0 end end }} | 2015-08-18 17:45:47 | delete |
485 | #1000604 (pitcher) | 2015-08-18 00:07:22 |
Snippet ID: | #503 |
Snippet name: | Convert image to 1 bit (threshold 50%) |
Eternal ID of this version: | #503/1 |
Text MD5: | bd96867e92727d23bc2e521f226164c1 |
Author: | stefan |
Category: | image transformers |
Type: | Lua code - Image transformer |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-03-09 18:12:48 |
Source code size: | 282 bytes / 14 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 1091 / 181 |
Referenced in: | [show references] |