ORB¶
| Fact | Value |
|---|---|
| Also called | ORB-inspired binary features, Oriented FAST and rotated BRIEF |
| Status | Implemented and tested |
| Family | Texture, corners, blobs and features |
| Engine | Science engine |
| Type | Nonlinear, spatial, oriented FAST corners on a pyramid |
| Output | Features |
| Operator shown as | algorithm (simplified) |
| Support radius | global |
| Code | engine/src/pixelnexus_engine/filters/keypoints.py, orb |
| Operator code | engine/src/pixelnexus_engine/filters/keypoints.py, keypoint_representation |
| Packages | OpenCV |
Overview¶
ORB finds corners fast. It looks for FAST corners on each level of an image pyramid and ranks them by the Harris measure. It keeps the strongest and gives each one an orientation from its intensity centroid. The keypoints go to the Features panel and are drawn on the canvas. Only the detector runs, not the binary descriptor. The filter runs in the PixelNexus engine, with OpenCV.
How it works¶
- Build an image pyramid with the scale factor.
- Find FAST corners on each level.
- Rank them by the Harris measure and keep the strongest.
- Give each one the direction of its intensity centroid.
Mathematical foundation¶
The formula shows the default parameter values.
where
- \(t\): The FAST threshold
- \(m_{pq}\): The moments of the brightness in the patch, the sum of x^p y^q I
- \(M\): The structure tensor of the Harris measure
- \(x, y\): The keypoint position, with the center of the top-left pixel at 0, 0
- \(\theta\): The orientation, counterclockwise from the x axis
ORB looks for FAST corners on each level of an image pyramid. A pixel is a FAST corner when 9 pixels in a row on the circle of 16 around it differ from it by more than the threshold. They must be all brighter or all darker. Corners are ranked by the Harris measure det M - 0.04 tr(M)^2 of a 7 x 7 window. The strongest over all levels are kept. The orientation comes from the intensity centroid. The moments m_10 and m_01 of the brightness in a disk 31 pixels wide around the corner point toward its brighter side.
FAST is a fast corner test. Around a pixel p, it looks at the circle of 16 pixels at radius 3. If 9 of them in a row are all brighter than p by more than the threshold, or all darker, p is a corner. OpenCV keeps only corners that are stronger than their neighbors.
FAST responds to edges too. So ORB ranks the corners by the Harris measure det M - 0.04 tr(M)^2, with the structure tensor M of a 7 x 7 window. The strongest over all pyramid levels are kept. The orientation comes from the intensity centroid. The moments m_10 and m_01 of the brightness in a disk 31 pixels wide point from the corner toward its brighter side. The angle of that vector is the orientation.
Kernel or operator¶
The Inspector asks the engine for the stages with the current settings. They start with the 8-bit luma and follow the detector step by step. They summarize what OpenCV does, so the label is Simplified.
Parameters¶
| Parameter | Default | Values | Meaning |
|---|---|---|---|
Most keypoints maxFeatures |
500 | 10 to 5000 | Keep at most this many keypoints, the strongest over all levels. OpenCV uses 500. |
Scale factor scaleFactor |
1.2 | 1.05 to 2 | The image shrinks by this factor from one pyramid level to the next. OpenCV uses 1.2. |
Pyramid levels levels |
8 | 1 to 16 | The number of pyramid levels. OpenCV uses 8. |
FAST threshold fastThreshold |
20 | 1 to 100 | How much brighter or darker the circle must be than the center, in levels. OpenCV uses 20. |
Ranking scoreType |
Harris measure | Harris measure, FAST score | How corners are ranked before the strongest are kept. OpenCV uses the Harris measure. |
Implementation¶
orb in engine/src/pixelnexus_engine/filters/keypoints.py calls cv2.ORB_create with the catalog values, a border and patch size of 31, and detect on the 8-bit luma. The table has x, y, the radius, the angle, the score and the pyramid level as the octave.
OpenCV puts the center of the top-left pixel at 0, 0, as the feature tables do, so positions keep their fraction. OpenCV measures angles clockwise in image coordinates, where y points down. The table turns them to count counterclockwise from the x axis, as (360 - angle) mod 360. The rows are sorted by score. With a selection, the detector still looks at the whole image, and only the keypoints on selected pixels are kept.
Worked example¶
| Image | Keypoints | Radius (px) | Found after a quarter turn (%) |
|---|---|---|---|
| Siemens star | 428 | 15.5 to 55.5 | 69 |
| Disks | 355 | 15.5 to 55.5 | 67 |
ORB with the defaults on the 512 x 512 test images. The last column is the share of keypoints found again after the image is turned a quarter counterclockwise: within 1 pixel of the turned place, with a radius within 10 percent, and with an angle 90 degrees larger, within 5 degrees. A quarter turn moves pixels exactly onto pixels, so any loss comes from the detector itself.
Complexity¶
- Time: \(O(N)\)
- Memory: \(O(N)\)
N is the number of pixels. The pyramid levels together cost a few times the first level.
Artifacts and limitations¶
Limitations
- Finds corners only, not blobs.
- Keypoints near the image border are missing, since the patch must fit.
- Only the detector runs. The binary descriptors are not computed.
Artifacts
- Keypoints on smooth curved edges, which have no true corner. On the Disks image, about 9 in 10 lie within 3 pixels of a disk edge.
Tests¶
The table must hold what cv2.ORB_create finds, with the angle turned to count counterclockwise, sorted by score. On the Disks image, the FAST threshold of 20 must give 355 keypoints and a threshold of 5 must give 443. A flat image must give no keypoints, and runs must repeat exactly. The engine API tests check the JSON and the stages.
References¶
- Rublee, E., Rabaud, V., Konolige, K., and Bradski, G. ORB. An efficient alternative to SIFT or SURF. IEEE International Conference on Computer Vision, 2564 to 2571, 2011. DOI 10.1109/ICCV.2011.6126544.
- OpenCV documentation, cv2.ORB_create and detect.