# Forums - Using fcvGeomHomographyRobustFitf32 to fit a best homography???

2 posts / 0 new
Using fcvGeomHomographyRobustFitf32 to fit a best homography???
lg.victor
Join Date: 1 May 15
Posts: 2
Posted: Mon, 2015-05-18 04:27

Hello, I get confused problem about using fcvGeomHomographyRobustFitf32 to fit a best homography on android phone.

Here post code:

// first : prepare correspond

for(int ki=0;ki<ccnt;ki++)
{
m_homography_objC[3*ki] = (float32_t)matched_corners_obj[2*ki];
m_homography_objC[3*ki+1] = (float32_t)matched_corners_obj[2*ki+1];
m_homography_objC[3*ki+2] = 1.0;

state.m_homography_sceC[2*ki] = (float32_t)state.matched_corners_sce[2*ki];
state.m_homography_sceC[2*ki+1] = (float32_t)state.matched_corners_sce[2*ki+1];
}
corrs.from = m_homography_objC;
corrs.fromStride=3;
corrs.numIndices = ccnt;                                                   // ??? Am I right : numIndices == ccnt
corrs.indices = (uint16_t*)m_homography_indice;   // ??? Am I right : this is a idx = [0,1,2,3... ccnt-1]
corrs.numCorrespondences = ccnt;
corrs.to = (float32_t*)m_homography_sceC;
corrs.toStride=2;
float matrix[9];

fcvStatus cc = fcvGeomHomographyRobustFitf32 (&corrs, matrix,3);
if(cc == FASTCV_SUCCESS)
{
DPRINTF( "homography %f,%f,%f",matrix[0],matrix[1],matrix[2]);
DPRINTF( "homography %f,%f,%f",matrix[3],matrix[4],matrix[5]);
DPRINTF( "homography %f,%f,%f",matrix[6],matrix[7],matrix[8]);
DPRINTF( "homography ################################################");
}

jeff4s Moderator
Join Date: 4 Nov 12
Posts: 106
Posted: Sat, 2015-05-23 18:18

Hi,

To use this API fcvGeomHomographyRobustFitf32 you should set:

corrs.fromStride=2;

and comment out the following (no padding of from correspondence)

//  m_homography_objC[3*ki+2] = 1.0;