我已经能够实现一个基本的本地二进制模式(LBP),而无需插值。以下是代码:(OpenCV)
int center = 0;
int center_lbp = 0;
for (int row = 1; row < Image.rows; row++)
{
for (int col = 1; col < Image.cols; col++)
{
center = Image.at<int>(row, col);
center_lbp = 0;
if ( center <= Image.at<int>(row-1, col-1) )
center_lbp += 1;
if ( center <= Image.at<int>(row-1, col) )
center_lbp += 2;
if ( center <= Image.at<int>(row-1, col+1) )
center_lbp += 4;
if ( center <= Image.at<int>(row, col-1) )
center_lbp += 8;
if ( center <= Image.at<int>(row, col+1) )
center_lbp += 16;
if ( center <= Image.at<int>(row+1, col-1) )
center_lbp += 32;
if ( center <= Image.at<int>(row+1, col) )
center_lbp += 64;
if ( center <= Image.at<int>(row+1, col+1) )
center_lbp += 128;
cout << "center lbp value: " << center_lbp << endl;
LBPImage.at<int>(row, col) = center_lbp;
}
}
读了很多东西...但是现在无法弄清楚如何使用统一模式概念创建直方图...检查了几个链接...那里没什么...有人可以帮忙...
谢谢!