Fixed number of warnings. Fixed mingw64 build.
This commit is contained in:
@@ -200,17 +200,18 @@ static void loadNewFrame(const std::string filenamePrototype, const int currentF
|
||||
// TODO : take care of this step !!! maybe disable of do this in a nicer way ... each successive image should get the same transformation... but it depends on the initial image format
|
||||
double maxInput, minInput;
|
||||
minMaxLoc(inputImage, &minInput, &maxInput);
|
||||
std::cout<<"ORIGINAL IMAGE pixels values range (max,min) : "<<maxInput<<", "<<minInput<<std::endl
|
||||
;if (firstTimeread)
|
||||
std::cout<<"ORIGINAL IMAGE pixels values range (max,min) : "<<maxInput<<", "<<minInput<<std::endl;
|
||||
|
||||
if (firstTimeread)
|
||||
{
|
||||
/* the first time, get the pixel values range and rougthly update scaling value
|
||||
in order to center values around 128 and getting a range close to [0-255],
|
||||
=> actually using a little less in order to let some more flexibility in range evolves...
|
||||
*/
|
||||
double maxInput, minInput;
|
||||
minMaxLoc(inputImage, &minInput, &maxInput);
|
||||
std::cout<<"FIRST IMAGE pixels values range (max,min) : "<<maxInput<<", "<<minInput<<std::endl;
|
||||
globalRescalefactor=(float)(50.0/(maxInput-minInput)); // less than 255 for flexibility... experimental value to be carefull about
|
||||
double maxInput1, minInput1;
|
||||
minMaxLoc(inputImage, &minInput1, &maxInput1);
|
||||
std::cout<<"FIRST IMAGE pixels values range (max,min) : "<<maxInput1<<", "<<minInput1<<std::endl;
|
||||
globalRescalefactor=(float)(50.0/(maxInput1-minInput1)); // less than 255 for flexibility... experimental value to be carefull about
|
||||
double channelOffset = -1.5*minInput;
|
||||
globalOffset= cv::Scalar(channelOffset, channelOffset, channelOffset, channelOffset);
|
||||
}
|
||||
|
@@ -803,9 +803,9 @@ void VocData::calcClassifierPrecRecall(const string& input_file, vector<float>&
|
||||
std::sort(order.begin(),order.end(),orderingSorter());
|
||||
|
||||
/* 2. save ranking results to text file */
|
||||
string input_file_std = checkFilenamePathsep(input_file);
|
||||
size_t fnamestart = input_file_std.rfind("/");
|
||||
string scoregt_file_str = input_file_std.substr(0,fnamestart+1) + "scoregt_" + class_name + ".txt";
|
||||
string input_file_std1 = checkFilenamePathsep(input_file);
|
||||
size_t fnamestart = input_file_std1.rfind("/");
|
||||
string scoregt_file_str = input_file_std1.substr(0,fnamestart+1) + "scoregt_" + class_name + ".txt";
|
||||
std::ofstream scoregt_file(scoregt_file_str.c_str());
|
||||
if (scoregt_file.is_open())
|
||||
{
|
||||
|
@@ -230,13 +230,13 @@ static void findConstrainedCorrespondences(const Mat& _F,
|
||||
{
|
||||
if( i1 == i )
|
||||
continue;
|
||||
Point2f p1 = keypoints1[i1].pt;
|
||||
Point2f pt1 = keypoints1[i1].pt;
|
||||
const float* d11 = descriptors1.ptr<float>(i1);
|
||||
double dist = 0;
|
||||
|
||||
e = p2.x*(F[0]*p1.x + F[1]*p1.y + F[2]) +
|
||||
p2.y*(F[3]*p1.x + F[4]*p1.y + F[5]) +
|
||||
F[6]*p1.x + F[7]*p1.y + F[8];
|
||||
e = p2.x*(F[0]*pt1.x + F[1]*pt1.y + F[2]) +
|
||||
p2.y*(F[3]*pt1.x + F[4]*pt1.y + F[5]) +
|
||||
F[6]*pt1.x + F[7]*pt1.y + F[8];
|
||||
if( fabs(e) > eps )
|
||||
continue;
|
||||
|
||||
|
@@ -173,9 +173,9 @@ static void saveCameraParams( const string& filename,
|
||||
{
|
||||
FileStorage fs( filename, FileStorage::WRITE );
|
||||
|
||||
time_t t;
|
||||
time( &t );
|
||||
struct tm *t2 = localtime( &t );
|
||||
time_t tt;
|
||||
time( &tt );
|
||||
struct tm *t2 = localtime( &tt );
|
||||
char buf[1024];
|
||||
strftime( buf, sizeof(buf)-1, "%c", t2 );
|
||||
|
||||
|
@@ -48,46 +48,45 @@ static void onMouse( int event, int x, int y, int, void* )
|
||||
static void help()
|
||||
{
|
||||
cout << "\nThis is a demo that shows mean-shift based tracking\n"
|
||||
"You select a color objects such as your face and it tracks it.\n"
|
||||
"This reads from video camera (0 by default, or the camera number the user enters\n"
|
||||
"Usage: \n"
|
||||
" ./camshiftdemo [camera number]\n";
|
||||
"You select a color objects such as your face and it tracks it.\n"
|
||||
"This reads from video camera (0 by default, or the camera number the user enters\n"
|
||||
"Usage: \n"
|
||||
" ./camshiftdemo [camera number]\n";
|
||||
|
||||
cout << "\n\nHot keys: \n"
|
||||
"\tESC - quit the program\n"
|
||||
"\tc - stop the tracking\n"
|
||||
"\tb - switch to/from backprojection view\n"
|
||||
"\th - show/hide object histogram\n"
|
||||
"\tp - pause video\n"
|
||||
"\tESC - quit the program\n"
|
||||
"\tc - stop the tracking\n"
|
||||
"\tb - switch to/from backprojection view\n"
|
||||
"\th - show/hide object histogram\n"
|
||||
"\tp - pause video\n"
|
||||
"To initialize tracking, select the object with mouse\n";
|
||||
}
|
||||
|
||||
const char* keys =
|
||||
const char* keys =
|
||||
{
|
||||
"{1| | 0 | camera number}"
|
||||
"{1| | 0 | camera number}"
|
||||
};
|
||||
|
||||
int main( int argc, const char** argv )
|
||||
{
|
||||
help();
|
||||
help();
|
||||
|
||||
VideoCapture cap;
|
||||
Rect trackWindow;
|
||||
RotatedRect trackBox;
|
||||
int hsize = 16;
|
||||
float hranges[] = {0,180};
|
||||
const float* phranges = hranges;
|
||||
CommandLineParser parser(argc, argv, keys);
|
||||
int camNum = parser.get<int>("1");
|
||||
|
||||
cap.open(camNum);
|
||||
CommandLineParser parser(argc, argv, keys);
|
||||
int camNum = parser.get<int>("1");
|
||||
|
||||
cap.open(camNum);
|
||||
|
||||
if( !cap.isOpened() )
|
||||
{
|
||||
help();
|
||||
help();
|
||||
cout << "***Could not initialize capturing...***\n";
|
||||
cout << "Current parameter's value: \n";
|
||||
parser.printParams();
|
||||
parser.printParams();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -100,7 +99,7 @@ int main( int argc, const char** argv )
|
||||
|
||||
Mat frame, hsv, hue, mask, hist, histimg = Mat::zeros(200, 320, CV_8UC3), backproj;
|
||||
bool paused = false;
|
||||
|
||||
|
||||
for(;;)
|
||||
{
|
||||
if( !paused )
|
||||
@@ -111,7 +110,7 @@ int main( int argc, const char** argv )
|
||||
}
|
||||
|
||||
frame.copyTo(image);
|
||||
|
||||
|
||||
if( !paused )
|
||||
{
|
||||
cvtColor(image, hsv, CV_BGR2HSV);
|
||||
@@ -131,7 +130,7 @@ int main( int argc, const char** argv )
|
||||
Mat roi(hue, selection), maskroi(mask, selection);
|
||||
calcHist(&roi, 1, 0, maskroi, hist, 1, &hsize, &phranges);
|
||||
normalize(hist, hist, 0, 255, CV_MINMAX);
|
||||
|
||||
|
||||
trackWindow = selection;
|
||||
trackObject = 1;
|
||||
|
||||
@@ -141,7 +140,7 @@ int main( int argc, const char** argv )
|
||||
for( int i = 0; i < hsize; i++ )
|
||||
buf.at<Vec3b>(i) = Vec3b(saturate_cast<uchar>(i*180./hsize), 255, 255);
|
||||
cvtColor(buf, buf, CV_HSV2BGR);
|
||||
|
||||
|
||||
for( int i = 0; i < hsize; i++ )
|
||||
{
|
||||
int val = saturate_cast<int>(hist.at<float>(i)*histimg.rows/255);
|
||||
|
@@ -28,9 +28,9 @@ static void help()
|
||||
int main(int,char**)
|
||||
{
|
||||
help();
|
||||
Mat i = Mat::eye(4, 4, CV_64F);
|
||||
i.at<double>(1,1) = CV_PI;
|
||||
cout << "i = " << i << ";" << endl;
|
||||
Mat I = Mat::eye(4, 4, CV_64F);
|
||||
I.at<double>(1,1) = CV_PI;
|
||||
cout << "I = " << I << ";" << endl;
|
||||
|
||||
Mat r = Mat(10, 3, CV_8UC3);
|
||||
randu(r, Scalar::all(0), Scalar::all(255));
|
||||
|
@@ -223,8 +223,8 @@ void BaseQualityEvaluator::readAllDatasetsRunParams()
|
||||
isWriteParams = false;
|
||||
FileNode topfn = fs.getFirstTopLevelNode();
|
||||
|
||||
FileNode fn = topfn[DEFAULT_PARAMS];
|
||||
readDefaultRunParams(fn);
|
||||
FileNode pfn = topfn[DEFAULT_PARAMS];
|
||||
readDefaultRunParams(pfn);
|
||||
|
||||
for( int i = 0; i < DATASETS_COUNT; i++ )
|
||||
{
|
||||
@@ -280,7 +280,7 @@ bool BaseQualityEvaluator::readDataset( const string& datasetName, vector<Mat>&
|
||||
if( !fs.isOpened() )
|
||||
{
|
||||
cout << "filename " << dirname + filename.str() << endl;
|
||||
FileStorage fs( dirname + filename.str(), FileStorage::READ );
|
||||
FileStorage fs2( dirname + filename.str(), FileStorage::READ );
|
||||
return false;
|
||||
}
|
||||
fs.getFirstTopLevelNode() >> Hs[i];
|
||||
|
@@ -32,8 +32,8 @@ bool selectObject = false;
|
||||
int trackObject = 0;
|
||||
int live = 1;
|
||||
|
||||
static void drawRectangle(Mat* image, Rect win) {
|
||||
rectangle(*image, Point(win.x, win.y), Point(win.x + win.width, win.y
|
||||
static void drawRectangle(Mat* img, Rect win) {
|
||||
rectangle(*img, Point(win.x, win.y), Point(win.x + win.width, win.y
|
||||
+ win.height), Scalar(0, 255, 0), 2, CV_AA);
|
||||
}
|
||||
|
||||
|
@@ -23,14 +23,14 @@ static void help()
|
||||
"To add/remove a feature point click it\n" << endl;
|
||||
}
|
||||
|
||||
Point2f pt;
|
||||
Point2f point;
|
||||
bool addRemovePt = false;
|
||||
|
||||
static void onMouse( int event, int x, int y, int /*flags*/, void* /*param*/ )
|
||||
{
|
||||
if( event == CV_EVENT_LBUTTONDOWN )
|
||||
{
|
||||
pt = Point2f((float)x,(float)y);
|
||||
point = Point2f((float)x,(float)y);
|
||||
addRemovePt = true;
|
||||
}
|
||||
}
|
||||
@@ -97,7 +97,7 @@ int main( int argc, char** argv )
|
||||
{
|
||||
if( addRemovePt )
|
||||
{
|
||||
if( norm(pt - points[1][i]) <= 5 )
|
||||
if( norm(point - points[1][i]) <= 5 )
|
||||
{
|
||||
addRemovePt = false;
|
||||
continue;
|
||||
@@ -116,7 +116,7 @@ int main( int argc, char** argv )
|
||||
if( addRemovePt && points[1].size() < (size_t)MAX_COUNT )
|
||||
{
|
||||
vector<Point2f> tmp;
|
||||
tmp.push_back(pt);
|
||||
tmp.push_back(point);
|
||||
cornerSubPix( gray, tmp, winSize, cvSize(-1,-1), termcrit);
|
||||
points[1].push_back(tmp[0]);
|
||||
addRemovePt = false;
|
||||
|
@@ -146,11 +146,11 @@ static void parseCommandLine( int argc, char* argv[], bool& isColorizeDisp, bool
|
||||
int val = atoi(mask.c_str());
|
||||
|
||||
int l = 100000, r = 10000, sum = 0;
|
||||
for( int i = 0; i < 5; i++ )
|
||||
for( int j = 0; j < 5; j++ )
|
||||
{
|
||||
retrievedImageFlags[i] = ((val % l) / r ) == 0 ? false : true;
|
||||
retrievedImageFlags[j] = ((val % l) / r ) == 0 ? false : true;
|
||||
l /= 10; r /= 10;
|
||||
if( retrievedImageFlags[i] ) sum++;
|
||||
if( retrievedImageFlags[j] ) sum++;
|
||||
}
|
||||
|
||||
if( sum == 0 )
|
||||
|
@@ -126,7 +126,7 @@ double work_megapix = 0.6;
|
||||
double seam_megapix = 0.1;
|
||||
double compose_megapix = -1;
|
||||
float conf_thresh = 1.f;
|
||||
string features = "surf";
|
||||
string features_type = "surf";
|
||||
string ba_cost_func = "ray";
|
||||
string ba_refine_mask = "xxxxx";
|
||||
bool do_wave_correct = true;
|
||||
@@ -194,8 +194,8 @@ static int parseCmdArgs(int argc, char** argv)
|
||||
}
|
||||
else if (string(argv[i]) == "--features")
|
||||
{
|
||||
features = argv[i + 1];
|
||||
if (features == "orb")
|
||||
features_type = argv[i + 1];
|
||||
if (features_type == "orb")
|
||||
match_conf = 0.3f;
|
||||
i++;
|
||||
}
|
||||
@@ -345,7 +345,7 @@ int main(int argc, char* argv[])
|
||||
int64 t = getTickCount();
|
||||
|
||||
Ptr<FeaturesFinder> finder;
|
||||
if (features == "surf")
|
||||
if (features_type == "surf")
|
||||
{
|
||||
#ifdef HAVE_OPENCV_GPU
|
||||
if (try_gpu && gpu::getCudaEnabledDeviceCount() > 0)
|
||||
@@ -354,13 +354,13 @@ int main(int argc, char* argv[])
|
||||
#endif
|
||||
finder = new SurfFeaturesFinder();
|
||||
}
|
||||
else if (features == "orb")
|
||||
else if (features_type == "orb")
|
||||
{
|
||||
finder = new OrbFeaturesFinder();
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "Unknown 2D features type: '" << features << "'.\n";
|
||||
cout << "Unknown 2D features type: '" << features_type << "'.\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@@ -179,7 +179,7 @@ public:
|
||||
virtual ~IMotionEstimatorBuilder() {}
|
||||
virtual Ptr<ImageMotionEstimatorBase> build() = 0;
|
||||
protected:
|
||||
IMotionEstimatorBuilder(CommandLineParser &cmd) : cmd(cmd) {}
|
||||
IMotionEstimatorBuilder(CommandLineParser &command) : cmd(command) {}
|
||||
CommandLineParser cmd;
|
||||
};
|
||||
|
||||
@@ -187,8 +187,8 @@ protected:
|
||||
class MotionEstimatorRansacL2Builder : public IMotionEstimatorBuilder
|
||||
{
|
||||
public:
|
||||
MotionEstimatorRansacL2Builder(CommandLineParser &cmd, bool gpu, const string &prefix = "")
|
||||
: IMotionEstimatorBuilder(cmd), gpu(gpu), prefix(prefix) {}
|
||||
MotionEstimatorRansacL2Builder(CommandLineParser &command, bool use_gpu, const string &_prefix = "")
|
||||
: IMotionEstimatorBuilder(command), gpu(use_gpu), prefix(_prefix) {}
|
||||
|
||||
virtual Ptr<ImageMotionEstimatorBase> build()
|
||||
{
|
||||
@@ -198,7 +198,7 @@ public:
|
||||
if (arg(prefix + "subset") != "auto")
|
||||
ransac.size = argi(prefix + "subset");
|
||||
if (arg(prefix + "thresh") != "auto")
|
||||
ransac.thresh = argi(prefix + "thresh");
|
||||
ransac.thresh = argf(prefix + "thresh");
|
||||
ransac.eps = argf(prefix + "outlier-ratio");
|
||||
est->setRansacParams(ransac);
|
||||
|
||||
@@ -238,8 +238,8 @@ private:
|
||||
class MotionEstimatorL1Builder : public IMotionEstimatorBuilder
|
||||
{
|
||||
public:
|
||||
MotionEstimatorL1Builder(CommandLineParser &cmd, bool gpu, const string &prefix = "")
|
||||
: IMotionEstimatorBuilder(cmd), gpu(gpu), prefix(prefix) {}
|
||||
MotionEstimatorL1Builder(CommandLineParser &command, bool use_gpu, const string &_prefix = "")
|
||||
: IMotionEstimatorBuilder(command), gpu(use_gpu), prefix(_prefix) {}
|
||||
|
||||
virtual Ptr<ImageMotionEstimatorBase> build()
|
||||
{
|
||||
|
@@ -118,13 +118,13 @@ int main( int argc, char** argv )
|
||||
for( i = 0; i < markers.rows; i++ )
|
||||
for( j = 0; j < markers.cols; j++ )
|
||||
{
|
||||
int idx = markers.at<int>(i,j);
|
||||
if( idx == -1 )
|
||||
int index = markers.at<int>(i,j);
|
||||
if( index == -1 )
|
||||
wshed.at<Vec3b>(i,j) = Vec3b(255,255,255);
|
||||
else if( idx <= 0 || idx > compCount )
|
||||
else if( index <= 0 || index > compCount )
|
||||
wshed.at<Vec3b>(i,j) = Vec3b(0,0,0);
|
||||
else
|
||||
wshed.at<Vec3b>(i,j) = colorTab[idx - 1];
|
||||
wshed.at<Vec3b>(i,j) = colorTab[index - 1];
|
||||
}
|
||||
|
||||
wshed = wshed*0.5 + imgGray*0.5;
|
||||
|
Reference in New Issue
Block a user