nourani / LBP

C++ implementation of the Local Binary Pattern texture descriptors. This class integrates with OpenCV and FFTW3 to bring a complete and fast implementation of the popular descriptors: LBP u2, ri, riu2 & hf. The routines for calculating these descriptors are inspired by the Matlab code of the original authors.
GNU General Public License v3.0
97 stars 60 forks source link

Having trouble building in Visual Studio 2015 #10

Closed joaoppruivo closed 7 years ago

joaoppruivo commented 7 years ago

Hi there,

firstly, thanks for providing a lib for computing LBP features - there are not that many out there, and I'm still surprised OpenCV doesnt have its own LBP feature extractor.

Still, I'm having trouble building this in Windows via Visual Studio 2015.

After manually solving some dependency problems, I get a "expression must have a constant value" on line 315 of LBP.cpp ( double spoints[samples][2] ) when trying to build. I do know what this means and what a workaround would be (to allocate memory and deallocate after use); however, I'd like to know how you guys got this running without this change. Am I missing something (maybe a very obvious something) ?

Any help would be greatly appreciated.

Cheers!

nourani commented 7 years ago

Hi,

I don't develop on Windows and don't know VS and its compiler. However, the error you are getting is because samples is not a constant and some compilers don't allow you to allocate an array using non-const variables. GCC compilers don't complain about this.

nourani commented 7 years ago

Just came across this: http://stackoverflow.com/questions/20010716/gnu-compilers-vs-visual-studio-on-arrays-allocated-w-length-constant-w-in-a-sc

I guess this tells you why it doesn't work in Visual Studio. If you come up with a fix do let me know. It would be good to have the code function on Windows too

joaoppruivo commented 7 years ago

Hi!

Thanks a lot for the prompt response.

Oh, so thats why I had no trouble building it in Linux...

The only workaround I know of would be manually allocating and deallocating memory for the array. I'll try and do some research, and, if everything fails, I'll try the malloc approach.

Sure! If I'm able to solve it, I'll let you know.

Thanks again!

Cheers,

João Ruivo.

2016-10-19 11:14 GMT-02:00 Navid Nourani-Vatani notifications@github.com:

Just came across this: http://stackoverflow.com/questions/20010716/gnu- compilers-vs-visual-studio-on-arrays-allocated-w-length-constant-w-in-a-sc

I guess this tells you why it doesn't work in Visual Studio. If you come up with a fix do let me know. It would be good to have the code function on Windows too

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nourani/LBP/issues/10#issuecomment-254808575, or mute the thread https://github.com/notifications/unsubscribe-auth/AROCh2adumhzhthZGk_l9dd-EgWk3lSbks5q1he5gaJpZM4Ka8AE .

João Pedro Prospero RuivoEngenharia Mecatrônica - Escola Politécnica da Universidade de São Paulo

nourani commented 7 years ago

Thanks. And good luck ;)

nourani commented 7 years ago

Fixed by the above merge