Libraryless. Click here for Pure Java version (7908L/45K).
// returns an array of length 256, each cell indicating how often // each brightness (0 to 255) was encountered static int[] bwImageHistogramArray(BWImage img) { int[] histogram = new[256]; byte[] pixels = img.pixels; for i over pixels: histogram[ubyteToInt(pixels[i])]++; ret histogram; } static int[] bwImageHistogramArray(BufferedImage img) { ret bwImageHistogramArray(BWImage(img)); }
Began life as a copy of #1022912
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1035043 |
| Snippet name: | bwImageHistogramArray |
| Eternal ID of this version: | #1035043/1 |
| Text MD5: | 9484849ebfd377da3397a30946f5d2a3 |
| Transpilation MD5: | 71804aecc026e4e4c1f405dd253aa104 |
| Author: | stefan |
| Category: | javax / imaging |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-03-25 21:17:49 |
| Source code size: | 415 bytes / 13 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 325 / 421 |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |