fix the function name
This commit is contained in:
parent
c23510785b
commit
88ed74a7ec
@ -838,7 +838,7 @@ namespace cv
|
|||||||
|
|
||||||
//! Compute closest centers for each lines in source and lable it after center's index
|
//! Compute closest centers for each lines in source and lable it after center's index
|
||||||
// supports CV_32FC1/CV_32FC2/CV_32FC4 data type
|
// supports CV_32FC1/CV_32FC2/CV_32FC4 data type
|
||||||
void DistanceComputer(oclMat &dists, oclMat &labels, const oclMat &src, const oclMat ¢ers);
|
CV_EXPORTS void distanceToCenters(oclMat &dists, oclMat &labels, const oclMat &src, const oclMat ¢ers);
|
||||||
|
|
||||||
//!Does k-means procedure on GPU
|
//!Does k-means procedure on GPU
|
||||||
// supports CV_32FC1/CV_32FC2/CV_32FC4 data type
|
// supports CV_32FC1/CV_32FC2/CV_32FC4 data type
|
||||||
|
@ -169,7 +169,7 @@ static void generateCentersPP(const Mat& _data, Mat& _out_centers,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::ocl::DistanceComputer(oclMat &dists, oclMat &labels, const oclMat &src, const oclMat ¢ers)
|
void cv::ocl::distanceToCenters(oclMat &dists, oclMat &labels, const oclMat &src, const oclMat ¢ers)
|
||||||
{
|
{
|
||||||
//if(src.clCxt -> impl -> double_support == 0 && src.type() == CV_64F)
|
//if(src.clCxt -> impl -> double_support == 0 && src.type() == CV_64F)
|
||||||
//{
|
//{
|
||||||
@ -179,7 +179,7 @@ void cv::ocl::DistanceComputer(oclMat &dists, oclMat &labels, const oclMat &src,
|
|||||||
|
|
||||||
Context *clCxt = src.clCxt;
|
Context *clCxt = src.clCxt;
|
||||||
int labels_step = (int)(labels.step/labels.elemSize());
|
int labels_step = (int)(labels.step/labels.elemSize());
|
||||||
string kernelname = "kmeansComputeDistance";
|
string kernelname = "distanceToCenters";
|
||||||
int threadNum = src.rows > 256 ? 256 : src.rows;
|
int threadNum = src.rows > 256 ? 256 : src.rows;
|
||||||
size_t localThreads[3] = {1, threadNum, 1};
|
size_t localThreads[3] = {1, threadNum, 1};
|
||||||
size_t globalThreads[3] = {1, src.rows, 1};
|
size_t globalThreads[3] = {1, src.rows, 1};
|
||||||
@ -413,7 +413,7 @@ double cv::ocl::kmeans(const oclMat &_src, int K, oclMat &_bestLabels,
|
|||||||
|
|
||||||
_bestLabels.upload(_labels);
|
_bestLabels.upload(_labels);
|
||||||
_centers.upload(centers);
|
_centers.upload(centers);
|
||||||
DistanceComputer(_dists, _bestLabels, _src, _centers);
|
distanceToCenters(_dists, _bestLabels, _src, _centers);
|
||||||
|
|
||||||
Mat dists;
|
Mat dists;
|
||||||
_dists.download(dists);
|
_dists.download(dists);
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
//
|
//
|
||||||
//M*/
|
//M*/
|
||||||
|
|
||||||
__kernel void kmeansComputeDistance(
|
__kernel void distanceToCenters(
|
||||||
int label_step, int K,
|
int label_step, int K,
|
||||||
__global float *src,
|
__global float *src,
|
||||||
__global int *labels, int dims, int rows,
|
__global int *labels, int dims, int rows,
|
||||||
@ -72,7 +72,8 @@ __kernel void kmeansComputeDistance(
|
|||||||
{
|
{
|
||||||
min = euDist;
|
min = euDist;
|
||||||
minCentroid = 0;
|
minCentroid = 0;
|
||||||
} else if(euDist < min)
|
}
|
||||||
|
else if(euDist < min)
|
||||||
{
|
{
|
||||||
min = euDist;
|
min = euDist;
|
||||||
minCentroid = i;
|
minCentroid = i;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user