pdollar / toolbox

Piotr's Image & Video Matlab Toolbox
849 stars 500 forks source link

rgbConvertMex change the 3rd dimesion from 3 to 48512332255694123 values #29

Open HamzaKhribi opened 7 years ago

HamzaKhribi commented 7 years ago

i'm having this error:

Error using convConst A must be a 4x4 or bigger 2D or 3D float array.

while debugging the code i found out that I=160903 after calling rgbConvertMex become 160901277669775489321 and this is why Convcost show me this error. how can i fix this error please

DavidSongGitHub commented 7 years ago

I got this error either.

ChongYunPeng commented 6 years ago

Same here.

jmbuena commented 6 years ago

This problem is in recent version of Matlab. I managed to fix a similar problem but I don't remember the details. Is something related to the size of integers and matrix dimensions in the mex. The problem is in the types used (int instead of mwSize matlab defined type).

jmbuena commented 6 years ago

Finally found the change I did:

171,172c171
<   const mwSize *dims; int nDims, n, d; void *I; void *J; int flag;
<   mwSize dims1[3];
---
>   const int *dims; int nDims, n, d, dims1[3]; void *I; void *J; int flag;
178c177
<   dims = (const mwSize*) mxGetDimensions(pr[0]); n=dims[0]*dims[1];
---
>   dims = (const int*) mxGetDimensions(pr[0]); n=dims[0]*dims[1];

Yo have to change other C/C++ files with the same idea. In my linux 64 bits the int is no longer valid in Matlab 2017b to represent a Matlab matrix and it should be changed by mwSize in several mex files in the toolbox.

jmbuena commented 6 years ago

You can find the changes I did in order to fix this issue to my own version of the toolbox here (a lot of .cpp files need to be changed):

https://github.com/jmbuena/toolbox.badacost.public

In this version we have added the detection with our BAdaCost algorithm (Cost-sensitive multi-class Boosting) from our Pattern Recognition 2018 paper.

Hope it will be useful.

yakiro-nvg commented 6 years ago

Thanks, jmbuena

PR without BAdaCost #38