xref: /OK3568_Linux_fs/external/camera_engine_rkaiq/rkaiq/algos/aorb/orb_algos_opencv.cpp (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 #include "orb_algos_opencv.h"
2 
3 #if OPENCV_SUPPORT
4 int
push_orbpoint_cv(U32 num_points,U16 * points,vector<Point2f> m_Points)5 push_orbpoint_cv(U32 num_points, U16* points, vector<Point2f> m_Points) {
6     Point2f point;
7     m_Points.clear();
8     vector<Point2f>(m_Points).swap(m_Points);
9 
10     for (int i = 0; i < num_points; i++) {
11         point.x = points[i].x;
12         point.y = points[i].y;
13 
14         m_Points.push_back(point);
15     }
16     return 0;
17 }
18 
19 int
get_homography_matrix(vector<Point2f> m_queryPoints,vector<Point2f> m_trainPoints,double * homographyMat,U32 size)20 get_homography_matrix(
21     vector<Point2f> m_queryPoints,
22     vector<Point2f> m_trainPoints,
23     double* homographyMat,
24     U32 size)
25 {
26     double reprojectionThreshold = 10;
27 
28     Mat homography = findHomography(m_queryPoints, m_trainPoints, RANSAC,
29                                     reprojectionThreshold, noArray(), 2000, 0.995);
30     double* data = (double*)homography.data;
31 
32     for (int i = 0; i < size; i++) {
33         homographyMat[i] = data[i];
34         //LOGI_ORB("%s: feature point match ret: %f\n", __FUNCTION__, data[i]);
35     }
36     return 0;
37 }
38 #endif
39