Home | History | Annotate | Download | only in src

Lines Matching refs:trainIdx

64         UMat &trainIdx, UMat &distance, int distType)
72 ensureSizeIsEnough(1, query_rows, CV_32S, trainIdx);
106 idx = k.set(idx, ocl::KernelArg::PtrWriteOnly(trainIdx));
117 static bool ocl_matchConvert(const Mat &trainIdx, const Mat &distance, std::vector< std::vector<DMatch> > &matches)
119 if (trainIdx.empty() || distance.empty())
122 if( (trainIdx.type() != CV_32SC1) || (distance.type() != CV_32FC1 || distance.cols != trainIdx.cols) )
125 const int nQuery = trainIdx.cols;
130 const int *trainIdx_ptr = trainIdx.ptr<int>();
150 static bool ocl_matchDownload(const UMat &trainIdx, const UMat &distance, std::vector< std::vector<DMatch> > &matches)
152 if (trainIdx.empty() || distance.empty())
155 Mat trainIdxCPU = trainIdx.getMat(ACCESS_READ);
161 static bool ocl_knnMatchSingle(InputArray query, InputArray train, UMat &trainIdx,
170 ensureSizeIsEnough(1, query_rows, CV_32SC2, trainIdx);
173 trainIdx.setTo(Scalar::all(-1));
206 idx = k.set(idx, ocl::KernelArg::PtrWriteOnly(trainIdx));
217 static bool ocl_knnMatchConvert(const Mat &trainIdx, const Mat &distance, std::vector< std::vector<DMatch> > &matches, bool compactResult)
219 if (trainIdx.empty() || distance.empty())
222 if(trainIdx.type() != CV_32SC2 && trainIdx.type() != CV_32SC1) return false;
224 if(distance.size() != trainIdx.size()) return false;
225 if(!trainIdx.isContinuous() || !distance.isContinuous()) return false;
227 const int nQuery = trainIdx.type() == CV_32SC2 ? trainIdx.cols : trainIdx.rows;
228 const int k = trainIdx.type() == CV_32SC2 ? 2 : trainIdx.cols;
233 const int *trainIdx_ptr = trainIdx.ptr<int>();
262 static bool ocl_knnMatchDownload(const UMat &trainIdx, const UMat &distance, std::vector< std::vector<DMatch> > &matches, bool compactResult)
264 if (trainIdx.empty() || distance.empty())
267 Mat trainIdxCPU = trainIdx.getMat(ACCESS_READ);
274 UMat &trainIdx, UMat &distance, UMat &nMatches, float maxDistance, int distType)
284 if (trainIdx.empty())
286 ensureSizeIsEnough(query_rows, std::max((train_rows / 100), 10), CV_32SC1, trainIdx);
316 idx = k.set(idx, ocl::KernelArg::PtrWriteOnly(trainIdx));
323 idx = k.set(idx, trainIdx.cols);
325 idx = k.set(idx, (int)(trainIdx.step / sizeof(int)));
330 static bool ocl_radiusMatchConvert(const Mat &trainIdx, const Mat &distance, const Mat &_nMatches,
333 if (trainIdx.empty() || distance.empty() || _nMatches.empty())
336 if( (trainIdx.type() != CV_32SC1) ||
337 (distance.type() != CV_32FC1 || distance.size() != trainIdx.size()) ||
338 (_nMatches.type() != CV_32SC1 || _nMatches.cols != trainIdx.rows) )
341 const int nQuery = trainIdx.rows;
350 const int *trainIdx_ptr = trainIdx.ptr<int>(queryIdx);
353 const int nMatches = std::min(nMatches_ptr[queryIdx], trainIdx.cols);
381 static bool ocl_radiusMatchDownload(const UMat &trainIdx, const UMat &distance, const UMat &nMatches,
384 if (trainIdx.empty() || distance.empty() || nMatches.empty())
387 Mat trainIdxCPU = trainIdx.getMat(ACCESS_READ);
654 bool DescriptorMatcher::isPossibleMatch( InputArray _mask, int queryIdx, int trainIdx )
657 return mask.empty() || mask.at<uchar>(queryIdx, trainIdx);
698 UMat trainIdx, distance;
699 if (!ocl_matchSingle(query, _train, trainIdx, distance, dstType))
701 if (!ocl_matchDownload(trainIdx, distance, matches))
708 UMat trainIdx, distance;
711 if (!ocl_knnMatchSingle(query, _train, trainIdx, distance, dstType))
713 if (!ocl_knnMatchDownload(trainIdx, distance, matches, compactResult) )
857 UMat trainIdx, distance, nMatches;
858 if (!ocl_radiusMatchSingle(query, _train, trainIdx, distance, nMatches, maxDistance, dstType))
860 if (!ocl_radiusMatchDownload(trainIdx, distance, nMatches, matches, compactResult))
1281 int imgIdx, trainIdx;
1282 collection.getLocalIdx( idx, imgIdx, trainIdx );
1288 matches[i].push_back( DMatch( i, trainIdx, imgIdx, dist ) );