Ask Your Question

why local binary pattern change size of image?

asked 2013-08-13 03:57:52 -0500

bkshn gravatar image

updated 2013-08-13 03:58:42 -0500

i use local binary pattern on an image in size 680-1024, but the calculated LBP image is in the size of 678-1022. I want to use LBP image in another program but because of this modified size , it return an error. Could you help me why size of image is changed?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-08-13 04:10:04 -0500

This is actually normal. LBP calculate a value for each pixel based on the LBP theory, which is based on the surrounding pixel values, 1 pixel layer around the investigated pixel. Since however edge pixels do not have neighbours outside of the image scope, the LBP value isn't calculated. This means that you loose 1 row of pixels on top and bottom, and 1 column of pixels at right and left side. Hope this makes it more clear.

So it all depends on how you define your LBP region for calculation.

edit flag offensive delete link more



You can circumvent the problem by making your image one-pixel larger before computing the LBP-image using copyMakeBorder, e.g. : cv::copyMakeBorder(_img, img, 1, 1, 1, 1, cv::BORDER_REPLICATE);

Guanta gravatar imageGuanta ( 2013-08-13 05:04:20 -0500 )edit

Actually that is true, but don't you create 'wrong' pixels then? I guess for LBP this isn't that bad however ...

StevenPuttemans gravatar imageStevenPuttemans ( 2013-08-13 05:16:04 -0500 )edit

Yes, you'll get some LBP-patterns which are not that distinctive, but they would still contain some information from the non-wrapped side (maybe BOARDER_WRAP would thus be better). In general, I would just take the smaller image - just wanted to give @bkshn a possible solution to his problem.

Guanta gravatar imageGuanta ( 2013-08-13 07:09:30 -0500 )edit

Question Tools

1 follower


Asked: 2013-08-13 03:57:52 -0500

Seen: 98 times

Last updated: Aug 13 '13