Libraryless. Click here for Pure Java version (4437L/25K).
sclass IIVerticalSplit extends Meta implements IIntegralImage { // y coordinate of split point int splitPoint; // a and b must have same width // [0; splitPoint) RegisteredReference<IIntegralImage> a = new(this); // [splitPoint; height) RegisteredReference<IIntegralImage> b = new(this); *() {} *(IIntegralImage img, int splitPoint) { init(img, splitPoint); } void init(IIntegralImage img, int splitPoint) { this.splitPoint = splitPoint; int w = img.getWidth(), h = img.getHeight(); a.set(img.clip(0, 0, w, splitPoint)); b.set(img.clip(0, splitPoint, w, h-splitPoint)); } *(IIntegralImage img) { int h = img.getHeight(); if (h < 2) fail("Can't split image vertically - too small"); init(img, h/2); } *(IIntegralImage img1, IIntegralImage img2) { a.set(img1); b.set(img2); splitPoint = img1.getHeight(); } public int getWidth() { ret a->getWidth(); } public simplyCached int getHeight() { ret a->getHeight()+b->getHeight(); } public double getIntegralValue(int x, int y, int channel) { if (y < splitPoint) ret a->getIntegralValue(x, y, channel); else ret a->getIntegralValue(x, splitPoint, channel) + b->getIntegralValue(x, y-splitPoint, channel); } public double getIntegralValue(int x, int y) { if (y < splitPoint) ret a->getIntegralValue(x, y); else ret a->getIntegralValue(x, splitPoint) + b->getIntegralValue(x, y-splitPoint); } public BufferedImage getBufferedImage() { BufferedImage img = newBufferedImage(getWidth(), getHeight()); var g = graphics(img); a->drawAt(g, 0, 0); b->drawAt(g, 0, splitPoint); ret img; } }
Began life as a copy of #1031958
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
| Snippet ID: | #1031959 |
| Snippet name: | IIVerticalSplit - IIntegralImage composed of 2 vertical parts (OK) |
| Eternal ID of this version: | #1031959/8 |
| Text MD5: | 26e2b7fa8f11fe3d0e091147b172f7b8 |
| Transpilation MD5: | 79b53662631f88216a609f64ec003778 |
| Author: | stefan |
| Category: | javax / image recognition |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-08-17 13:49:14 |
| Source code size: | 1786 bytes / 63 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 411 / 633 |
| Version history: | 7 change(s) |
| Referenced in: | #1031964 - IIHorizontalSplit - IIntegralImage composed of 2 horizontal parts (OK) #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674) |