This section provides you with a very basic implementation of the LBP operator that we just described. The function LBP()
takes two arguments-the source image and the output image. The output image is a Mat object that stores the corresponding LBP code for each pixel in the input image. We could have made the function return the output Mat object, but such a design (where both the input and the output are passed as arguments to the function) is also possible:
void LBP(const Mat& src, Mat& dst) { dst = Mat::zeros(src.rows-2, src.cols-2, CV_8UC1); for(int i=1;i<src.rows-1;i++) { for(int j=1;j<src.cols-1;j++) { uchar center = src.at<_Tp>(i,j); unsigned char code = 0; code |= (src.at<uchar>(i-1,j-1) > center) << 7; code |= (src.at<uchar>(i-1,j) > center) << 6; code |= (src.at<uchar>(i-1...