Libraryless. Click here for Pure Java version (5113L/33K).
1 | static Pt brightestPixel(BWImage img) { |
2 | int w = img.getWidth(), h = img.getHeight(); |
3 | new LPair<Pt, Int> l; |
4 | int bestX = -1, bestY = -1, score = -1; |
5 | for y to h: |
6 | for x to w: { |
7 | int val = img.getInt(x, y); |
8 | if (val > score) { |
9 | bestX = x; |
10 | bestY = y; |
11 | score = val; |
12 | } |
13 | } |
14 | |
15 | ret score >= 0 ? Pt(bestX, bestY) : null; |
16 | } |
Began life as a copy of #1027299
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: | #1027301 |
Snippet name: | brightestPixel - coordinates of brightest pixel |
Eternal ID of this version: | #1027301/2 |
Text MD5: | 81f8ef26864c84b12f7cbf90a527fd0e |
Transpilation MD5: | 9b92647b9a3efca92b2541758284932e |
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:39:02 |
Source code size: | 384 bytes / 16 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 202 / 291 |
Version history: | 1 change(s) |
Referenced in: | [show references] |