Libraryless. Click here for Pure Java version (7908L/45K).
1 | // returns an array of length 256, each cell indicating how often |
2 | // each brightness (0 to 255) was encountered |
3 | static int[] bwImageHistogramArray(BWImage img) { |
4 | int[] histogram = new[256]; |
5 | byte[] pixels = img.pixels; |
6 | for i over pixels: |
7 | histogram[ubyteToInt(pixels[i])]++; |
8 | ret histogram; |
9 | } |
10 | |
11 | static int[] bwImageHistogramArray(BufferedImage img) { |
12 | ret bwImageHistogramArray(BWImage(img)); |
13 | } |
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: | 113 / 168 |
Referenced in: | [show references] |