Libraryless. Click here for Pure Java version (5113L/33K).
static Pt brightestPixel(BWImage img) { int w = img.getWidth(), h = img.getHeight(); new LPair<Pt, Int> l; int bestX = -1, bestY = -1, score = -1; for y to h: for x to w: { int val = img.getInt(x, y); if (val > score) { bestX = x; bestY = y; score = val; } } ret score >= 0 ? Pt(bestX, bestY) : null; }
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: | 417 / 550 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |