Libraryless. Click here for Pure Java version (5753L/40K/141K).
1 | !7 |
2 | |
3 | p {
|
4 | RGBImage rgb = loadImage(#1006358); |
5 | int w = rgb.w(), h = rgb.h(); |
6 | *float[h] data; |
7 | for y to h: |
8 | data[y] = rangeLength(printStruct(wideBlack(rgb, w/2, y))); |
9 | showImageWithVerticalGraph(rgb, data); |
10 | } |
11 | |
12 | static Range wideBlack(RGBImage img, int x, int y) {
|
13 | int w = img.w(); |
14 | int x1 = x, x2 = x; |
15 | while (x1 > 0 && img.getPixel(x1-1, y).getBrightness() < 0.1) --x1; |
16 | while (x2 < w && img.getPixel(x2, y).getBrightness() < 0.1) ++x2; |
17 | ret new Range(x1, x2); |
18 | } |
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: | 783 / 938 |
| Referenced in: | [show references] |