Fix warnings as errors.
This commit is contained in:
@@ -108,11 +108,15 @@ void load_images( const string & prefix, const string & filename, vector< Mat >
|
|||||||
exit( -1 );
|
exit( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
while( 1 )
|
bool end_of_parsing = false;
|
||||||
|
while( !end_of_parsing )
|
||||||
{
|
{
|
||||||
getline( file, line );
|
getline( file, line );
|
||||||
if( line == "" ) // no more file to read
|
if( line == "" ) // no more file to read
|
||||||
|
{
|
||||||
|
end_of_parsing = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
Mat img = imread( (prefix+line).c_str() ); // load the image
|
Mat img = imread( (prefix+line).c_str() ); // load the image
|
||||||
if( !img.data ) // invalid image, just skip it.
|
if( !img.data ) // invalid image, just skip it.
|
||||||
continue;
|
continue;
|
||||||
@@ -133,7 +137,7 @@ void sample_neg( const vector< Mat > & full_neg_lst, vector< Mat > & neg_lst, co
|
|||||||
const int size_x = box.width;
|
const int size_x = box.width;
|
||||||
const int size_y = box.height;
|
const int size_y = box.height;
|
||||||
|
|
||||||
srand( time( NULL ) );
|
srand( (unsigned int)time( NULL ) );
|
||||||
|
|
||||||
vector< Mat >::const_iterator img = full_neg_lst.begin();
|
vector< Mat >::const_iterator img = full_neg_lst.begin();
|
||||||
vector< Mat >::const_iterator end = full_neg_lst.end();
|
vector< Mat >::const_iterator end = full_neg_lst.end();
|
||||||
@@ -157,11 +161,11 @@ Mat get_hogdescriptor_visu(Mat& color_origImg, vector<float>& descriptorValues,
|
|||||||
const int DIMY = size.height;
|
const int DIMY = size.height;
|
||||||
float zoomFac = 3;
|
float zoomFac = 3;
|
||||||
Mat visu;
|
Mat visu;
|
||||||
resize(color_origImg, visu, Size(color_origImg.cols*zoomFac, color_origImg.rows*zoomFac));
|
resize(color_origImg, visu, Size( (int)(color_origImg.cols*zoomFac), (int)(color_origImg.rows*zoomFac) ) );
|
||||||
|
|
||||||
int cellSize = 8;
|
int cellSize = 8;
|
||||||
int gradientBinSize = 9;
|
int gradientBinSize = 9;
|
||||||
float radRangeForOneBin = CV_PI/(float)gradientBinSize; // dividing 180<38> into 9 bins, how large (in rad) is one bin?
|
float radRangeForOneBin = (float)(CV_PI/(float)gradientBinSize); // dividing 180<38> into 9 bins, how large (in rad) is one bin?
|
||||||
|
|
||||||
// prepare data structure: 9 orientation / gradient strenghts for each cell
|
// prepare data structure: 9 orientation / gradient strenghts for each cell
|
||||||
int cells_in_x_dir = DIMX / cellSize;
|
int cells_in_x_dir = DIMX / cellSize;
|
||||||
@@ -259,7 +263,7 @@ Mat get_hogdescriptor_visu(Mat& color_origImg, vector<float>& descriptorValues,
|
|||||||
int mx = drawX + cellSize/2;
|
int mx = drawX + cellSize/2;
|
||||||
int my = drawY + cellSize/2;
|
int my = drawY + cellSize/2;
|
||||||
|
|
||||||
rectangle(visu, Point(drawX*zoomFac,drawY*zoomFac), Point((drawX+cellSize)*zoomFac,(drawY+cellSize)*zoomFac), CV_RGB(100,100,100), 1);
|
rectangle(visu, Point((int)(drawX*zoomFac), (int)(drawY*zoomFac)), Point((int)((drawX+cellSize)*zoomFac), (int)((drawY+cellSize)*zoomFac)), CV_RGB(100,100,100), 1);
|
||||||
|
|
||||||
// draw in each cell all 9 gradient strengths
|
// draw in each cell all 9 gradient strengths
|
||||||
for (int bin=0; bin<gradientBinSize; bin++)
|
for (int bin=0; bin<gradientBinSize; bin++)
|
||||||
@@ -274,7 +278,7 @@ Mat get_hogdescriptor_visu(Mat& color_origImg, vector<float>& descriptorValues,
|
|||||||
|
|
||||||
float dirVecX = cos( currRad );
|
float dirVecX = cos( currRad );
|
||||||
float dirVecY = sin( currRad );
|
float dirVecY = sin( currRad );
|
||||||
float maxVecLen = cellSize/2;
|
float maxVecLen = (float)(cellSize/2.f);
|
||||||
float scale = 2.5; // just a visualization scale, to see the lines better
|
float scale = 2.5; // just a visualization scale, to see the lines better
|
||||||
|
|
||||||
// compute line coordinates
|
// compute line coordinates
|
||||||
@@ -284,7 +288,7 @@ Mat get_hogdescriptor_visu(Mat& color_origImg, vector<float>& descriptorValues,
|
|||||||
float y2 = my + dirVecY * currentGradStrength * maxVecLen * scale;
|
float y2 = my + dirVecY * currentGradStrength * maxVecLen * scale;
|
||||||
|
|
||||||
// draw gradient visualization
|
// draw gradient visualization
|
||||||
line(visu, Point(x1*zoomFac,y1*zoomFac), Point(x2*zoomFac,y2*zoomFac), CV_RGB(0,255,0), 1);
|
line(visu, Point((int)(x1*zoomFac),(int)(y1*zoomFac)), Point((int)(x2*zoomFac),(int)(y2*zoomFac)), CV_RGB(0,255,0), 1);
|
||||||
|
|
||||||
} // for (all bins)
|
} // for (all bins)
|
||||||
|
|
||||||
@@ -399,7 +403,8 @@ void test_it( const Size & size )
|
|||||||
exit( -1 );
|
exit( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
while( true )
|
bool end_of_process = false;
|
||||||
|
while( !end_of_process )
|
||||||
{
|
{
|
||||||
video >> img;
|
video >> img;
|
||||||
if( !img.data )
|
if( !img.data )
|
||||||
@@ -416,9 +421,9 @@ void test_it( const Size & size )
|
|||||||
draw_locations( draw, locations, trained );
|
draw_locations( draw, locations, trained );
|
||||||
|
|
||||||
imshow( "Video", draw );
|
imshow( "Video", draw );
|
||||||
key = waitKey( 10 );
|
key = (char)waitKey( 10 );
|
||||||
if( 27 == key )
|
if( 27 == key )
|
||||||
break;
|
end_of_process = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,7 +444,7 @@ int main( int argc, char** argv )
|
|||||||
|
|
||||||
load_images( argv[1], argv[2], pos_lst );
|
load_images( argv[1], argv[2], pos_lst );
|
||||||
labels.assign( pos_lst.size(), +1 );
|
labels.assign( pos_lst.size(), +1 );
|
||||||
const unsigned int old = labels.size();
|
const unsigned int old = (unsigned int)labels.size();
|
||||||
load_images( argv[3], argv[4], full_neg_lst );
|
load_images( argv[3], argv[4], full_neg_lst );
|
||||||
sample_neg( full_neg_lst, neg_lst, Size( 96,160 ) );
|
sample_neg( full_neg_lst, neg_lst, Size( 96,160 ) );
|
||||||
labels.insert( labels.end(), neg_lst.size(), -1 );
|
labels.insert( labels.end(), neg_lst.size(), -1 );
|
||||||
|
Reference in New Issue
Block a user