mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 11:10:21 +08:00
fix CUDA build
CUDA implementation wants to convert std::vector<KeyPoint> <-> GpuMat. There is no direct mapping from KeyPoint (mix of int/float fields) into cv::Mat element type, so this conversion must be avoided. Legacy mode is turned back for CUDA builds.
This commit is contained in:
parent
0451629e22
commit
164a41b399
@ -940,6 +940,12 @@ function(ocv_target_link_libraries target)
|
|||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
function(ocv_target_compile_definitions target)
|
||||||
|
_ocv_fix_target(target)
|
||||||
|
target_compile_definitions(${target} ${ARGN})
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
function(_ocv_append_target_includes target)
|
function(_ocv_append_target_includes target)
|
||||||
if(DEFINED OCV_TARGET_INCLUDE_DIRS_${target})
|
if(DEFINED OCV_TARGET_INCLUDE_DIRS_${target})
|
||||||
target_include_directories(${target} PRIVATE ${OCV_TARGET_INCLUDE_DIRS_${target}})
|
target_include_directories(${target} PRIVATE ${OCV_TARGET_INCLUDE_DIRS_${target}})
|
||||||
|
@ -63,5 +63,9 @@ ocv_target_link_libraries(${the_module} LINK_PRIVATE
|
|||||||
"${OPENCV_HAL_LINKER_LIBS}"
|
"${OPENCV_HAL_LINKER_LIBS}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(HAVE_CUDA)
|
||||||
|
ocv_target_compile_definitions(${the_module} PUBLIC OPENCV_TRAITS_ENABLE_DEPRECATED)
|
||||||
|
endif()
|
||||||
|
|
||||||
ocv_add_accuracy_tests()
|
ocv_add_accuracy_tests()
|
||||||
ocv_add_perf_tests()
|
ocv_add_perf_tests()
|
||||||
|
@ -186,7 +186,7 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
BufferPool pool(stream);
|
BufferPool pool(stream);
|
||||||
GpuMat objectsBuf = pool.getBuffer(1, maxNumObjects_, DataType<Rect>::type);
|
GpuMat objectsBuf = pool.getBuffer(1, maxNumObjects_, traits::Type<Rect>::value);
|
||||||
|
|
||||||
unsigned int numDetections;
|
unsigned int numDetections;
|
||||||
ncvSafeCall( process(image, objectsBuf, ncvMinSize, numDetections) );
|
ncvSafeCall( process(image, objectsBuf, ncvMinSize, numDetections) );
|
||||||
@ -220,7 +220,7 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
CV_Assert( gpu_objects.rows == 1 );
|
CV_Assert( gpu_objects.rows == 1 );
|
||||||
CV_Assert( gpu_objects.type() == DataType<Rect>::type );
|
CV_Assert( gpu_objects.type() == traits::Type<Rect>::value );
|
||||||
|
|
||||||
Rect* ptr = gpu_objects.ptr<Rect>();
|
Rect* ptr = gpu_objects.ptr<Rect>();
|
||||||
objects.assign(ptr, ptr + gpu_objects.cols);
|
objects.assign(ptr, ptr + gpu_objects.cols);
|
||||||
@ -533,7 +533,7 @@ namespace
|
|||||||
const float grouping_eps = 0.2f;
|
const float grouping_eps = 0.2f;
|
||||||
|
|
||||||
BufferPool pool(stream);
|
BufferPool pool(stream);
|
||||||
GpuMat objects = pool.getBuffer(1, maxNumObjects_, DataType<Rect>::type);
|
GpuMat objects = pool.getBuffer(1, maxNumObjects_, traits::Type<Rect>::value);
|
||||||
|
|
||||||
// used for debug
|
// used for debug
|
||||||
// candidates.setTo(cv::Scalar::all(0));
|
// candidates.setTo(cv::Scalar::all(0));
|
||||||
@ -625,7 +625,7 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
CV_Assert( gpu_objects.rows == 1 );
|
CV_Assert( gpu_objects.rows == 1 );
|
||||||
CV_Assert( gpu_objects.type() == DataType<Rect>::type );
|
CV_Assert( gpu_objects.type() == traits::Type<Rect>::value );
|
||||||
|
|
||||||
Rect* ptr = gpu_objects.ptr<Rect>();
|
Rect* ptr = gpu_objects.ptr<Rect>();
|
||||||
objects.assign(ptr, ptr + gpu_objects.cols);
|
objects.assign(ptr, ptr + gpu_objects.cols);
|
||||||
|
Loading…
Reference in New Issue
Block a user