kyamagu / mexopencv

Collection and a development kit of matlab mex functions for OpenCV library
http://kyamagu.github.io/mexopencv
Other
660 stars 319 forks source link

cv function error in Paperdoll. #275

Closed weitianhan closed 8 years ago

weitianhan commented 8 years ago

Hi guys,

I am trying to run the paperdoll example in http://vision.is.tohoku.ac.jp/~kyamagu/research/paperdoll/. But I get error when trying to run the feature calculator by

result = feature_calculator.apply(config, input_sample)

Matlab reports the following error:

Error:feature_calculator: 1 / 1
Error using cv.warpAffine
Attempt to execute SCRIPT warpAffine as a function:
/home/vip2/tianhan/paperdoll-v1.0/lib/mexopencv/+cv/warpAffine.m

Error in normal_pose_calculator.apply>normalize_image (line 79)
  normalized_image = cv.warpAffine(im, transform, ...

Error in normal_pose_calculator.apply (line 44)
    [normal_image, transform] = normalize_image(image_data, ...

Error in feature_calculator.apply (line 25)
        sample = calculators{j}(config{j}, sample, varargin{:}, 'Encode', false);

Any idea? Is it because the '+' sign in the path? I am using Matlab R2014b on Ubuntu 14.04.

kyamagu commented 8 years ago

@weitianhan You are failing to compile the old version of mexopencv. See this and this.

weitianhan commented 8 years ago

Hi @kyamagu,

Thanks for your reply. Yes maybe you are right. I find this when I try to run make.

/usr/local/MATLAB/R2014b/bin/mex -cxx -largeArrayDims -Iinclude -I/usr/local/include/opencv -I/usr/local/include   src/+cv/adaptiveThreshold.cpp -lMxArray -Llib -L/usr/local/lib -L/usr/local/cuda/lib64 -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_ocl -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab -lcufft -lnpps -lnppi -lnppc -lcudart -lrt -lpthread -lm -ldl   -o +cv/adaptiveThreshold.mexa64
**Unknown MEX argument '-o'.**
make: *** [+cv/adaptiveThreshold.mexa64] Error 255
make: Nothing to be done for `all'.

Actually I have changed several -o to -output for compiling the project due to the MATLAB version problem. But I can not find where to locate this -o, would you please give some hints? Thanks!

amroamroamro commented 8 years ago

@weitianhan The -o vs -output issue was fixed in this commit: 26f41b40

amroamroamro commented 8 years ago

@weitianhan As far as I can tell, the mexopencv dependency is minimally used in paperdoll, with only three functions being called: cv.warpAffine, cv.distanceTransform, and cv.line. Since there were no significant changes to those functions, you can simply swap the version of mexopencv included against the latest one (either 2.4 or the master branch, just make sure you have a matching OpenCV version), that way you get all the fixes made to the build scripts since then...

So download the newest mexopencv and replace the paperdoll-v1.0\lib\mexopencv subfolder with the new one. Then in the paperdoll-v1.0\make.m file, change the line cv.make() into mexopencv.make().

Finally follow the instructions in the readme file to build paperdoll. Note that I haven't tried this myself, I just had a quick look at the sources.

weitianhan commented 8 years ago

@kyamagu @amroamroamro , Thanks for your help. I think I don't get error in make.m now. But I am still suffering from another error when I run the program by result = feature_calculator.apply(config, input_sample).

Attempt to execute SCRIPT vl_imsmooth as a function:
/home/vip2/tianhan/paperdoll-v1.0/lib/vlfeat-0.9.16/toolbox/imop/vl_imsmooth.m

How can I fix this problem?

kyamagu commented 8 years ago

@weitianhan This is another compile error that VLFeat v0.9.16 is failing, though not relevant to mexopencv. I will close the issue as mexopencv error is fixed now.

You should be able to fix by replacing VLFeat to the latest version. But keep in mind that if you want to use the old code in a newer platform you will see this type of error always happens, and you will need to debug them by yourself most of the time...

kyamagu commented 8 years ago

@weitianhan I decided to host the paper doll project on github. It should work on Ubuntu 14.04.

https://github.com/kyamagu/paperdoll

The parser is not the state-of-the-art anymore, and the repository is for archival purpose.

weitianhan commented 8 years ago

@kyamagu , thanks for your contribution.