Commit 769f61f8 authored by Andrey Kamaev's avatar Andrey Kamaev

Merge pull request #55 from vpisarev/ocl_fixes

parents d1d6ce63 f75946a1
......@@ -13,7 +13,7 @@ set(kernels_cpp "${CMAKE_CURRENT_BINARY_DIR}/kernels.cpp")
set(cl2cpp_script "${CMAKE_CURRENT_SOURCE_DIR}/cl2cpp.py")
set(cl2cpp_script_W32 "${CMAKE_CURRENT_SOURCE_DIR}/cl2cpp.js")
IF(WIN32)
IF(0)
add_custom_command(
OUTPUT ${kernels_cpp}
COMMAND wscript.exe ${cl2cpp_script_W32} "${CMAKE_CURRENT_SOURCE_DIR}/src/kernels" ${kernels_cpp}
......
......@@ -1548,7 +1548,8 @@ void cv::ocl::BruteForceMatcher_OCL_base::knnMatch(const oclMat &query, vector<
temp.reserve(2 * k);
matches.resize(query.rows);
for_each(matches.begin(), matches.end(), bind2nd(mem_fun_ref(&vector<DMatch>::reserve), k));
for(size_t queryIdx = 0; queryIdx < matches.size(); queryIdx++ )
matches[queryIdx].reserve(k);
for (size_t imgIdx = 0, size = trainDescCollection.size(); imgIdx < size; ++imgIdx)
{
......@@ -1572,8 +1573,15 @@ void cv::ocl::BruteForceMatcher_OCL_base::knnMatch(const oclMat &query, vector<
if (compactResult)
{
vector< vector<DMatch> >::iterator new_end = remove_if(matches.begin(), matches.end(), mem_fun_ref(&vector<DMatch>::empty));
matches.erase(new_end, matches.end());
size_t i, j = 0;
for( i = 0; i < matches.size(); i++ )
if( !matches[i].empty() )
{
if( i > j )
matches[j] = matches[i];
j++;
}
matches.resize(j);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment