fixed many warnings (modified pull request 13)

This commit is contained in:
Vadim Pisarevsky 2012-08-28 18:15:14 +04:00
parent aa2524f41e
commit 633a8bfacc
13 changed files with 82 additions and 72 deletions

View File

@ -28,6 +28,7 @@
* TIFF Library UNIX-specific Routines.
*/
#include "tiffiop.h"
#include "tiffio.hxx"
#include <iostream>
#ifndef __VMS

View File

@ -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;

View File

@ -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

View File

@ -100,8 +100,8 @@ private:
float max_scale_;
public:
SlidingWindowImageRange(int width, int height, int x_step = 3, int y_step = 3, int scales = 5, float min_scale = 0.6, float max_scale = 1.6) :
width_(width), height_(height), x_step_(x_step),y_step_(y_step), scales_(scales), min_scale_(min_scale), max_scale_(max_scale)
SlidingWindowImageRange(int width, int height, int x_step = 3, int y_step = 3, int _scales = 5, float min_scale = 0.6, float max_scale = 1.6) :
width_(width), height_(height), x_step_(x_step),y_step_(y_step), scales_(_scales), min_scale_(min_scale), max_scale_(max_scale)
{
}
@ -121,8 +121,8 @@ private:
LocationImageRange& operator=(const LocationImageRange&);
public:
LocationImageRange(const std::vector<Point>& locations, int scales = 5, float min_scale = 0.6, float max_scale = 1.6) :
locations_(locations), scales_(scales), min_scale_(min_scale), max_scale_(max_scale)
LocationImageRange(const std::vector<Point>& locations, int _scales = 5, float min_scale = 0.6, float max_scale = 1.6) :
locations_(locations), scales_(_scales), min_scale_(min_scale), max_scale_(max_scale)
{
}
@ -141,10 +141,10 @@ private:
LocationScaleImageRange(const LocationScaleImageRange&);
LocationScaleImageRange& operator=(const LocationScaleImageRange&);
public:
LocationScaleImageRange(const std::vector<Point>& locations, const std::vector<float>& scales) :
locations_(locations), scales_(scales)
LocationScaleImageRange(const std::vector<Point>& locations, const std::vector<float>& _scales) :
locations_(locations), scales_(_scales)
{
assert(locations.size()==scales.size());
assert(locations.size()==_scales.size());
}
ImageIterator* iterator() const
@ -237,7 +237,7 @@ private:
std::vector<Template*> templates;
public:
Matching(bool use_orientation = true, float truncate = 10) : truncate_(truncate), use_orientation_(use_orientation)
Matching(bool use_orientation = true, float _truncate = 10) : truncate_(_truncate), use_orientation_(use_orientation)
{
}
@ -370,7 +370,7 @@ private:
LocationImageIterator& operator=(const LocationImageIterator&);
public:
LocationImageIterator(const std::vector<Point>& locations, int scales, float min_scale, float max_scale);
LocationImageIterator(const std::vector<Point>& locations, int _scales, float min_scale, float max_scale);
bool hasNext() const {
return has_next_;
@ -392,10 +392,10 @@ private:
LocationScaleImageIterator& operator=(const LocationScaleImageIterator&);
public:
LocationScaleImageIterator(const std::vector<Point>& locations, const std::vector<float>& scales) :
locations_(locations), scales_(scales)
LocationScaleImageIterator(const std::vector<Point>& locations, const std::vector<float>& _scales) :
locations_(locations), scales_(_scales)
{
assert(locations.size()==scales.size());
assert(locations.size()==_scales.size());
reset();
}
@ -494,7 +494,7 @@ ChamferMatcher::SlidingWindowImageIterator::SlidingWindowImageIterator( int widt
int height,
int x_step = 3,
int y_step = 3,
int scales = 5,
int _scales = 5,
float min_scale = 0.6,
float max_scale = 1.6) :
@ -502,7 +502,7 @@ ChamferMatcher::SlidingWindowImageIterator::SlidingWindowImageIterator( int widt
height_(height),
x_step_(x_step),
y_step_(y_step),
scales_(scales),
scales_(_scales),
min_scale_(min_scale),
max_scale_(max_scale)
{
@ -550,11 +550,11 @@ ChamferMatcher::ImageIterator* ChamferMatcher::SlidingWindowImageRange::iterator
ChamferMatcher::LocationImageIterator::LocationImageIterator(const std::vector<Point>& locations,
int scales = 5,
int _scales = 5,
float min_scale = 0.6,
float max_scale = 1.6) :
locations_(locations),
scales_(scales),
scales_(_scales),
min_scale_(min_scale),
max_scale_(max_scale)
{
@ -1138,10 +1138,10 @@ ChamferMatcher::Match* ChamferMatcher::Matching::localChamferDistance(Point offs
}
ChamferMatcher::Matches* ChamferMatcher::Matching::matchTemplates(Mat& dist_img, Mat& orientation_img, const ImageRange& range, float orientation_weight)
ChamferMatcher::Matches* ChamferMatcher::Matching::matchTemplates(Mat& dist_img, Mat& orientation_img, const ImageRange& range, float _orientation_weight)
{
ChamferMatcher::Matches* matches(new Matches());
ChamferMatcher::Matches* pmatches(new Matches());
// try each template
for(size_t i = 0; i < templates.size(); i++) {
ImageIterator* it = range.iterator();
@ -1156,17 +1156,17 @@ ChamferMatcher::Matches* ChamferMatcher::Matching::matchTemplates(Mat& dist_img,
if (loc.x-tpl->center.x<0 || loc.x+tpl->size.width/2>=dist_img.cols) continue;
if (loc.y-tpl->center.y<0 || loc.y+tpl->size.height/2>=dist_img.rows) continue;
ChamferMatcher::Match* is = localChamferDistance(loc, dist_img, orientation_img, tpl, orientation_weight);
ChamferMatcher::Match* is = localChamferDistance(loc, dist_img, orientation_img, tpl, _orientation_weight);
if(is)
{
matches->push_back(*is);
pmatches->push_back(*is);
delete is;
}
}
delete it;
}
return matches;
return pmatches;
}
@ -1176,7 +1176,8 @@ ChamferMatcher::Matches* ChamferMatcher::Matching::matchTemplates(Mat& dist_img,
* @param edge_img Edge image
* @return a match object
*/
ChamferMatcher::Matches* ChamferMatcher::Matching::matchEdgeImage(Mat& edge_img, const ImageRange& range, float orientation_weight, int /*max_matches*/, float /*min_match_distance*/)
ChamferMatcher::Matches* ChamferMatcher::Matching::matchEdgeImage(Mat& edge_img, const ImageRange& range,
float _orientation_weight, int /*max_matches*/, float /*min_match_distance*/)
{
CV_Assert(edge_img.channels()==1);
@ -1203,10 +1204,10 @@ ChamferMatcher::Matches* ChamferMatcher::Matching::matchEdgeImage(Mat& edge_img,
// Template matching
ChamferMatcher::Matches* matches = matchTemplates( dist_img,
ChamferMatcher::Matches* pmatches = matchTemplates( dist_img,
orientation_img,
range,
orientation_weight);
_orientation_weight);
if (use_orientation_) {
@ -1215,7 +1216,7 @@ ChamferMatcher::Matches* ChamferMatcher::Matching::matchEdgeImage(Mat& edge_img,
dist_img.release();
annotated_img.release();
return matches;
return pmatches;
}

View File

@ -473,7 +473,10 @@ protected:
//! detects corners using FAST algorithm by E. Rosten
CV_EXPORTS void FAST( InputArray image, CV_OUT vector<KeyPoint>& keypoints,
int threshold, bool nonmaxSupression=true, int type = 2 );
int threshold, bool nonmaxSupression=true );
CV_EXPORTS void FAST( InputArray image, CV_OUT vector<KeyPoint>& keypoints,
int threshold, bool nonmaxSupression, int type );
class CV_EXPORTS_W FastFeatureDetector : public FeatureDetector
{

View File

@ -578,6 +578,11 @@ void FAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bool
break;
}
}
void FAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bool nonmax_suppression)
{
FAST(_img, keypoints, threshold, nonmax_suppression, FastFeatureDetector::TYPE_9_16);
}
/*
* FastFeatureDetector
*/

View File

@ -23,13 +23,13 @@ void generateMap(cv::Mat& map_x, cv::Mat& map_y, int remapMode)
case HALF_SIZE:
if (i > map_x.cols*0.25 && i < map_x.cols*0.75 && j > map_x.rows*0.25 && j < map_x.rows*0.75)
{
map_x.at<float>(j,i) = 2 * (i - map_x.cols * 0.25f) + 0.5f;
map_y.at<float>(j,i) = 2 * (j - map_x.rows * 0.25f) + 0.5f;
map_x.at<float>(j,i) = 2.f * (i - map_x.cols * 0.25f) + 0.5f;
map_y.at<float>(j,i) = 2.f * (j - map_x.rows * 0.25f) + 0.5f;
}
else
{
map_x.at<float>(j,i) = 0;
map_y.at<float>(j,i) = 0;
map_x.at<float>(j,i) = 0.f;
map_y.at<float>(j,i) = 0.f;
}
break;
case UPSIDE_DOWN:

View File

@ -23,7 +23,7 @@ struct GreedyLabeling
struct InInterval
{
InInterval(const int& _lo, const int& _hi) : lo(-_lo), hi(_hi) {};
InInterval(const int& _lo, const int& _hi) : lo(-_lo), hi(_hi) {}
const int lo, hi;
bool operator() (const unsigned char a, const unsigned char b) const

View File

@ -2050,7 +2050,7 @@ bool InputMediaStream_FFMPEG::read(unsigned char** data, int* size, int* endOfFi
if (ret < 0)
{
if (ret == (int64_t)AVERROR_EOF)
if ((int64_t)ret == (int64_t)AVERROR_EOF)
*endOfFile = true;
return false;
}

View File

@ -2069,7 +2069,7 @@ void CvDTree::cluster_categories( const int* vectors, int n, int m,
{
int sum = 0;
const int* v = vectors + i*m;
labels[i] = i < k ? i : (*r)(k);
labels[i] = i < k ? i : r->uniform(0, k);
// compute weight of each vector
for( j = 0; j < m; j++ )

View File

@ -128,20 +128,20 @@ inline HaarEvaluator::Feature :: Feature()
p[2][0] = p[2][1] = p[2][2] = p[2][3] = 0;
}
inline float HaarEvaluator::Feature :: calc( int offset ) const
inline float HaarEvaluator::Feature :: calc( int _offset ) const
{
float ret = rect[0].weight * CALC_SUM(p[0], offset) + rect[1].weight * CALC_SUM(p[1], offset);
float ret = rect[0].weight * CALC_SUM(p[0], _offset) + rect[1].weight * CALC_SUM(p[1], _offset);
if( rect[2].weight != 0.0f )
ret += rect[2].weight * CALC_SUM(p[2], offset);
ret += rect[2].weight * CALC_SUM(p[2], _offset);
return ret;
}
inline void HaarEvaluator::Feature :: updatePtrs( const Mat& sum )
inline void HaarEvaluator::Feature :: updatePtrs( const Mat& _sum )
{
const int* ptr = (const int*)sum.data;
size_t step = sum.step/sizeof(ptr[0]);
const int* ptr = (const int*)_sum.data;
size_t step = _sum.step/sizeof(ptr[0]);
if (tilted)
{
CV_TILTED_PTRS( p[0][0], p[0][1], p[0][2], p[0][3], ptr, rect[0].r, step );
@ -210,24 +210,24 @@ inline LBPEvaluator::Feature :: Feature()
p[i] = 0;
}
inline int LBPEvaluator::Feature :: calc( int offset ) const
inline int LBPEvaluator::Feature :: calc( int _offset ) const
{
int cval = CALC_SUM_( p[5], p[6], p[9], p[10], offset );
int cval = CALC_SUM_( p[5], p[6], p[9], p[10], _offset );
return (CALC_SUM_( p[0], p[1], p[4], p[5], offset ) >= cval ? 128 : 0) | // 0
(CALC_SUM_( p[1], p[2], p[5], p[6], offset ) >= cval ? 64 : 0) | // 1
(CALC_SUM_( p[2], p[3], p[6], p[7], offset ) >= cval ? 32 : 0) | // 2
(CALC_SUM_( p[6], p[7], p[10], p[11], offset ) >= cval ? 16 : 0) | // 5
(CALC_SUM_( p[10], p[11], p[14], p[15], offset ) >= cval ? 8 : 0)| // 8
(CALC_SUM_( p[9], p[10], p[13], p[14], offset ) >= cval ? 4 : 0)| // 7
(CALC_SUM_( p[8], p[9], p[12], p[13], offset ) >= cval ? 2 : 0)| // 6
(CALC_SUM_( p[4], p[5], p[8], p[9], offset ) >= cval ? 1 : 0);
return (CALC_SUM_( p[0], p[1], p[4], p[5], _offset ) >= cval ? 128 : 0) | // 0
(CALC_SUM_( p[1], p[2], p[5], p[6], _offset ) >= cval ? 64 : 0) | // 1
(CALC_SUM_( p[2], p[3], p[6], p[7], _offset ) >= cval ? 32 : 0) | // 2
(CALC_SUM_( p[6], p[7], p[10], p[11], _offset ) >= cval ? 16 : 0) | // 5
(CALC_SUM_( p[10], p[11], p[14], p[15], _offset ) >= cval ? 8 : 0)| // 8
(CALC_SUM_( p[9], p[10], p[13], p[14], _offset ) >= cval ? 4 : 0)| // 7
(CALC_SUM_( p[8], p[9], p[12], p[13], _offset ) >= cval ? 2 : 0)| // 6
(CALC_SUM_( p[4], p[5], p[8], p[9], _offset ) >= cval ? 1 : 0);
}
inline void LBPEvaluator::Feature :: updatePtrs( const Mat& sum )
inline void LBPEvaluator::Feature :: updatePtrs( const Mat& _sum )
{
const int* ptr = (const int*)sum.data;
size_t step = sum.step/sizeof(ptr[0]);
const int* ptr = (const int*)_sum.data;
size_t step = _sum.step/sizeof(ptr[0]);
Rect tr = rect;
CV_SUM_PTRS( p[0], p[1], p[4], p[5], ptr, tr, step );
tr.x += 2*rect.width;
@ -292,10 +292,10 @@ inline HOGEvaluator::Feature :: Feature()
featComponent = 0;
}
inline float HOGEvaluator::Feature :: calc( int offset ) const
inline float HOGEvaluator::Feature :: calc( int _offset ) const
{
float res = CALC_SUM(pF, offset);
float normFactor = CALC_SUM(pN, offset);
float res = CALC_SUM(pF, _offset);
float normFactor = CALC_SUM(pN, _offset);
res = (res > 0.001f) ? (res / ( normFactor + 0.001f) ) : 0.f;
return res;
}

View File

@ -817,7 +817,7 @@ bool DpSeamFinder::estimateSeam(
{
pair<float, int> opt = *min_element(steps, steps + nsteps);
cost(y, x) = opt.first;
control(y, x) = opt.second;
control(y, x) = (uchar)opt.second;
reachable(y, x) = 255;
}
}
@ -847,7 +847,7 @@ bool DpSeamFinder::estimateSeam(
{
pair<float, int> opt = *min_element(steps, steps + nsteps);
cost(y, x) = opt.first;
control(y, x) = opt.second;
control(y, x) = (uchar)opt.second;
reachable(y, x) = 255;
}
}

View File

@ -269,7 +269,7 @@ namespace
if (updateBackgroundModel_)
{
for (int i = 0; i < nfeatures; ++i)
weights[i] *= 1.0f - learningRate_;
weights[i] *= (float)(1.0f - learningRate_);
bool inserted = insertFeature(newFeatureColor, (float)learningRate_, colors, weights, nfeatures, maxFeatures_);