Libraryless. Click here for Pure Java version (5165L/33K).
1 | static BWImage bwLocalMaximaFilter_autoContrast(BWImage img) {
|
2 | int w = img.getWidth(), h = img.getHeight(); |
3 | float[] f = new[w*h]; |
4 | int i = 0; |
5 | for y to h: |
6 | for x to w: |
7 | f[i++] = |
8 | img.getPixel(x, y)- |
9 | (img.getPixel(x, max(0, y-1)) + |
10 | img.getPixel(max(0, x-1), y) + |
11 | img.getPixel(min(w-1, x+1), y) + |
12 | img.getPixel(x, min(h-1, y+1)))/4; |
13 | ret iBWAutoContrast(iBWImageFromFloats(w, f)); |
14 | } |
Began life as a copy of #1027295
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: | #1027298 |
| Snippet name: | bwLocalMaximaFilter_autoContrast |
| Eternal ID of this version: | #1027298/3 |
| Text MD5: | 0d024615aaff0a6fd78ec94aebd6727b |
| Transpilation MD5: | a72a9f767f86bc63eda297d4860a46d0 |
| Author: | stefan |
| Category: | javax / images |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-03-01 00:02:56 |
| Source code size: | 447 bytes / 14 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 428 / 580 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |