1 | static BWImage bwImageTo2Bit(BWImage img, float threshold) { |
2 | int w = img.w(), h = img.h(); |
3 | BWImage img2 = new BWImage(w, h); |
4 | for y to h: for x to w: |
5 | img2.setPixel(x, y, img.getPixel(x, y) >= threshold ? 1f : 0f); |
6 | ret img2; |
7 | } |
8 | |
9 | static BWImage bwImageTo2Bit(BWImage img) { |
10 | ret bwImageTo2Bit(0.5f, img); |
11 | } |
12 | |
13 | static BWImage bwImageTo2Bit(float threshold, BWImage img) { |
14 | ret bwImageTo2Bit(img, threshold); |
15 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1006251 |
Snippet name: | bwImageTo2Bit |
Eternal ID of this version: | #1006251/3 |
Text MD5: | 2b6757e6dc9f5111b1383f10156d9da9 |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-08-24 15:10:19 |
Source code size: | 430 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 584 / 629 |
Version history: | 2 change(s) |
Referenced in: | [show references] |