extractCorners

Extract corners as array of 2D points, from response matrix.

pure nothrow
extractCorners
(
T
)
(
Slice!(Contiguous, [2], T*) cornerResponse
,
int count = -1
,
T threshold = 0
)
if (
isNumeric!T
)
in { assert (!cornerResponse.empty, "Corner response matrix should not be empty."); }

Parameters

cornerResponse
Type: Slice!(Contiguous, [2], T*)

Response matrix, collected as output from corner detection algoritms such as harrisCorners, or shiTomasiCorners.

count
Type: int

Number of corners which need to be extracted. Default is -1 which indicate that all responses with value above the threshold will be returned.

threshold
Type: T

Response threshold - response values in the matrix larger than this are considered as valid corners.

Return Value

Type: auto

Lazy array of size_t[2], as in array of 2D points, of corner reponses which fit the given criteria.

Examples

1 auto image = [0., 0., 0.,
2               0., 1., 0.,
3               0., 0., 0.].sliced(3, 3);
4 
5 auto res = image.extractCorners;
6 
7 assert(res.length == 1);
8 assert(res[0] == [1, 1]);
1 auto image = [0., 0.1, 0.,
2               0., 0.3, 0.,
3               0., 0.2, 0.].sliced(3, 3);
4 
5 auto res = image.extractCorners;
6 
7 assert(res.length == 3);
8 assert(res[0] == [1, 1]);
9 assert(res[1] == [2, 1]);
10 assert(res[2] == [0, 1]);
1 auto image = [0., 0.1, 0.,
2               0., 0.3, 0.,
3               0., 0.2, 0.].sliced(3, 3);
4 
5 auto res = image.extractCorners(1);
6 
7 assert(res.length == 1);
8 assert(res[0] == [1, 1]);
1 auto image = [0., 0.1, 0.,
2               0., 0.3, 0.,
3               0., 0.2, 0.].sliced(3, 3);
4 
5 auto res = image.extractCorners(-1, 0.2);
6 
7 assert(res.length == 1);
8 assert(res[0] == [1, 1]);

Meta