Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LBP unit test seems produce incorrect result #34

Open
Adam-Yao opened this issue Nov 26, 2013 · 2 comments
Open

LBP unit test seems produce incorrect result #34

Adam-Yao opened this issue Nov 26, 2013 · 2 comments

Comments

@Adam-Yao
Copy link

Hi Sir,
I downloaded the VLFEAT 0.9.17 package and wanted to learn LBP algorithem. I found there is a Matlab LBP test program in "vlfeat-0.9.17.tar\vlfeat-0.9.17\vlfeat-0.9.17\toolbox\xtest\vl_test_lbp.m". But the test result seems not correct.
In function "test_one_on"
function test_one_on()
I = {} ;
I{1} = [0 0 0 ; 0 0 1 ; 0 0 0] ;
I{2} = [0 0 0 ; 0 0 0 ; 0 0 1] ;
I{3} = [0 0 0 ; 0 0 0 ; 0 1 0] ;
I{4} = [0 0 0 ; 0 0 0 ; 1 0 0] ;
I{5} = [0 0 0 ; 1 0 0 ; 0 0 0] ;
I{6} = [1 0 0 ; 0 0 0 ; 0 0 0] ;
I{7} = [0 1 0 ; 0 0 0 ; 0 0 0] ;
I{8} = [0 0 1 ; 0 0 0 ; 0 0 0] ;

for j=0:7
h = vl_lbp(single(I{j+1}), 3) ;
h = find(squeeze(h))
vl_assert_equal(h, j * 7 + 1) ;
end

I found in vllbp.c, this LBP object is created with transposed feature. For input array [0 0 0 ; 0 0 1 ; 0 0 0] , it assume the LBP value equal to 1. Abviously, the LBP value before quantizaiton is 00000001b, if the matrix is transposed, the LBP value before quantization is 00000100. The LBP value after quantizaiton is 14 which is not consistent with your result.
Could you check it?

Thank you,.
Adam

@vedaldi
Copy link
Contributor

vedaldi commented Jan 8, 2014

Dear Adam,

thank you your message.

I checked the code and test file and they seem correct to me. Please note that the transposed feature is turned on because MATLAB stores images in column major format, whereas VLFeat expects them in row major. Hence to VLFeat the MATLAB image looks transposed.

Best.,

Andrea

@Adam-Yao
Copy link
Author

Adam-Yao commented Jan 9, 2014

Hi Andrea,
Thanks a lot for your clear explanation. It is the Matlab array transfer principle which cause my confusion.
It is clear now.

Best regards,
Adam

From: Andrea Vedaldi [mailto:notifications@github.com]
Sent: Thursday, January 09, 2014 3:10 AM
To: vlfeat/vlfeat
Cc: Yao, Adam
Subject: Re: [vlfeat] LBP unit test seems produce incorrect result (#34)

Dear Adam,

thank you your message.

I checked the code and test file and they seem correct to me. Please note that the transposed feature is turned on because MATLAB stores images in column major format, whereas VLFeat expects them in row major. Hence to VLFeat the MATLAB image looks transposed.

Best.,

Andrea


Reply to this email directly or view it on GitHubhttps://github.com//issues/34#issuecomment-31866945.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants