fixed defects from Xcode

This commit is contained in:
Ilya Lavrenov 2014-02-23 21:07:20 +04:00
parent 32eb38ec98
commit ce0557ebb8
11 changed files with 23 additions and 29 deletions

View File

@ -218,6 +218,7 @@ void CirclesGridClusterFinder::findCorners(const std::vector<cv::Point2f> &hull2
void CirclesGridClusterFinder::findOutsideCorners(const std::vector<cv::Point2f> &corners, std::vector<cv::Point2f> &outsideCorners) void CirclesGridClusterFinder::findOutsideCorners(const std::vector<cv::Point2f> &corners, std::vector<cv::Point2f> &outsideCorners)
{ {
CV_Assert(!corners.empty());
outsideCorners.clear(); outsideCorners.clear();
//find two pairs of the most nearest corners //find two pairs of the most nearest corners
int i, j, n = (int)corners.size(); int i, j, n = (int)corners.size();

View File

@ -311,7 +311,7 @@ void CV_ChessboardDetectorTest::run_batch( const string& filename )
if (count != 0) if (count != 0)
sum_error /= count; sum_error /= count;
ts->printf(cvtest::TS::LOG, "Average error is %f\n", sum_error); ts->printf(cvtest::TS::LOG, "Average error is %f (%d patterns have been found)\n", sum_error, count);
} }
double calcErrorMinError(const Size& cornSz, const vector<Point2f>& corners_found, const vector<Point2f>& corners_generated) double calcErrorMinError(const Size& cornSz, const vector<Point2f>& corners_found, const vector<Point2f>& corners_generated)

View File

@ -353,7 +353,7 @@ Mat& Mat::operator = (const Scalar& s)
Mat& Mat::setTo(InputArray _value, InputArray _mask) Mat& Mat::setTo(InputArray _value, InputArray _mask)
{ {
if( !data ) if( empty() )
return *this; return *this;
Mat value = _value.getMat(), mask = _mask.getMat(); Mat value = _value.getMat(), mask = _mask.getMat();
@ -632,6 +632,7 @@ int cv::borderInterpolate( int p, int len, int borderType )
} }
else if( borderType == BORDER_WRAP ) else if( borderType == BORDER_WRAP )
{ {
CV_Assert(len > 0);
if( p < 0 ) if( p < 0 )
p -= ((p-len+1)/len)*len; p -= ((p-len+1)/len)*len;
if( p >= len ) if( p >= len )

View File

@ -426,6 +426,7 @@ String format( const char* fmt, ... )
String s(len, '\0'); String s(len, '\0');
va_start(va, fmt); va_start(va, fmt);
len = vsnprintf((char*)s.c_str(), len + 1, fmt, va); len = vsnprintf((char*)s.c_str(), len + 1, fmt, va);
(void)len;
va_end(va); va_end(va);
return s; return s;
} }

View File

@ -408,7 +408,7 @@ static bool ocl_accumulate( InputArray _src, InputArray _src2, InputOutputArray
argidx = k.set(argidx, alpha); argidx = k.set(argidx, alpha);
} }
if (haveMask) if (haveMask)
argidx = k.set(argidx, maskarg); k.set(argidx, maskarg);
size_t globalsize[2] = { src.cols, src.rows }; size_t globalsize[2] = { src.cols, src.rows };
return k.run(2, globalsize, NULL, false); return k.run(2, globalsize, NULL, false);

View File

@ -83,11 +83,9 @@ namespace clahe
idx = k.set(idx, tile_size); idx = k.set(idx, tile_size);
idx = k.set(idx, tilesX); idx = k.set(idx, tilesX);
idx = k.set(idx, clipLimit); idx = k.set(idx, clipLimit);
idx = k.set(idx, lutScale); k.set(idx, lutScale);
if (!k.run(2, globalThreads, localThreads, false)) return k.run(2, globalThreads, localThreads, false);
return false;
return true;
} }
static bool transform(cv::InputArray _src, cv::OutputArray _dst, cv::InputArray _lut, static bool transform(cv::InputArray _src, cv::OutputArray _dst, cv::InputArray _lut,
@ -118,11 +116,9 @@ namespace clahe
idx = k.set(idx, src.rows); idx = k.set(idx, src.rows);
idx = k.set(idx, tile_size); idx = k.set(idx, tile_size);
idx = k.set(idx, tilesX); idx = k.set(idx, tilesX);
idx = k.set(idx, tilesY); k.set(idx, tilesY);
if (!k.run(2, globalThreads, localThreads, false)) return k.run(2, globalThreads, localThreads, false);
return false;
return true;
} }
} }

View File

@ -294,7 +294,7 @@ void ERFilterNM::er_tree_extract( InputArray image )
push_new_component = false; push_new_component = false;
// explore the (remaining) edges to the neighbors to the current pixel // explore the (remaining) edges to the neighbors to the current pixel
for (current_edge = current_edge; current_edge < 4; current_edge++) for ( ; current_edge < 4; current_edge++)
{ {
int neighbour_pixel = current_pixel; int neighbour_pixel = current_pixel;
@ -1949,7 +1949,6 @@ private:
double (dissimilarity::*distfn) (const int_fast32_t, const int_fast32_t) const; double (dissimilarity::*distfn) (const int_fast32_t, const int_fast32_t) const;
auto_array_ptr<double> precomputed; auto_array_ptr<double> precomputed;
double * precomputed2;
double * V; double * V;
const double * V_data; const double * V_data;

View File

@ -574,7 +574,7 @@ public:
Size winStride = Size(), Size padding = Size(), Size winStride = Size(), Size padding = Size(),
const vector<Point>& locations = vector<Point>()) const; const vector<Point>& locations = vector<Point>()) const;
virtual void compute(const Mat& img, vector<float>& descriptors, virtual void compute(InputArray img, vector<float>& descriptors,
Size winStride = Size(), Size padding = Size(), Size winStride = Size(), Size padding = Size(),
const vector<Point>& locations = vector<Point>()) const; const vector<Point>& locations = vector<Point>()) const;
@ -1107,9 +1107,11 @@ void HOGDescriptorTester::detect(const Mat& img, vector<Point>& hits, double hit
detect(img, hits, weightsV, hitThreshold, winStride, padding, locations); detect(img, hits, weightsV, hitThreshold, winStride, padding, locations);
} }
void HOGDescriptorTester::compute(const Mat& img, vector<float>& descriptors, void HOGDescriptorTester::compute(InputArray _img, vector<float>& descriptors,
Size winStride, Size padding, const vector<Point>& locations) const Size winStride, Size padding, const vector<Point>& locations) const
{ {
Mat img = _img.getMat();
if( winStride == Size() ) if( winStride == Size() )
winStride = cellSize; winStride = cellSize;
Size cacheStride(gcd(winStride.width, blockStride.width), Size cacheStride(gcd(winStride.width, blockStride.width),

View File

@ -120,7 +120,6 @@ public:
private: private:
float minMatchCost; float minMatchCost;
float betaAdditional;
protected: protected:
void buildCostMatrix(const cv::Mat& descriptors1, const cv::Mat& descriptors2, void buildCostMatrix(const cv::Mat& descriptors1, const cv::Mat& descriptors2,
cv::Mat& costMatrix, cv::Ptr<cv::HistogramCostExtractor>& comparer) const; cv::Mat& costMatrix, cv::Ptr<cv::HistogramCostExtractor>& comparer) const;

View File

@ -779,7 +779,7 @@ bool BackgroundSubtractorMOG2Impl::ocl_apply(InputArray _image, OutputArray _fgm
idxArg = kernel_apply.set(idxArg, varMax); idxArg = kernel_apply.set(idxArg, varMax);
idxArg = kernel_apply.set(idxArg, fVarInit); idxArg = kernel_apply.set(idxArg, fVarInit);
idxArg = kernel_apply.set(idxArg, fTau); idxArg = kernel_apply.set(idxArg, fTau);
idxArg = kernel_apply.set(idxArg, nShadowDetection); kernel_apply.set(idxArg, nShadowDetection);
size_t globalsize[] = {frame.cols, frame.rows, 1}; size_t globalsize[] = {frame.cols, frame.rows, 1};
@ -805,7 +805,7 @@ bool BackgroundSubtractorMOG2Impl::ocl_getBackgroundImage(OutputArray _backgroun
idxArg = kernel_getBg.set(idxArg, ocl::KernelArg::ReadOnlyNoSize(u_weight)); idxArg = kernel_getBg.set(idxArg, ocl::KernelArg::ReadOnlyNoSize(u_weight));
idxArg = kernel_getBg.set(idxArg, ocl::KernelArg::ReadOnlyNoSize(u_mean)); idxArg = kernel_getBg.set(idxArg, ocl::KernelArg::ReadOnlyNoSize(u_mean));
idxArg = kernel_getBg.set(idxArg, ocl::KernelArg::WriteOnlyNoSize(dst)); idxArg = kernel_getBg.set(idxArg, ocl::KernelArg::WriteOnlyNoSize(dst));
idxArg = kernel_getBg.set(idxArg, backgroundRatio); kernel_getBg.set(idxArg, backgroundRatio);
size_t globalsize[2] = {u_bgmodelUsedModes.cols, u_bgmodelUsedModes.rows}; size_t globalsize[2] = {u_bgmodelUsedModes.cols, u_bgmodelUsedModes.rows};

View File

@ -857,7 +857,7 @@ private:
idxArg = kernel.set(idxArg, dst.cols); idxArg = kernel.set(idxArg, dst.cols);
idxArg = kernel.set(idxArg, ocl::KernelArg::PtrReadOnly(m_gKer)); idxArg = kernel.set(idxArg, ocl::KernelArg::PtrReadOnly(m_gKer));
idxArg = kernel.set(idxArg, (int)ksizeHalf); idxArg = kernel.set(idxArg, (int)ksizeHalf);
idxArg = kernel.set(idxArg, (void *)NULL, smem_size); kernel.set(idxArg, (void *)NULL, smem_size);
return kernel.run(2, globalsize, localsize, false); return kernel.run(2, globalsize, localsize, false);
} }
bool gaussianBlur5Ocl(const UMat &src, int ksizeHalf, UMat &dst) bool gaussianBlur5Ocl(const UMat &src, int ksizeHalf, UMat &dst)
@ -883,7 +883,7 @@ private:
idxArg = kernel.set(idxArg, src.cols); idxArg = kernel.set(idxArg, src.cols);
idxArg = kernel.set(idxArg, ocl::KernelArg::PtrReadOnly(m_gKer)); idxArg = kernel.set(idxArg, ocl::KernelArg::PtrReadOnly(m_gKer));
idxArg = kernel.set(idxArg, (int)ksizeHalf); idxArg = kernel.set(idxArg, (int)ksizeHalf);
idxArg = kernel.set(idxArg, (void *)NULL, smem_size); kernel.set(idxArg, (void *)NULL, smem_size);
return kernel.run(2, globalsize, localsize, false); return kernel.run(2, globalsize, localsize, false);
} }
bool polynomialExpansionOcl(const UMat &src, UMat &dst) bool polynomialExpansionOcl(const UMat &src, UMat &dst)
@ -919,12 +919,7 @@ private:
idxArg = kernel.set(idxArg, ocl::KernelArg::PtrReadOnly(m_xg)); idxArg = kernel.set(idxArg, ocl::KernelArg::PtrReadOnly(m_xg));
idxArg = kernel.set(idxArg, ocl::KernelArg::PtrReadOnly(m_xxg)); idxArg = kernel.set(idxArg, ocl::KernelArg::PtrReadOnly(m_xxg));
idxArg = kernel.set(idxArg, (void *)NULL, smem_size); idxArg = kernel.set(idxArg, (void *)NULL, smem_size);
#if 0 kernel.set(idxArg, (void *)m_ig, 4 * sizeof(float));
if (useDouble)
idxArg = kernel.set(idxArg, (void *)m_igd, 4 * sizeof(double));
else
#endif
idxArg = kernel.set(idxArg, (void *)m_ig, 4 * sizeof(float));
return kernel.run(2, globalsize, localsize, false); return kernel.run(2, globalsize, localsize, false);
} }
bool boxFilter5Ocl(const UMat &src, int ksizeHalf, UMat &dst) bool boxFilter5Ocl(const UMat &src, int ksizeHalf, UMat &dst)
@ -951,7 +946,7 @@ private:
idxArg = kernel.set(idxArg, height); idxArg = kernel.set(idxArg, height);
idxArg = kernel.set(idxArg, src.cols); idxArg = kernel.set(idxArg, src.cols);
idxArg = kernel.set(idxArg, (int)ksizeHalf); idxArg = kernel.set(idxArg, (int)ksizeHalf);
idxArg = kernel.set(idxArg, (void *)NULL, smem_size); kernel.set(idxArg, (void *)NULL, smem_size);
return kernel.run(2, globalsize, localsize, false); return kernel.run(2, globalsize, localsize, false);
} }
@ -976,7 +971,7 @@ private:
idxArg = kernel.set(idxArg, ocl::KernelArg::PtrReadOnly(flowy)); idxArg = kernel.set(idxArg, ocl::KernelArg::PtrReadOnly(flowy));
idxArg = kernel.set(idxArg, (int)(flowy.step / flowy.elemSize())); idxArg = kernel.set(idxArg, (int)(flowy.step / flowy.elemSize()));
idxArg = kernel.set(idxArg, (int)flowy.rows); idxArg = kernel.set(idxArg, (int)flowy.rows);
idxArg = kernel.set(idxArg, (int)flowy.cols); kernel.set(idxArg, (int)flowy.cols);
return kernel.run(2, globalsize, localsize, false); return kernel.run(2, globalsize, localsize, false);
} }
bool updateMatricesOcl(const UMat &flowx, const UMat &flowy, const UMat &R0, const UMat &R1, UMat &M) bool updateMatricesOcl(const UMat &flowx, const UMat &flowy, const UMat &R0, const UMat &R1, UMat &M)
@ -1004,7 +999,7 @@ private:
idxArg = kernel.set(idxArg, ocl::KernelArg::PtrReadOnly(R1)); idxArg = kernel.set(idxArg, ocl::KernelArg::PtrReadOnly(R1));
idxArg = kernel.set(idxArg, (int)(R1.step / R1.elemSize())); idxArg = kernel.set(idxArg, (int)(R1.step / R1.elemSize()));
idxArg = kernel.set(idxArg, ocl::KernelArg::PtrWriteOnly(M)); idxArg = kernel.set(idxArg, ocl::KernelArg::PtrWriteOnly(M));
idxArg = kernel.set(idxArg, (int)(M.step / M.elemSize())); kernel.set(idxArg, (int)(M.step / M.elemSize()));
return kernel.run(2, globalsize, localsize, false); return kernel.run(2, globalsize, localsize, false);
} }