File tree 1 file changed +8
-8
lines changed
1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -108,16 +108,16 @@ mixin template BaseRht()
108
108
// / Run RHT using non-zero points in image as edge points.
109
109
auto opCall (T)(Slice! (2 , T* ) image)
110
110
{
111
- Point[] points;
112
- foreach (y; 0 .. image.length! 0 )
113
- foreach (x; 0 .. image.length! 1 )
111
+ import std.array : appender;
112
+
113
+ auto points = appender! (Point[])();
114
+ assumeSameStructure! (" index" , " value" )(indexSlice(image.length! 0 , image.length! 1 ), image).ndEach! ((p) {
115
+ if (p.value > 0 )
114
116
{
115
- if (image[y, x] > 0 )
116
- {
117
- points ~= Point(cast (int )x, cast (int )y);
118
- }
117
+ points.put(Point(cast (int )p.index[1 ], cast (int )p.index[0 ]));
119
118
}
120
- return this .opCall (image, points);
119
+ });
120
+ return this .opCall (image, points.data);
121
121
}
122
122
123
123
// / Run RHT using prepopullated array of edge points (that may be filtered beforehand).
You can’t perform that action at this time.
0 commit comments