Set stricter warning rules for gcc

This commit is contained in:
Andrey Kamaev
2012-06-07 17:21:29 +00:00
parent 0395f7c63f
commit 49a1ba6038
241 changed files with 9054 additions and 8947 deletions

View File

@@ -17,7 +17,7 @@ using namespace cv;
using namespace cv::gpu;
void help()
static void help()
{
cout << "Usage: ./cascadeclassifier_gpu \n\t--cascade <cascade_file>\n\t(<image>|--video <video>|--camera <camera_id>)\n"
"Using OpenCV version " << CV_VERSION << endl << endl;
@@ -49,7 +49,7 @@ void convertAndResize(const T& src, T& gray, T& resized, double scale)
}
void matPrint(Mat &img, int lineOffsY, Scalar fontColor, const string &ss)
static void matPrint(Mat &img, int lineOffsY, Scalar fontColor, const string &ss)
{
int fontFace = FONT_HERSHEY_DUPLEX;
double fontScale = 0.8;
@@ -64,7 +64,7 @@ void matPrint(Mat &img, int lineOffsY, Scalar fontColor, const string &ss)
}
void displayState(Mat &canvas, bool bHelp, bool bGpu, bool bLargestFace, bool bFilter, double fps)
static void displayState(Mat &canvas, bool bHelp, bool bGpu, bool bLargestFace, bool bFilter, double fps)
{
Scalar fontColorRed = CV_RGB(255,0,0);
Scalar fontColorNV = CV_RGB(118,185,0);

View File

@@ -1,4 +1,4 @@
#if _MSC_VER >= 1400
#if defined _MSC_VER && _MSC_VER >= 1400
#pragma warning( disable : 4201 4408 4127 4100)
#endif

View File

@@ -18,7 +18,7 @@ inline T mapVal(T x, T a, T b, T c, T d)
return c + (d-c) * (x-a) / (b-a);
}
void colorizeFlow(const Mat &u, const Mat &v, Mat &dst)
static void colorizeFlow(const Mat &u, const Mat &v, Mat &dst)
{
double uMin, uMax;
minMaxLoc(u, &uMin, &uMax, 0, 0);

View File

@@ -85,8 +85,7 @@ private:
double work_fps;
};
void printHelp()
static void printHelp()
{
cout << "Histogram of Oriented Gradients descriptor and detector sample.\n"
<< "\nUsage: hog_gpu\n"
@@ -166,10 +165,10 @@ Args Args::read(int argc, char** argv)
else if (string(argv[i]) == "--resize_src") args.resize_src = (string(argv[++i]) == "true");
else if (string(argv[i]) == "--width") args.width = atoi(argv[++i]);
else if (string(argv[i]) == "--height") args.height = atoi(argv[++i]);
else if (string(argv[i]) == "--hit_threshold")
{
args.hit_threshold = atof(argv[++i]);
args.hit_threshold_auto = false;
else if (string(argv[i]) == "--hit_threshold")
{
args.hit_threshold = atof(argv[++i]);
args.hit_threshold_auto = false;
}
else if (string(argv[i]) == "--scale") args.scale = atof(argv[++i]);
else if (string(argv[i]) == "--nlevels") args.nlevels = atoi(argv[++i]);
@@ -244,15 +243,15 @@ void App::run()
// Create HOG descriptors and detectors here
vector<float> detector;
if (win_size == Size(64, 128))
if (win_size == Size(64, 128))
detector = cv::gpu::HOGDescriptor::getPeopleDetector64x128();
else
detector = cv::gpu::HOGDescriptor::getPeopleDetector48x96();
cv::gpu::HOGDescriptor gpu_hog(win_size, Size(16, 16), Size(8, 8), Size(8, 8), 9,
cv::gpu::HOGDescriptor::DEFAULT_WIN_SIGMA, 0.2, gamma_corr,
cv::gpu::HOGDescriptor gpu_hog(win_size, Size(16, 16), Size(8, 8), Size(8, 8), 9,
cv::gpu::HOGDescriptor::DEFAULT_WIN_SIGMA, 0.2, gamma_corr,
cv::gpu::HOGDescriptor::DEFAULT_NLEVELS);
cv::HOGDescriptor cpu_hog(win_size, Size(16, 16), Size(8, 8), Size(8, 8), 9, 1, -1,
cv::HOGDescriptor cpu_hog(win_size, Size(16, 16), Size(8, 8), Size(8, 8), 9, 1, -1,
HOGDescriptor::L2Hys, 0.2, gamma_corr, cv::HOGDescriptor::DEFAULT_NLEVELS);
gpu_hog.setSVMDetector(detector);
cpu_hog.setSVMDetector(detector);
@@ -315,10 +314,10 @@ void App::run()
if (use_gpu)
{
gpu_img.upload(img);
gpu_hog.detectMultiScale(gpu_img, found, hit_threshold, win_stride,
gpu_hog.detectMultiScale(gpu_img, found, hit_threshold, win_stride,
Size(0, 0), scale, gr_threshold);
}
else cpu_hog.detectMultiScale(img, found, hit_threshold, win_stride,
else cpu_hog.detectMultiScale(img, found, hit_threshold, win_stride,
Size(0, 0), scale, gr_threshold);
hogWorkEnd();
@@ -345,7 +344,7 @@ void App::run()
{
if (!video_writer.isOpened())
{
video_writer.open(args.dst_video, CV_FOURCC('x','v','i','d'), args.dst_video_fps,
video_writer.open(args.dst_video, CV_FOURCC('x','v','i','d'), args.dst_video_fps,
img_to_show.size(), true);
if (!video_writer.isOpened())
throw std::runtime_error("can't create video writer");

View File

@@ -8,12 +8,12 @@
using namespace cv;
using namespace cv::gpu;
void help()
static void help()
{
printf("\nShow off image morphology: erosion, dialation, open and close\n"
"Call:\n morphology2 [image]\n"
"This program also shows use of rect, elipse and cross kernels\n\n");
"Call:\n morphology2 [image]\n"
"This program also shows use of rect, elipse and cross kernels\n\n");
printf( "Hot keys: \n"
"\tESC - quit the program\n"
"\tr - use rectangle structuring element\n"
@@ -32,20 +32,20 @@ int open_close_pos = 0;
int erode_dilate_pos = 0;
// callback function for open/close trackbar
void OpenClose(int, void*)
static void OpenClose(int, void*)
{
int n = open_close_pos - max_iters;
int an = n > 0 ? n : -n;
Mat element = getStructuringElement(element_shape, Size(an*2+1, an*2+1), Point(an, an) );
if( n < 0 )
cv::gpu::morphologyEx(src, dst, CV_MOP_OPEN, element);
cv::gpu::morphologyEx(src, dst, CV_MOP_OPEN, element);
else
cv::gpu::morphologyEx(src, dst, CV_MOP_CLOSE, element);
imshow("Open/Close",(Mat)dst);
}
// callback function for erode/dilate trackbar
void ErodeDilate(int, void*)
static void ErodeDilate(int, void*)
{
int n = erode_dilate_pos - max_iters;
int an = n > 0 ? n : -n;
@@ -78,14 +78,14 @@ int main( int argc, char** argv )
help();
if (src.channels() == 3)
{
// gpu support only 4th channel images
GpuMat src4ch;
cv::gpu::cvtColor(src, src4ch, CV_BGR2BGRA);
src = src4ch;
}
if (src.channels() == 3)
{
// gpu support only 4th channel images
GpuMat src4ch;
cv::gpu::cvtColor(src, src4ch, CV_BGR2BGRA);
src = src4ch;
}
//create windows for output images
namedWindow("Open/Close",1);

View File

@@ -1,4 +1,4 @@
#if _MSC_VER >= 1400
#if defined _MSC_VER && _MSC_VER >= 1400
#pragma warning( disable : 4201 4408 4127 4100)
#endif
@@ -135,13 +135,13 @@ NCVStatus CopyData(const IplImage *image, const NCVMatrixAlloc<Ncv32f> &dst)
return NCV_SUCCESS;
}
NCVStatus LoadImages (const char *frame0Name,
const char *frame1Name,
int &width,
int &height,
NCVStatus LoadImages (const char *frame0Name,
const char *frame1Name,
int &width,
int &height,
Ptr<NCVMatrixAlloc<Ncv32f> > &src,
Ptr<NCVMatrixAlloc<Ncv32f> > &dst,
IplImage *&firstFrame,
IplImage *&firstFrame,
IplImage *&lastFrame)
{
IplImage *image;
@@ -151,11 +151,11 @@ NCVStatus LoadImages (const char *frame0Name,
std::cout << "Could not open '" << frame0Name << "'\n";
return NCV_FILE_ERROR;
}
firstFrame = image;
// copy data to src
ncvAssertReturnNcvStat (CopyData<RgbToMonochrome> (image, src));
IplImage *image2;
image2 = cvLoadImage (frame1Name);
if (image2 == 0)
@@ -189,7 +189,7 @@ inline T MapValue (T x, T a, T b, T c, T d)
NCVStatus ShowFlow (NCVMatrixAlloc<Ncv32f> &u, NCVMatrixAlloc<Ncv32f> &v, const char *name)
{
IplImage *flowField;
NCVMatrixAlloc<Ncv32f> host_u(*g_pHostMemAllocator, u.width(), u.height());
ncvAssertReturn(host_u.isMemAllocated(), NCV_ALLOCATOR_BAD_ALLOC);
@@ -240,7 +240,7 @@ NCVStatus ShowFlow (NCVMatrixAlloc<Ncv32f> &u, NCVMatrixAlloc<Ncv32f> &v, const
ptr_u += u.stride () - u.width ();
ptr_v += v.stride () - v.width ();
}
cvShowImage (name, flowField);
return NCV_SUCCESS;
@@ -253,7 +253,7 @@ IplImage *CreateImage (NCVMatrixAlloc<Ncv32f> &h_r, NCVMatrixAlloc<Ncv32f> &h_g,
if (image == 0) return 0;
unsigned char *row = reinterpret_cast<unsigned char*> (image->imageData);
for (int i = 0; i < image->height; ++i)
{
for (int j = 0; j < image->width; ++j)
@@ -286,10 +286,10 @@ void PrintHelp ()
std::cout << "\t" << std::setw(15) << PARAM_HELP << " - display this help message\n";
}
int ProcessCommandLine(int argc, char **argv,
Ncv32f &timeStep,
char *&frame0Name,
char *&frame1Name,
int ProcessCommandLine(int argc, char **argv,
Ncv32f &timeStep,
char *&frame0Name,
char *&frame1Name,
NCVBroxOpticalFlowDescriptor &desc)
{
timeStep = 0.25f;
@@ -461,7 +461,7 @@ int main(int argc, char **argv)
std::cout << "Failed\n";
return -1;
}
std::cout << "Backward...\n";
if (NCV_SUCCESS != NCVBroxOpticalFlow (desc, *g_pGPUMemAllocator, *dst, *src, uBck, vBck, 0))
{

View File

@@ -144,7 +144,7 @@ string abspath(const string& relpath)
}
int CV_CDECL cvErrorCallback(int /*status*/, const char* /*func_name*/,
static int CV_CDECL cvErrorCallback(int /*status*/, const char* /*func_name*/,
const char* err_msg, const char* /*file_name*/,
int /*line*/, void* /*userdata*/)
{

View File

@@ -10,7 +10,7 @@
using namespace std;
using namespace cv;
void InitMatchTemplate()
static void InitMatchTemplate()
{
Mat src; gen(src, 500, 500, CV_32F, 0, 1);
Mat templ; gen(templ, 500, 500, CV_32F, 0, 1);
@@ -80,7 +80,7 @@ TEST(remap)
{
Mat src, dst, xmap, ymap;
gpu::GpuMat d_src, d_dst, d_xmap, d_ymap;
int interpolation = INTER_LINEAR;
int borderMode = BORDER_REPLICATE;
@@ -355,10 +355,10 @@ TEST(BruteForceMatcher)
BFMatcher matcher(NORM_L2);
Mat query;
Mat query;
gen(query, 3000, desc_len, CV_32F, 0, 1);
Mat train;
Mat train;
gen(train, 3000, desc_len, CV_32F, 0, 1);
// Init GPU matcher
@@ -594,17 +594,17 @@ TEST(cvtColor)
gen(src, 4000, 4000, CV_8UC1, 0, 255);
d_src.upload(src);
SUBTEST << "4000x4000, 8UC1, CV_GRAY2BGRA";
cvtColor(src, dst, CV_GRAY2BGRA, 4);
CPU_ON;
cvtColor(src, dst, CV_GRAY2BGRA, 4);
CPU_OFF;
gpu::cvtColor(d_src, d_dst, CV_GRAY2BGRA, 4);
GPU_ON;
gpu::cvtColor(d_src, d_dst, CV_GRAY2BGRA, 4);
GPU_OFF;
@@ -613,104 +613,104 @@ TEST(cvtColor)
d_src.swap(d_dst);
SUBTEST << "4000x4000, 8UC3 vs 8UC4, CV_BGR2YCrCb";
cvtColor(src, dst, CV_BGR2YCrCb);
CPU_ON;
cvtColor(src, dst, CV_BGR2YCrCb);
CPU_OFF;
gpu::cvtColor(d_src, d_dst, CV_BGR2YCrCb, 4);
GPU_ON;
gpu::cvtColor(d_src, d_dst, CV_BGR2YCrCb, 4);
GPU_OFF;
cv::swap(src, dst);
d_src.swap(d_dst);
SUBTEST << "4000x4000, 8UC4, CV_YCrCb2BGR";
cvtColor(src, dst, CV_YCrCb2BGR, 4);
CPU_ON;
cvtColor(src, dst, CV_YCrCb2BGR, 4);
CPU_OFF;
gpu::cvtColor(d_src, d_dst, CV_YCrCb2BGR, 4);
GPU_ON;
gpu::cvtColor(d_src, d_dst, CV_YCrCb2BGR, 4);
GPU_OFF;
cv::swap(src, dst);
d_src.swap(d_dst);
SUBTEST << "4000x4000, 8UC3 vs 8UC4, CV_BGR2XYZ";
cvtColor(src, dst, CV_BGR2XYZ);
CPU_ON;
cvtColor(src, dst, CV_BGR2XYZ);
CPU_OFF;
gpu::cvtColor(d_src, d_dst, CV_BGR2XYZ, 4);
GPU_ON;
gpu::cvtColor(d_src, d_dst, CV_BGR2XYZ, 4);
GPU_OFF;
cv::swap(src, dst);
d_src.swap(d_dst);
SUBTEST << "4000x4000, 8UC4, CV_XYZ2BGR";
cvtColor(src, dst, CV_XYZ2BGR, 4);
CPU_ON;
cvtColor(src, dst, CV_XYZ2BGR, 4);
CPU_OFF;
gpu::cvtColor(d_src, d_dst, CV_XYZ2BGR, 4);
GPU_ON;
gpu::cvtColor(d_src, d_dst, CV_XYZ2BGR, 4);
GPU_OFF;
cv::swap(src, dst);
d_src.swap(d_dst);
SUBTEST << "4000x4000, 8UC3 vs 8UC4, CV_BGR2HSV";
cvtColor(src, dst, CV_BGR2HSV);
CPU_ON;
cvtColor(src, dst, CV_BGR2HSV);
CPU_OFF;
gpu::cvtColor(d_src, d_dst, CV_BGR2HSV, 4);
GPU_ON;
gpu::cvtColor(d_src, d_dst, CV_BGR2HSV, 4);
GPU_OFF;
cv::swap(src, dst);
d_src.swap(d_dst);
SUBTEST << "4000x4000, 8UC4, CV_HSV2BGR";
cvtColor(src, dst, CV_HSV2BGR, 4);
CPU_ON;
cvtColor(src, dst, CV_HSV2BGR, 4);
CPU_OFF;
gpu::cvtColor(d_src, d_dst, CV_HSV2BGR, 4);
GPU_ON;
gpu::cvtColor(d_src, d_dst, CV_HSV2BGR, 4);
GPU_OFF;
cv::swap(src, dst);
d_src.swap(d_dst);
}
@@ -757,7 +757,7 @@ TEST(threshold)
threshold(src, dst, 50.0, 0.0, THRESH_BINARY);
CPU_ON;
CPU_ON;
threshold(src, dst, 50.0, 0.0, THRESH_BINARY);
CPU_OFF;
@@ -778,7 +778,7 @@ TEST(threshold)
threshold(src, dst, 50.0, 0.0, THRESH_TRUNC);
CPU_ON;
CPU_ON;
threshold(src, dst, 50.0, 0.0, THRESH_TRUNC);
CPU_OFF;
@@ -857,7 +857,7 @@ TEST(projectPoints)
}
void InitSolvePnpRansac()
static void InitSolvePnpRansac()
{
Mat object; gen(object, 1, 4, CV_32FC3, Scalar::all(0), Scalar::all(100));
Mat image; gen(image, 1, 4, CV_32FC2, Scalar::all(0), Scalar::all(100));
@@ -906,7 +906,7 @@ TEST(GaussianBlur)
SUBTEST << size << 'x' << size << ", 8UC4";
Mat src, dst;
gen(src, size, size, CV_8UC4, 0, 256);
GaussianBlur(src, dst, Size(3, 3), 1);
@@ -933,11 +933,11 @@ TEST(filter2D)
{
Mat src;
gen(src, size, size, CV_8UC4, 0, 256);
for (int ksize = 3; ksize <= 16; ksize += 2)
{
{
SUBTEST << "ksize = " << ksize << ", " << size << 'x' << size << ", 8UC4";
Mat kernel;
gen(kernel, ksize, ksize, CV_32FC1, 0.0, 1.0);
@@ -966,7 +966,7 @@ TEST(pyrDown)
{
SUBTEST << size << 'x' << size << ", 8UC4";
Mat src, dst;
Mat src, dst;
gen(src, size, size, CV_8UC4, 0, 256);
pyrDown(src, dst);
@@ -992,7 +992,7 @@ TEST(pyrUp)
{
SUBTEST << size << 'x' << size << ", 8UC4";
Mat src, dst;
Mat src, dst;
gen(src, size, size, CV_8UC4, 0, 256);
@@ -1055,7 +1055,7 @@ TEST(Canny)
CPU_ON;
Canny(img, edges, 50.0, 100.0);
CPU_OFF;
gpu::GpuMat d_img(img);
gpu::GpuMat d_edges;
gpu::CannyBuf d_buf;
@@ -1176,10 +1176,10 @@ TEST(PyrLKOpticalFlow)
Mat frame1 = imread(abspath("rubberwhale2.png"));
if (frame1.empty()) throw runtime_error("can't open rubberwhale2.png");
Mat gray_frame;
cvtColor(frame0, gray_frame, COLOR_BGR2GRAY);
for (int points = 1000; points <= 8000; points *= 2)
{
SUBTEST << points;

View File

@@ -13,21 +13,21 @@ using namespace std;
using namespace cv;
using namespace cv::gpu;
void download(const GpuMat& d_mat, vector<Point2f>& vec)
static void download(const GpuMat& d_mat, vector<Point2f>& vec)
{
vec.resize(d_mat.cols);
Mat mat(1, d_mat.cols, CV_32FC2, (void*)&vec[0]);
d_mat.download(mat);
}
void download(const GpuMat& d_mat, vector<uchar>& vec)
static void download(const GpuMat& d_mat, vector<uchar>& vec)
{
vec.resize(d_mat.cols);
Mat mat(1, d_mat.cols, CV_8UC1, (void*)&vec[0]);
d_mat.download(mat);
}
void drawArrows(Mat& frame, const vector<Point2f>& prevPts, const vector<Point2f>& nextPts, const vector<uchar>& status, Scalar line_color = Scalar(0, 0, 255))
static void drawArrows(Mat& frame, const vector<Point2f>& prevPts, const vector<Point2f>& nextPts, const vector<uchar>& status, Scalar line_color = Scalar(0, 0, 255))
{
for (size_t i = 0; i < prevPts.size(); ++i)
{
@@ -111,7 +111,7 @@ template <typename T> inline T mapValue(T x, T a, T b, T c, T d)
return c + (d - c) * (x - a) / (b - a);
}
void getFlowField(const Mat& u, const Mat& v, Mat& flowField)
static void getFlowField(const Mat& u, const Mat& v, Mat& flowField)
{
float maxDisplacement = 1.0f;

View File

@@ -42,7 +42,7 @@ struct App
void printParams() const;
void workBegin() { work_begin = getTickCount(); }
void workEnd()
void workEnd()
{
int64 d = getTickCount() - work_begin;
double f = getTickFrequency();
@@ -61,7 +61,7 @@ private:
bool running;
Mat left_src, right_src;
Mat left, right;
Mat left, right;
gpu::GpuMat d_left, d_right;
gpu::StereoBM_GPU bm;
@@ -72,7 +72,7 @@ private:
double work_fps;
};
void printHelp()
static void printHelp()
{
cout << "Usage: stereo_match_gpu\n"
<< "\t--left <left_view> --right <right_view> # must be rectified\n"
@@ -119,7 +119,7 @@ Params Params::read(int argc, char** argv)
{
if (string(argv[i]) == "--left") p.left = argv[++i];
else if (string(argv[i]) == "--right") p.right = argv[++i];
else if (string(argv[i]) == "--method")
else if (string(argv[i]) == "--method")
{
if (string(argv[i + 1]) == "BM") p.method = BM;
else if (string(argv[i + 1]) == "BP") p.method = BP;
@@ -137,7 +137,7 @@ Params Params::read(int argc, char** argv)
App::App(const Params& p)
: p(p), running(false)
: p(p), running(false)
{
cv::gpu::printShortCudaDeviceInfo(cv::gpu::getDevice());
@@ -170,7 +170,7 @@ void App::run()
imshow("left", left);
imshow("right", right);
// Set common parameters
// Set common parameters
bm.ndisp = p.ndisp;
bp.ndisp = p.ndisp;
csbp.ndisp = p.ndisp;
@@ -188,7 +188,7 @@ void App::run()
workBegin();
switch (p.method)
{
case Params::BM:
case Params::BM:
if (d_left.channels() > 1 || d_right.channels() > 1)
{
cout << "BM doesn't support color images\n";
@@ -200,7 +200,7 @@ void App::run()
imshow("left", left);
imshow("right", right);
}
bm(d_left, d_right, d_disp);
bm(d_left, d_right, d_disp);
break;
case Params::BP: bp(d_left, d_right, d_disp); break;
case Params::CSBP: csbp(d_left, d_right, d_disp); break;
@@ -252,14 +252,14 @@ void App::handleKey(char key)
break;
case 'p': case 'P':
printParams();
break;
break;
case 'g': case 'G':
if (left.channels() == 1 && p.method != Params::BM)
{
left = left_src;
right = right_src;
}
else
else
{
cvtColor(left_src, left, CV_BGR2GRAY);
cvtColor(right_src, right, CV_BGR2GRAY);

View File

@@ -9,7 +9,7 @@ using namespace std;
using namespace cv;
using namespace cv::gpu;
void help()
static void help()
{
cout << "\nThis program demonstrates using SURF_GPU features detector, descriptor extractor and BruteForceMatcher_GPU" << endl;
cout << "\nUsage:\n\tmatcher_simple_gpu --left <image1> --right <image2>" << endl;
@@ -52,7 +52,7 @@ int main(int argc, char* argv[])
GpuMat descriptors1GPU, descriptors2GPU;
surf(img1, GpuMat(), keypoints1GPU, descriptors1GPU);
surf(img2, GpuMat(), keypoints2GPU, descriptors2GPU);
cout << "FOUND " << keypoints1GPU.cols << " keypoints on first image" << endl;
cout << "FOUND " << keypoints2GPU.cols << " keypoints on second image" << endl;
@@ -60,7 +60,7 @@ int main(int argc, char* argv[])
BFMatcher_GPU matcher(NORM_L2);
GpuMat trainIdx, distance;
matcher.matchSingle(descriptors1GPU, descriptors2GPU, trainIdx, distance);
// downloading results
vector<KeyPoint> keypoints1, keypoints2;
vector<float> descriptors1, descriptors2;
@@ -74,7 +74,7 @@ int main(int argc, char* argv[])
// drawing the results
Mat img_matches;
drawMatches(Mat(img1), keypoints1, Mat(img2), keypoints2, matches, img_matches);
namedWindow("matches", 0);
imshow("matches", img_matches);
waitKey(0);