mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
fixed many warnings (modified pull request 13)
This commit is contained in:
@@ -65,11 +65,11 @@ inline float CvHOGEvaluator::Feature::calc( const vector<Mat>& _hists, const Mat
|
||||
int binIdx = featComponent % N_BINS;
|
||||
int cellIdx = featComponent / N_BINS;
|
||||
|
||||
const float *hist = _hists[binIdx].ptr<float>((int)y);
|
||||
res = hist[fastRect[cellIdx].p0] - hist[fastRect[cellIdx].p1] - hist[fastRect[cellIdx].p2] + hist[fastRect[cellIdx].p3];
|
||||
const float *phist = _hists[binIdx].ptr<float>((int)y);
|
||||
res = phist[fastRect[cellIdx].p0] - phist[fastRect[cellIdx].p1] - phist[fastRect[cellIdx].p2] + phist[fastRect[cellIdx].p3];
|
||||
|
||||
const float *normSum = _normSum.ptr<float>((int)y);
|
||||
normFactor = (float)(normSum[fastRect[0].p0] - normSum[fastRect[1].p1] - normSum[fastRect[2].p2] + normSum[fastRect[3].p3]);
|
||||
const float *pnormSum = _normSum.ptr<float>((int)y);
|
||||
normFactor = (float)(pnormSum[fastRect[0].p0] - pnormSum[fastRect[1].p1] - pnormSum[fastRect[2].p2] + pnormSum[fastRect[3].p3]);
|
||||
res = (res > 0.001f) ? ( res / (normFactor + 0.001f) ) : 0.f; //for cutting negative values, which apper due to floating precision
|
||||
|
||||
return res;
|
||||
|
||||
@@ -41,17 +41,17 @@ protected:
|
||||
|
||||
inline uchar CvLBPEvaluator::Feature::calc(const Mat &_sum, size_t y) const
|
||||
{
|
||||
const int* sum = _sum.ptr<int>((int)y);
|
||||
int cval = sum[p[5]] - sum[p[6]] - sum[p[9]] + sum[p[10]];
|
||||
const int* psum = _sum.ptr<int>((int)y);
|
||||
int cval = psum[p[5]] - psum[p[6]] - psum[p[9]] + psum[p[10]];
|
||||
|
||||
return (uchar)((sum[p[0]] - sum[p[1]] - sum[p[4]] + sum[p[5]] >= cval ? 128 : 0) | // 0
|
||||
(sum[p[1]] - sum[p[2]] - sum[p[5]] + sum[p[6]] >= cval ? 64 : 0) | // 1
|
||||
(sum[p[2]] - sum[p[3]] - sum[p[6]] + sum[p[7]] >= cval ? 32 : 0) | // 2
|
||||
(sum[p[6]] - sum[p[7]] - sum[p[10]] + sum[p[11]] >= cval ? 16 : 0) | // 5
|
||||
(sum[p[10]] - sum[p[11]] - sum[p[14]] + sum[p[15]] >= cval ? 8 : 0) | // 8
|
||||
(sum[p[9]] - sum[p[10]] - sum[p[13]] + sum[p[14]] >= cval ? 4 : 0) | // 7
|
||||
(sum[p[8]] - sum[p[9]] - sum[p[12]] + sum[p[13]] >= cval ? 2 : 0) | // 6
|
||||
(sum[p[4]] - sum[p[5]] - sum[p[8]] + sum[p[9]] >= cval ? 1 : 0)); // 3
|
||||
return (uchar)((psum[p[0]] - psum[p[1]] - psum[p[4]] + psum[p[5]] >= cval ? 128 : 0) | // 0
|
||||
(psum[p[1]] - psum[p[2]] - psum[p[5]] + psum[p[6]] >= cval ? 64 : 0) | // 1
|
||||
(psum[p[2]] - psum[p[3]] - psum[p[6]] + psum[p[7]] >= cval ? 32 : 0) | // 2
|
||||
(psum[p[6]] - psum[p[7]] - psum[p[10]] + psum[p[11]] >= cval ? 16 : 0) | // 5
|
||||
(psum[p[10]] - psum[p[11]] - psum[p[14]] + psum[p[15]] >= cval ? 8 : 0) | // 8
|
||||
(psum[p[9]] - psum[p[10]] - psum[p[13]] + psum[p[14]] >= cval ? 4 : 0) | // 7
|
||||
(psum[p[8]] - psum[p[9]] - psum[p[12]] + psum[p[13]] >= cval ? 2 : 0) | // 6
|
||||
(psum[p[4]] - psum[p[5]] - psum[p[8]] + psum[p[9]] >= cval ? 1 : 0)); // 3
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user