Libraryless. Click here for Pure Java version (5239L/34K).
1 | static L<Pt> listOfBrightestPixels(BWImage img) { |
2 | int w = img.getWidth(), h = img.getHeight(); |
3 | new LPair<Pt, Int> l; |
4 | for y to h: |
5 | for x to w: |
6 | l.add(pair(pt(x, y), img.getInt(x, y)); |
7 | ret pairsA(sortBySecondOfPairsDesc_inPlace(l)); |
8 | } |
9 | |
10 | static L<Pt> listOfBrightestPixels(int n, BWImage img) { |
11 | ret takeFirst(n, listOfBrightestPixels(img)); |
12 | } |
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: | #1027299 |
Snippet name: | listOfBrightestPixels |
Eternal ID of this version: | #1027299/2 |
Text MD5: | 6b7c29700b8c2f5c21bdec2da42a3422 |
Transpilation MD5: | fbe4b080faf764abc71ef1268024df2c |
Author: | stefan |
Category: | javax / maths |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-03-01 01:27:35 |
Source code size: | 367 bytes / 12 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 191 / 299 |
Version history: | 1 change(s) |
Referenced in: | [show references] |