如何将 OpenCV 特征描述符标准化为整数尺度?
OpenCV SURF 实现为图像中找到的每个特征点返回 64/128 32 位浮点值(描述符)的序列。有没有办法标准化这个浮点值并将它们转换为整数范围(例如,[0, 255])?这将节省重要的空间(每个值 1 或 2 个字节,而不是 4 个字节)。此外,转换应确保描述符对其他用途(例如聚类)仍然有意义。
谢谢!
OpenCV SURF implementation returns a sequence of 64/128 32 bit float values (descriptor) for each feature point found in the image. Is there a way to normalize this float values and take them to an integer scale (for example, [0, 255])?. That would save important space (1 or 2 bytes per value, instead of 4). Besides, the conversion should ensure that the descriptors remain meaningful for other uses, such as clustering.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
除了 SURF 之外还有其他特征提取器。 Brief 提取器每个描述符仅使用 32 个字节。它使用 32 个无符号字节 [0-255] 作为其元素。您可以像这样创建一个:
Ptr ptrExtractor = DescriptorExtractor::create("BRIEF");
请注意,OpenCV 中的许多图像处理例程需要或假设数据存储为浮点数。
There are other feature extractors than SURF. The BRIEF extractor uses only 32 bytes per descriptor. It uses 32 unsigned bytes [0-255] as its elements. You can create one like this:
Ptr ptrExtractor = DescriptorExtractor::create("BRIEF");
Be aware that a lot of image processing routines in OpenCV need or assume that the data is stored as floating-point numbers.
您可以将浮动特征视为普通图像(Mat 或 cvmat),然后使用 cv::normalize()。另一种选择是使用 cv::norm() 查找描述符值的范围,然后使用 cv::convertTo() 转换为 CV_8U。查找这些函数的 OpenCV 文档。
You can treat the float features as an ordinary image (Mat or cvmat) and then use cv::normalize(). Another option is using cv::norm() to find the range of descriptor values and then cv::convertTo() to convert to CV_8U. Look up the OpenCV documentation for these functions.
cv::SurfFeatureDetector 返回的描述符已经标准化。您可以通过返回的 cv::Mat 的 L2 Norm 来验证这一点,或者参考论文。
The descriptor returned by cv::SurfFeatureDetector is already normalized. You can verify this by taking the L2 Norm of the cv::Mat returned, or refer to the paper.