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

18
LINES

< > BotCompany Repo | #1006377 // Wide, Black

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (5753L/40K/141K).

!7

p {
  RGBImage rgb = loadImage(#1006358);
  int w = rgb.w(), h = rgb.h();
  *float[h] data;
  for y to h:
    data[y] = rangeLength(printStruct(wideBlack(rgb, w/2, y)));
  showImageWithVerticalGraph(rgb, data);
}

static Range wideBlack(RGBImage img, int x, int y) {
  int w = img.w();
  int x1 = x, x2 = x;
  while (x1 > 0 && img.getPixel(x1-1, y).getBrightness() < 0.1) --x1;
  while (x2 < w && img.getPixel(x2, y).getBrightness() < 0.1) ++x2;
  ret new Range(x1, x2);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006377
Snippet name: Wide, Black
Eternal ID of this version: #1006377/1
Text MD5: 5b07737405cc227b46cabc9d92169502
Transpilation MD5: eefa8c8514353329bb25c353ce4477ee
Author: stefan
Category: javax / imaging
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-02-22 16:27:59
Source code size: 493 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 462 / 546
Referenced in: [show references]