# Revision history [back]

### Bug in LBP

Hi,

In the last couple of hours, I worked closely with LBP in OpenCV and compared it with the original implementation in Matlab. There was a slight difference in the results I got, so I looked more closely at the code.

I found the following bug. In the lines:

float x = static_cast<float>(-radius * sin(2.0*CV_PI*n/static_cast<float>(neighbors)));
float y = static_cast<float>(radius * cos(2.0*CV_PI*n/static_cast<float>(neighbors)));


the roles of x and y are flipped. It should be :

float y = static_cast<float>(-radius * sin(2.0*CV_PI*n/static_cast<float>(neighbors)));
float x = static_cast<float>(radius * cos(2.0*CV_PI*n/static_cast<float>(neighbors)));


As in Matlab it's:

spoints(i,1) = -radius*sin((i-1)*a); %y