Transpiled version (5123L) is out of date.
static BWImage iBWAutoContrast(IBWImage bw) { ret iBWAutoContrast(bw, 0f); } // def value is usually irrelevant static BWImage iBWAutoContrast(IBWImage bw, float def) { if (bw == null) null; int w = bw.getWidth(), h = bw.getHeight(); float min = 1, max = 0; for y to h: for x to w: { float f = bw.getFloatPixel(x, y); min = min(min, f); max = max(max, f); } if (min == max) ret new BWImage(w, h, def); float factor = floatRatio(1, max-min); BWImage bw2 = new BWImage(w, h); for y to h: for x to w: bw2.setPixel(x, y, (bw.getFloatPixel(x, y)-min)*factor); ret bw2; }
Began life as a copy of #1015507
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1027296 |
Snippet name: | iBWAutoContrast - uses actual min and max |
Eternal ID of this version: | #1027296/4 |
Text MD5: | c84acc2120f703847e7a36cd70faf024 |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-03-01 00:02:49 |
Source code size: | 624 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 188 / 279 |
Version history: | 3 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |