Thanks for this implementation, this and barweb are exactly what I needed. However, I had a minor problem with this function:
line 149-50: color(iColor,:) can cause an error for me since iColor was calculated out to a fractional value. I replaced this with color(j,:), and now the function seems to work correctly.
In the mi_hpv function. It seems like P_A and P_B should both be created with a size of 256. I was testing some small images and would keep getting seg faults since the second to last for loop would write past the bounds of the array when the image height or width is less than 256.
In mexFunction, the following line is unnecessary and caused exceptions when I was debugging in Visual Studio 2008 since there are only 2 input parameters:
pTranslate = (double *)mxGetPr(prhs[2]);
Also, for the problems noted by Yang Shuo above, replace the first line with the code that comes after the comment, and replace the second line with:
Float = imrotate(Ref, 30, 'bilinear', 'crop');