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

9
LINES

< > BotCompany Repo | #1035873 // pixelsByBrightness

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

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

static L<Pt> pixelsByBrightness(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[i], data[j]));
  int w = image.w();
  ret listFromFunction(n, i -> ptFromPixelIndex(indices[i], w));
}

Author comment

Began life as a copy of #1035872

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1035873
Snippet name: pixelsByBrightness
Eternal ID of this version: #1035873/1
Text MD5: a330550d45e95796ef53e2681ea77794
Transpilation MD5: f8e614f974cd63285911d63283eae172
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:21:20
Source code size: 334 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 155 / 187
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)