Libraryless. Click here for Pure Java version (10787L/62K).
1 | // white = certain (either completely black or completely white) |
2 | // black = uncertain (exactly 50% gray) |
3 | static BWImage certaintyImage(IBWImage img) { |
4 | ret bwImageFromFunction(img.getWidth(), img.getHeight(), |
5 | (x, y) -> { |
6 | double pix = img.getFloatPixel(x, y); |
7 | ret absdiff(pix, 0.5)*2; |
8 | }); |
9 | } |
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035826 |
Snippet name: | certaintyImage |
Eternal ID of this version: | #1035826/1 |
Text MD5: | c8ba7322d4a1e5a54cfe3ee9ee25919c |
Transpilation MD5: | 688bd8543ff6b8f5e046b4bd90af8d1c |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-08-02 00:18:45 |
Source code size: | 318 bytes / 9 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 122 / 173 |
Referenced in: | [show references] |