Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

9
LINES

< > BotCompany Repo | #1035872 // pixelsByDescendingBrightness

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (10933L/63K).

static L<Pt> pixelsByDescendingBrightness(IBWImage image) {
  float[] data = image.toFloatArray();
  int n = l(data);
  int[] indices = new[n];
  for i to n: indices[i] = i;
  timSortIntArrayWithComparator(indices, (i, j) -> cmp(data[j], data[i]));
  int w = image.w();
  ret listFromFunction(n, i -> ptFromPixelIndex(indices[i], w));
}

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: 71 / 102
Version history: 2 change(s)
Referenced in: [show references]