1 #ifndef __ORB_H__ 2 #define __ORB_H__ 3 4 #include <stdlib.h> 5 #include <stdio.h> 6 #include <string.h> 7 #include <math.h> 8 9 #define MAX_POINTS 40000 10 11 #define FAST_CANDIDATE 16 // fast9 use surrounding 16 points 12 #define MAX_CONSECUTIVE 9 13 #define PATCH_SIZE 15 14 #define HALF_PATCH_SIZE (PATCH_SIZE >> 1) 15 #define DESCRIPTOR_SIZE 15 16 17 #define DARKER 1 18 #define SIMILAR 2 19 #define BRIGHTER 3 20 #define ROUND(x) (int)(((x) >= 0)?((x) + 0.5) : ((x) - 0.5)) 21 22 class rkisp_orb 23 { 24 public: 25 unsigned char fast9_limit; 26 unsigned char cur_limit; 27 int feature_size; 28 int feature_capacity; 29 int non_max_sup_radius; 30 31 unsigned char* imgSrc; 32 int width; 33 int height; 34 int data_bits; 35 unsigned short* pXs; 36 unsigned short* pYs; 37 unsigned char* pDescriptors; 38 unsigned char* pScores; 39 public: 40 int process(); 41 int fast9_detect(); 42 int compare_pixel(unsigned char center, unsigned char* compare, unsigned char* candidate); 43 int find_9consecutive_pixel(unsigned char* compare); 44 int non_max_suppress(); 45 int orb_feature(); 46 int get_rotation_value(unsigned char* center_ptr, int* cur_point_pattern, int idx, int cos_value, int sin_value); 47 }; 48 49 50 #endif 51