Ask Your Question
1

Build OpenCV 3.0 with Visual Studio 2013 ?

asked 2014-09-03 23:07:53 -0500

Fail to build Hi, all:

OS: Windows 8.1 IDE: VS2013 (VC12) OpenCV: 3.0-alpha Cuda: 6.5

I just don't want to use those built libraries already extracted from 3.0-alpha, but I really hope to use the libraries built manually. Therefore, I used CMake 3.0.1 to have everything configured and generate the entire solution for OpenCV 3.0 alpha.

However, when I tried to build the core module, namely, opencv_core, I obtained the following error message:

4>  'ptxas' is not recognized as an internal or external command,
4>  operable program or batch file.
4>  gpu_mat.cu

4>  CMake Error at cuda_compile_generated_gpu_mat.cu.obj.cmake:264 (message):
4>    Error generating file
4>    C:/Packages/computervision/opencv-3.0.0/rebuild/modules/core/CMakeFiles/cuda_compile.dir/src/cuda/Debug/cuda_compile_generated_gpu_mat.cu.obj


4>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(170,5): error MSB6006: "cmd.exe" exited with code 1.

It looks like VS2013 is not able to produce .cu.obj file correctly. Can anybody give me a hand?

Thank you ... Best Regards Pei

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-04-16 20:56:22 -0500

bruceyo gravatar image

updated 2015-04-17 02:38:44 -0500

My error is similar with yours. Later on it will generate many LNK errors. Maybe this is what I can found from the Output window. @StevenPuttemans

8>  CMake Error at cuda_compile_generated_gpu_mat.cu.obj.cmake:206 (message):
8>    Error generating
8>    D:/software/OpenCV/build/modules/core/CMakeFiles/cuda_compile.dir/src/cuda/Debug/cuda_compile_generated_gpu_mat.cu.obj
8>  
8>  
5>  jidctflt.c
8>  Building NVCC (Device) object modules/core/CMakeFiles/cuda_compile.dir/src/cuda/Debug/cuda_compile_generated_gpu_mat.cu.obj
8>CUSTOMBUILD : nvcc warning : The 'compute_11', 'compute_12', 'compute_13', 'sm_11', 'sm_12', and 'sm_13' architectures are deprecated, and may be removed in a future release.
8>  
8>  Failed to run C:\Users\BRUCE_~1\AppData\Local\Temp/tmpxft_00001920_00000000-1.bat (Access is denied.
8>  
8>  
8>  ).
8>  
8>  nvcc fatal   : Could not set up the environment for Microsoft Visual Studio using 'E:/Program Files (x86)/Visual Studio 2013/VC/bin/../../VC/bin/amd64/vcvars64.bat'
8>  
8>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(170,5): error MSB6006: "cmd.exe" exited with code 1.
5>  jidctfst.c
edit flag offensive delete link more

Comments

It seems you did not run this application with administrator rights. It crashes due to not being able to access personal files ...

StevenPuttemans gravatar imageStevenPuttemans ( 2015-04-17 03:19:30 -0500 )edit

I just ran it in administrator mode, it turns out the error below:

Error   655 error : MEXEXT: Unsupported platform.   D:\software\OpenCV\build\modules\core\CUSTOMBUILD   opencv_core

Output:
8>CUSTOMBUILD : error : MEXEXT: Unsupported platform.
8>  
8>  -- Could NOT find Matlab (missing:  MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN) 
8>  -- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file

Cmake config output:
  Matlab:
    mex:                         NO

and there other ImportErrors:
ImportError: No module named 'numpy'

'E:\Program' is not recognized as an internal or external command,
operable program or batch file.
Error: MEXEXT: Unsupported p
bruceyo gravatar imagebruceyo ( 2015-04-17 04:34:28 -0500 )edit

@StevenPuttemans it that the problem of the installed Matlab?

bruceyo gravatar imagebruceyo ( 2015-04-21 03:39:26 -0500 )edit

I am wildly guessing that it is a problem with the mex interface in your system not able to find the python installation. But no idea why both would need eachother.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-04-21 03:44:27 -0500 )edit

Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: No module named 'numpy'

            Found PythonInterp: E:/Program Files (x86)/python34/python.exe (found suitable version "3.4.2", minimum required is "3.4") 

        Traceback (most recent call last):
          File "<string>", line 1, in <module>
        ImportError: No module named 'numpy'

        ERROR: 
        The system was unable to find the specified registry key or value.

It find the python automatically. I uninstalled the Matlab, but turned out the error above. Is that mean errors in cmake will lead to failure of Build in MSVC2013?@StevenPuttemans

bruceyo gravatar imagebruceyo ( 2015-04-21 21:12:26 -0500 )edit
1

I thinks its working now (after installed the Matlab 2014b), build successfully, but still build in the release mode. Thanks!

bruceyo gravatar imagebruceyo ( 2015-04-23 03:32:32 -0500 )edit

Good for you!

StevenPuttemans gravatar imageStevenPuttemans ( 2015-04-23 03:53:57 -0500 )edit

It's really depend on your clues~ Thanks! but found that there is no cuda300.lib and cuda300d.lib... is that part removed from the oprncv-master?

And the .xml haarcascades classifiers still cannot be loaded, which works fine in the 2410 version...

BTW, what is the difference between the GPU version to the normal version? Are they trained in a different way or what else?

bruceyo gravatar imagebruceyo ( 2015-04-23 21:59:58 -0500 )edit
1

CUDA libraries are not prebuilt starting from 2.4.8 since they just took up to much space when they needed to be compiled for each CUDA architecture. If you want cuda support on 3.0 you need to manually built the repository. As to the models, they dont work if you use the prebuilt packages, but the latest 3.0 branch already contains the fix to load them! You can look up the fix history here! The difference between GPU and CPU is that they use a different backend. GPU still uses the old and depricated haar interface, from the old days. Noone has translated the traincascade supported models for GPU yet.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-04-24 02:29:33 -0500 )edit

But my opencv-master version was download on Apr. 14, 2015, which should be after the fixed date. I built it for more than 4 hours... As you said "fixed", is that mean it will be loaded successfully if I use my proper self-trained haarcascade model?

BTW, the SVM on OpenCV3 just worked, but the result is very poor as I only use 62 positive samples and 100 negative samples. Thousands of samples will improve the detection results? I am try to detect a head, not face. Thanks!

bruceyo gravatar imagebruceyo ( 2015-04-24 04:30:37 -0500 )edit
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2014-09-03 23:07:53 -0500

Seen: 3,267 times

Last updated: Apr 17 '15