Libraryless. Click here for Pure Java version (10980L/63K).
// images must have same size static int[] sumOfBinaryImages(L<? extends IBinaryImage> images) { int n = l(images); if (n == 0) null; var it = iterator(images); var img = it.next(); int w = img.getWidth(), h = img.getHeight(); int[] pixels = new[w*h]; int nBytes = (w*h+7)/8; var pingSource = pingSource(); while (true) { ping(pingSource); Image2B realizedImage = img.toImage2B(); byte[] imgPixels = realizedImage.pixels; int j = 0; for i to nBytes: { int b = imgPixels[i]; for bit to 8: { pixels[j++] += b & 1; b >>= 1; } } if (!it.hasNext()) break; img = it.next(); } ret pixels; }
Began life as a copy of #1035846
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): elmgxqgtpvxh, mqqgnosmbjvj, wnsclhtenguj
No comments. add comment
Snippet ID: | #1035868 |
Snippet name: | sumOfBinaryImages |
Eternal ID of this version: | #1035868/3 |
Text MD5: | 3e57dc6d90434e17f64969f501b98fa2 |
Transpilation MD5: | 39e98947d2dfb1d739b74d5aea0f36ed |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-08-05 15:40:55 |
Source code size: | 711 bytes / 30 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 117 / 169 |
Version history: | 2 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |