Pregunta

I have the following code:

//newImg is a mat of an image and orderedKeyPoint is the result from Fast
cv::FREAK extractor;
cv::Mat queryDescriptors;
extractor.compute(newImg, orderedKeyPoint, queryDescriptors);

I am trying to access individual freak descriptors using queryDescriptors.at< ???>(r,0) where r is an arbitrary valid row value but I am not sure of the type. All documentation states that it is just a descriptor, but is that of type Mat or double or something else? Is this the best way of doing it?

cv::Mat descriptor2 = queryDescriptors.at<cv::Mat>(2,0);

I would like to be able to reconstruct queryDescriptors (Mat of descriptors) from individual descriptors by taking them and putting them in the row values of a cv::Mat, ex:

queryDescriptors.at<cv::Mat>(2,0) = descriptor2;

Any help or insight would be greatly appreciated,

Isaac

¿Fue útil?

Solución

the FREAK descriptor is a uchar Mat with 64 cols and numkeypoints rows.

so, to get to an element of it:

uchar elm = descriptor.at<uchar>(row,col);

where row is the keypoint id, and col is the element id.

Otros consejos

If you have a look into \opencv\modules\features2d\src\freak.cpp you can see:

int FREAK::descriptorSize() const
{
    return FREAK_NB_PAIRS / 8; // descriptor length in bytes
}

int FREAK::descriptorType() const
{
    return CV_8U;
}

int FREAK::defaultNorm() const
{
    return NORM_HAMMING;
}

} // END NAMESPACE CV

So uchar seems to be the type as berak already suggested.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top