问题描述
我已经看到OpenCV提供了基于LBP的分类器:
I have already seen that OpenCV provides a classifier based on LBP histograms:
但是我想访问LBP直方图本身.例如:
But I want to have access to the LBP histogram itself. For instance:
histogram = calculate_LBP_Histogram( image )
在OpenCV中有执行此功能的功能吗?
Is there any function that performs this in OpenCV?
推荐答案
您可以在此处获得使用OpenCV的Mat数据结构来计算LBP的C ++代码:
You can get the C++ code for computing LBP using OpenCV's Mat data structure here:
http://www.bytefish.de/blog/local_binary_patterns
您应该也可以在同一站点上找到Python版本.
You should be able to find the Python version as well on the same site.
该代码是由Philipp Wagner编写的,我相信他曾将您提到的人脸识别代码贡献给OpenCV,所以应该是同一回事.
The code is written by Philipp Wagner, who I believe contributed the face recognition code you mentioned to OpenCV, so it should be the same thing.
在文件OpenCV-2.4.2/modules/contrib/src/facerec.cpp中找到LBP代码作为静态函数.不幸的是,它似乎没有公开供公众使用(至少对于OpenCV 2.4.2).
The LBP code is found in the file: OpenCV-2.4.2/modules/contrib/src/facerec.cpp as a static function. Unfortunately, it does not appear to be exposed for public use (at least for OpenCV 2.4.2).
这篇关于如何使用OpenCV计算局部二值模式直方图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!