Oriented BRIEF Descriptor
Compute an oriented BRIEF (Binary Robust Independent Elementary Features) descriptor from a binary image patch.
Given a 2D binary patch (grid of 0s and 1s), a list of point pairs for comparison, and a rotation angle , compute a binary descriptor by:
-
Rotate the sampling pattern by angle : For each point pair , rotate both points around the patch center using: where is the patch center.
-
Round rotated coordinates to nearest integer.
-
Compare patch values: for each pair, output 1 if , else 0.
-
If rotated coordinates are out of bounds, treat the value as 0.
Return the binary descriptor as a list of 0s and 1s.
Example
patch = [[0, 1, 0],
[1, 0, 1],
[0, 1, 0]]
pairs = [[0, 1, 1, 0], [1, 2, 2, 1]]
theta = 0.0[0, 0]
- The patch center is calculated as the middle point of the patch, which is since the patch is a grid.
- The rotation angle means no rotation is applied, so the point pairs remain the same: .
- For each pair, we compare the patch values: for the first pair, and , so the output is since ; for the second pair, and , so the output is since .
- The final output is a list of these comparison results: .
Constraints
- patch: 2D list of 0s and 1s (square patch, odd size)
- pairs: List of [r1, c1, r2, c2] tuples
- theta: Rotation angle in radians
- Return: List of 0s and 1s (binary descriptor)
- Use math for cos/sin
- Round rotated coordinates to nearest integer