简体   繁体   English

如何计算图像末端的lbp码?

[英]How to calculate the lbp codes at the ends of the images?

For example, the lbp code of the pixel with coordinate (1, 1) is possible to calculate it with the pixels (0, 0); 例如,坐标为(1,1)的像素的lbp代码可以用像素(0,0)进行计算; (0, 1); (0,1); (0, 2); (0,2); (1, 2); (1,2); (2, 2); (2,2); (2, 1); (2,1); (2, 0); (2,0); (1, 0) but the pixels of the extremes do not have those 8 neighborhood pixels, that is, the pixel (0, 0) only has 3 neighbors. (1,0),但极值像素不具有这8个邻域像素,即,像素(0,0)仅具有3个邻居。

This question comes to me because I have obtained the LBP image using sicikit image, the code is as follows: 因为我已经使用sicikit映像获得了LBP映像,所以出现了这个问题,代码如下:

lbp = feature.local_binary_pattern (gray, 8, 1, 'ror')

Then I printed the values ​​of the gray image and got these values: 然后我打印了灰色图像的值并得到了这些值:

[[185 185 190 ... 176 172 178]]
 [183 180 181 ... 194 185 175]
 [203 199 199 ... 201 193 179]
 ...
 [205 188 182 ... 183 183 182]
 [207 197 194 ... 193 190 186]
 [206 201 201 ... 201 199 197]]

I also printed the values ​​of the LBP image and got these values: 我还打印了LBP图像的值并得到了这些值:

[[  1.  17.   1. ...  15.  31.   1.]
 [ 27. 255. 127. ...   7.   7.  31.]
 [  0.  31.  31. ...   1.  31.  15.]
 ...
 [ 17.  31.  63. ...  63. 111.  31.]
 [  0.  31.  31. ...  15.  15.   7.]
 [  1.  25.  17. ...   0.   1.   1.]]

I understand that, for example, the lbp code of the pixels on the top right is correct since it provides a value of 7 but I do not understand how the LBP codes of the extremes are obtained. 我知道,例如,右上角像素的lbp码是正确的,因为它提供的值为7,但我不明白如何获得极限值的LBP码。 Thanks. 谢谢。

The function skimage.feature.local_binary_pattern performs zero padding under the hood. 函数skimage.feature.local_binary_patternskimage.feature.local_binary_pattern执行零填充。 As a consequence of it the LBP codes are actually computed from the padded image: 结果,实际上是从填充图像中计算出LBP代码:

[[  0   0   0   0 ...   0   0   0   0]
 [  0 185 185 190 ... 176 172 178   0]
 [  0 183 180 181 ... 194 185 175   0]
 [  0 203 199 199 ... 201 193 179   0]
 ...
 [  0 205 188 182 ... 183 183 182   0]
 [  0 207 197 194 ... 193 190 186   0]
 [  0 206 201 201 ... 201 199 197   0]
 [  0   0   0   0 ...   0   0   0   0]]

When you use the 'ror' method on the image above, the LBP corresponding to the top left most pixel is: 在上图上使用'ror'方法时,与最左上角像素相对应的LBP为:

 0   0   0           0 0 0
 0  185 185    >>    0   1    >>    00000001    >>    1
 0  183 180          0 0 0  

The LBP corresponding to the second pixel on the first row turns out to be: 对应于第一行第二个像素的LBP变为:

 0   0   0           0 0 0
185 185 190    >>    1   1    >>    00010001    >>    17
183 180 181          0 0 0  

The LBP corresponding to the top right most pixel is: 与最右上角像素相对应的LBP为:

 0    0   0          0 0 0
172  178  0    >>    0   0    >>    000000001    >>    1
185  175  0          1 0 0  

... and so on. ... 等等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM