Forums - fcvSumOfSquaredDiffs36xN8 function and fcvCorrespondences structure

5 posts / 0 new
Last post
fcvSumOfSquaredDiffs36xN8 function and fcvCorrespondences structure
Nagore_Barrena
Join Date: 29 Nov 11
Posts: 6
Posted: Wed, 2012-01-04 02:00

 

Hi all,

I'm working with Fastcv and I need to use fcvSumOfSquaredDiffs36xN8
function and fcvCorrespondences structure, but I have some doubts about
each of them.

The first one is about the third parameter (named b) of the
fcvSumOfSquaredDiffs36xNs8 function. This parameter is defined like

const int8_t*const* b.  b is a double pointer, isn't it?  I defined it

like:
typedef int8_t* pointerDescriptor;
pointerDescritor* b;
b = new pointerDescriptor[numOfPoints];

On the other hand, in the documentation I can read that b must be 128bit
aligned. But, if b is a double pointer, how can I aligned it?

The second doubt is about the fcvCorrespondences structure. In  from

array, I have all the points/corners detected in the training image. In
to array I have all the points/corners detected in the image capture .
And  what I have exactly in indices array?  TO[i] is the
couple of FROM[INDICES[i]]?

Thanks in advance!,
Nagore

 

  • Up0
  • Down0
grk101
Join Date: 26 Oct 11
Posts: 12
Posted: Wed, 2012-01-11 14:32

Hi Nagore, 

Regarding the use of fcvCorrespondences, please take a look this post . It contains information that might help you.

As for aligning  b , you could try this. 

 

typedef *int8_t pointerDescriptor;
 
pointerDescritor* b = (pointerDescriptor*) fcvMemAlloc( numPoints * sizeof( pointerDescriptor ), 16 );

Cheers, 

Guy

  • Up0
  • Down0
Nagore_Barrena
Join Date: 29 Nov 11
Posts: 6
Posted: Fri, 2012-02-03 09:09

Hi,

Thanks for your answer.
I think I am not understanding correctly the meaning of Indices in fcvCorrespondences. I am computing the homography using fcvGeomHomographyFitf32 function and then, I evaluate it using fcvGeomHomographyEvaluatef32 function.
 I am comparing the same image. So, almost  all pair of points are correctly matched. When I use fcvGeomHomographyFitf32 function to compute the homography, using four pair of points (the same points), the homography is very close to the identity matrix. So, I am assuming that it is ok (it must be the identity matrix, when the points that we are comparing are the same). Exactly the computed homography is the following;
0.99778587,     -0.00021059,  0.38002631
0.00004140,     0.99911338    -0.017731888
0.00000321      0.0000003937   1.00
But, when I evaluate this homography using a fcvCorrespondences structure where all found pairs are saved, the function always returns -1 and numInliers is 21. The value of the threslhold is 10, this is very high, so I think the number of inliers must be much more (there are more or less 300 pairs of points found).
I am thinking that I have not understood well the structure of fcvCorresponmdences, exactly the indices variable, and maybe I am filling it incorrectly. I am understanding the following:
fcvCorrespondences structure
TO[i]= FROM[indices[i]];
but i it is not representing the index of TO array, it is representing the point i of array TO. So,
TO[i] is xi= to[(i*2)] ; and yi=TO[(i*2)+1].
And in indices[i] I have the point of FROM which is the pair of TO[i] point. So,
FROM[indices[i]]   x= FROM[(indices[i])*3]; y=FROM[(indices[i]*3)+1] and z=FROM[(indices[i]*3)+2] (z must be always 1.0f)
Am I wrong?
Thanks in advance,
Nagore
  • Up0
  • Down0
Prasun_Choudhury
Join Date: 3 Dec 10
Posts: 15
Posted: Fri, 2012-02-03 15:32

What values you are setting for fromStride and toStride in fcvCorrespondences data structure? Are you setting both the strides to 2 in case of homography? Also, I think your notion of indices[i] is incorrect. In the fcvCorrespondence data struct, to[indices[i]] should correspond to from[indices[i]].

Let me give you a concrete example: say both 'from' and 'to' arrays have 10 points and indices[i] is an array from 0 to 9 with numindices set to 10. In this case, the evaluate function will loop through all the points and then calculate the inliers, square error, etc. Now, lets say we set numindices to 4 and the indices array to {0, 2, 5, 6}. In this case, the evaluate function will only consider the 0th, 2nd, 5th and 6th points while evaluating the homography function to calculate inliers, square errors, etc. Make sure that numindices is same as the size of the indices array in your implementation.

So, if you have N points (both 'from' and 'to' are of size N) and you want to use all the points for the evaluate function, you should set numindices to N-1 and the indices array should contain {0,1,2,3,4,..., N-1}. Can you try this once and see what output you are getting from the evaluate function? 

  • Up0
  • Down0
Nagore_Barrena
Join Date: 29 Nov 11
Posts: 6
Posted: Tue, 2012-02-07 05:06

Hi,

Thanks for your answer again!

I set toStride and fromStride as follows:  toStride=2; fromStride= 3;

Now it works ok! And, I understand the structure of fcvCorrespondences.

Thanks!

Best Regards,

Nagore

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.