unset(CUDA_npp_LIBRARY CACHE)
find_cuda_helper_libs(npp)
- macro(OCV_CUDA_COMPILE VAR)
+ macro(ocv_cuda_compile VAR)
+ foreach(var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
+ set(${var}_backup_in_cuda_compile_ "${${var}}")
+
+ # we reomove /EHa as it leasd warnings under windows
+ string(REPLACE "/EHa" "" ${var} "${${var}}")
+
+ # we remove -ggdb3 flag as it leads to preprocessor errors when compiling CUDA files (CUDA 4.1)
+ string(REPLACE "-ggdb3" "" ${var} "${${var}}")
+ endforeach()
+
if (BUILD_SHARED_LIBS)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -DCVAPI_EXPORTS)
endif()
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wunused-but-set-variable)
endif()
- # we remove -ggdb3 flag as it leads to preprocessor errors when compiling CUDA files (CUDA 4.1)
- set(CMAKE_CXX_FLAGS_DEBUG_ ${CMAKE_CXX_FLAGS_DEBUG})
- string(REPLACE "-ggdb3" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
- CUDA_COMPILE(${VAR} ${ARGN})
- set(CMAKE_CXX_DEBUG_FLAGS ${CMAKE_CXX_FLAGS_DEBUG_})
+ CUDA_COMPILE(${VAR} ${ARGN})
+
+ foreach(var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
+ set(${var} "${${var}_backup_in_cuda_compile_}")
+ unset(${var}_backup_in_cuda_compile_)
+ endforeach()
endmacro()
else()
unset(CUDA_ARCH_BIN CACHE)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler /wd4251)
endif()
endif()
-
+
ocv_cuda_compile(cuda_objs ${lib_cuda} ${ncv_cuda})
+
#CUDA_BUILD_CLEAN_TARGET()
set(cuda_link_libs ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
unsigned char* source = (unsigned char*)image.data;
int width = image.cols;
int height = image.rows;
+ int step1 = (int)image.step1();
for (int j = 0; j < image.rows; ++j)
for (int i = 0; i < image.cols; ++i)
while (top >= stack)
{
int* dl = &dist_labels[p.y * pitch + p.x];
- unsigned char* sp = &source[p.y * image.step1() + p.x];
+ unsigned char* sp = &source[p.y * step1 + p.x];
dl[0] = cc;
*top++ = dot::make(p.x - 1, p.y);
//bottom
- if( p.y < (height - 1) && dl[+pitch] == -1 && inInt(sp[0], sp[+image.step1()]))
+ if( p.y < (height - 1) && dl[+pitch] == -1 && inInt(sp[0], sp[+step1]))
*top++ = dot::make(p.x, p.y + 1);
//top
- if( p.y > 0 && dl[-pitch] == -1 && inInt(sp[0], sp[-image.step1()]))
+ if( p.y > 0 && dl[-pitch] == -1 && inInt(sp[0], sp[-step1]))
*top++ = dot::make(p.x, p.y - 1);
p = *--top;
map1.at<Vec2f>(j, i)[1] = (float)j;
break;
case CV_16SC2:
- map1.at<Vec2s>(j, i)[0] = (float)(src.cols - i);
- map1.at<Vec2s>(j, i)[1] = (float)j;
+ map1.at<Vec2s>(j, i)[0] = (short)(src.cols - i);
+ map1.at<Vec2s>(j, i)[1] = (short)j;
break;
default:
CV_Assert(0);