Hi,
I want to match 2 images and need some help. I already extracted the features (with fcvCornerFast9u8) and their descriptors (with fcvDescriptor17x17u8To36s8) for both images and stored them in 2 fcvFeatureType arrays.
Now I want to match these features. As a first step, I just want to implement a bruteforce algorithm for matching. So each descriptor in one image is compared to all descriptors in the second image, the two descriptors with shortest distance will be my match for the feature. I think the function fcvSumOfSquaredDiffs36xNs8 would do the comparision for me, but I don't know how to set invLenA and invLenB. What is meant with "Inverse of vector A"? I set it to 1/sqrt(normSq) but me results seam to be wrong. Do I need something else for the matching or am I completly wrong with my approach?
Hi Katrin,
Your approach sounds correct.
invLenA is the inverse of the L2 norm of A and invLenB is an array containing the inverse L2 Norms for each vector in B.
Note that fcvDescriptor17x17u8To36s8 only returns the squared norm and not the length of the descriptor vector.
Hope that helps.
Cheers,
Guy
Hi Katrin
Yes that's correct. The inverse of L2 norm is 1/sqrt(sum(X1*X1,X2*X2,...Xn*Xn)) when X1...Xn are the components of the descriptor.
As you have said, since you already have the squared norm, all you have to compute is 1/sqrt(squaredNorm).
Cheers
Guy
Thanks for the help so far!
I'm still struggling with the method fcvSumOfSquaredDiffs36xNs8, especially with the parameter b. How do I correctly fill the int8_t** variable b? I have my descriptors stored in an array of fcvFeatureType, so my approach is to iterate over the feature array and copy the descriptors to the variable.
My current approach, which is not working, looks like this:
//allocating memory for parameter b - number of descriptors * size of descriptor
int8_t** descriptorsB = (int8_t**)fcvMemAlloc(numDescriptors*36, 16);
int8_t *destination = *descriptorsB;
for(uint32_t i = 0; i < numDescriptors; i++){
memcpy(destination, featureArray[i].descriptor, 36); //here the code crashes - already in the first iteration
destination += 36;
}
I'm not really used to pointer arithmetics, so I'm probably messing things up. How can I do it right?
You probably want to do something like:
Double post, please delete me!