I want to be able to calculate the LBP discriptor in python using OpenCV. According to this I need to compile openCV again.
I changed the elbp() functio
This is actually the same problem, if not the same question, as how to call a dll in python - But you can use either ctypes or swig however since there is already a python interface into OpenCV your best bet is to take a look to see how the existing one is done.
It may also be worth taking a look at pyopencv which provides a Boost based interface.
To see how the current system does things take a look at CMakeLists.txt in opencv/modules/python and you will find that a number of generated headers are created by opencv/modules/python/src2/gen2.py - you will need to spend some time looking at these two files.