How to revise CUDA related lib in OpenCV?

Hi
Do anyone ever try to modify cuda code in openCV?
I meet some problem when I build a project based on hog.cpp provided by OpenCV gpu sample. When I add in source files hog.cpp precomp.hpp and precomp.cpp and do some little modification in hog.cpp, error message shows “OpenCV error: No gpu support” when compile precomp.hpp.
The original sample is running in my environment though…

What should I try if I need to build my own project related to both OpenCV and CUDA?
Should I compile with VS or CUDA?
Or anything I forget to set up?

my specs:
Building OpenCv 2.2 (from SVN)
Win7 x32
NPP 32_32_16
Cuda 3.2 sdk&toolkit (x32)
Microsoft Visual Studio 2008

Thanks!

I kind of remove previous error. But new problems pop out.

There are several

“error: no instance of overloaded function “cv::gpu::min” matches the argument list argument types are: (float, float)”

“error: no instance of overloaded function “cv::gpu::max” matches the argument list argument types are: (int,int)” after compile

I list 2 of them. But according to the original openCV hog.cu file the parameters put in the function are correct types.(I only change a bit of the source) Could anyone give me some advice?

I also include following files:

#include “opencv2/gpu/gpu.hpp”

#include “opencv2/gpu/devmem2d.hpp”

#include “opencv2/opencv.hpp”

#include “internal_shared.hpp”

#include “safe_call.hpp”

#include “cuda_runtime.h”

1>------ Rebuild All started: Project: cuda2try, Configuration: Debug Win32 ------

1>Deleting intermediate and output files for project 'cuda2try', configuration 'Debug|Win32'

1>Compiling with CUDA Build Rule...

1>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\bin\nvcc.exe"    -gencode=arch=compute_10,code=\"sm_10,compute_10\" -gencode=arch=compute_20,code=\"sm_20,compute_20\"  --machine 32 -ccbin "C:\Program Files\Microsoft Visual Studio 9.0\VC\bin"    -Xcompiler "/EHsc /W3 /nologo /O2 /Zi   /MT  "  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\include" -maxrregcount=32  --compile -o "Debug/hog2.cu.obj" hog2.cu 

1>hog2.cu

1>/cuda2try/hog2.cu(296): error: no instance of overloaded function "cv::gpu::min" matches the argument list

1>            argument types are: (float, float)

1>          detected during instantiation of "void cv::gpu::hog2::normalize_hists_kernel_many_blocks<nthreads,nblocks>(int, int, float *, float) [with nthreads=32, nblocks=1]" 

1>(325): here

1>cuda2try/hog2.cu(564): error: no instance of overloaded function "cv::gpu::max" matches the argument list

1>            argument types are: (int, int)

1>          detected during instantiation of "void cv::gpu::hog2::compute_gradients_8UC4_kernel<nthreads,correct_gamma>(int, int, cv::gpu::PtrElemStep, float, cv::gpu::PtrElemStepf, cv::gpu::PtrElemStep) [with nthreads=256, correct_gamma=1]" 

1>(654): here

1>12 errors detected in the compilation of "C:/Users/yichu/AppData/Local/Temp/tmpxft_00000a30_00000000-8_hog2.compute_10.cpp1.ii".

1>Project : error PRJ0019: A tool returned an error code from "Compiling with CUDA Build Rule..."

1>Build log was saved at "file://c:\Users\yichu\Documents\Visual Studio 2008\Projects\cuda2try\cuda2try\Debug\BuildLog.htm"

1>cuda2try - 13 error(s), 7 warning(s)

========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========