Libraryless. Click here for Pure Java version (10933L/63K).
1 | static L<Pt> pixelsByDescendingBrightness(IBWImage image) { |
2 | float[] data = image.toFloatArray(); |
3 | int n = l(data); |
4 | int[] indices = new[n]; |
5 | for i to n: indices[i] = i; |
6 | timSortIntArrayWithComparator(indices, (i, j) -> cmp(data[j], data[i])); |
7 | int w = image.w(); |
8 | ret listFromFunction(n, i -> ptFromPixelIndex(indices[i], w)); |
9 | } |
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): elmgxqgtpvxh, mqqgnosmbjvj, wnsclhtenguj
No comments. add comment
Snippet ID: | #1035872 |
Snippet name: | pixelsByDescendingBrightness |
Eternal ID of this version: | #1035872/3 |
Text MD5: | 2ed20dfe33ec3ee66162deecee5231c1 |
Transpilation MD5: | 63757f57d62529f4c2780c27f80defac |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-08-05 19:06:58 |
Source code size: | 344 bytes / 9 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 184 / 229 |
Version history: | 2 change(s) |
Referenced in: | [show references] |