How to calculate Local Binary Pattern Histograms with OpenCV?

徘徊边缘 提交于 2019-12-28 12:05:00

问题


I have already seen that OpenCV provides a classifier based on LBP histograms:

But I want to have access to the LBP histogram itself. For instance:

histogram = calculate_LBP_Histogram( image )

Is there any function that performs this in OpenCV?


回答1:


You can get the C++ code for computing LBP using OpenCV's Mat data structure here:

http://www.bytefish.de/blog/local_binary_patterns

You should be able to find the Python version as well on the same site.

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.

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).



来源:https://stackoverflow.com/questions/13733448/how-to-calculate-local-binary-pattern-histograms-with-opencv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!