Hi, I have seen that there is a function cv::DescriptorExtractor::descriptorType
the is returning an int
. Is it the same as CV_8U, CV_32F, etc?
Is it ok to use it for creating a cv::Mat
for some descriptors stored in a file (that was not saved with cv::FileStorage
), so I can do :
cv::Mat descriptors(numOfDescriptors, extractorPtr->descriptorSize(), extractorPtr->descriptorType());
for (std::size_t i = 0; i < numOfDescriptors; i++)
{
for (std::size_t j = 0; j < descriptorValues.size(); j++) // where descriptorValues is a vector of string
{
switch (extractorPtr->descriptorType())
{
case CV_8U:
descriptors.ptr< uchar >(i)[j] = std::strtoi(descriptorValues[j]);
break;
case CV_32F:
descriptors.ptr< float >(i)[j] = std::strtof(descriptorValues[j]);
break;
default:
std::cerr << "Wrong descriptor type" << std::endl;
break;
}
}