Skip to content

Commit cfaa22c

Browse files
committed
Update readme.
1 parent e85b8df commit cfaa22c

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@ Video++ is a video and image processing library that takes advantage of the C++1
77
```c++
88
// A fast parallel implementation of a box_filter using Video++.
99

10-
image2d<int> in(1000, 1000);
11-
image2d<int> out(in.domain());
10+
image2d<int> A(1000, 1000);
11+
image2d<int> B(A.domain());
1212

13-
auto nbh = make_window(in, { {0, -1}, {0, 0}, {0, 1}, });
14-
pixel_wise(in, out) << [] (auto& in, auto& out) {
15-
int sum = 0;
16-
for (auto& n : nbh(in)) sum += n;
17-
out = sum;
13+
auto nbh = make_window(A, { {0, -1}, {0, 0}, {0, 1}, });
14+
pixel_wise(A, B) << [&] (auto& a, auto& b) {
15+
vint3 sum = vint3::Zero();
16+
17+
// Loop over in's neighboords wrt nbh to compute a sum.
18+
for (vuchar3& n : nbh(a)) sum += n.cast<int>();
19+
20+
// Write the sum to the output image.
21+
b = (sum / 3).cast<unsigned char>();
1822
};
1923
```
2024

0 commit comments

Comments
 (0)