Build tutorial codes together with other samples
These codes should be included into regular builds.
This commit is contained in:
@@ -14,7 +14,7 @@ using namespace cv;
|
||||
/// Global variables
|
||||
Mat src, dst;
|
||||
Mat map_x, map_y;
|
||||
char* remap_window = "Remap demo";
|
||||
const char* remap_window = "Remap demo";
|
||||
int ind = 0;
|
||||
|
||||
/// Function Headers
|
||||
@@ -23,7 +23,7 @@ void update_map( void );
|
||||
/**
|
||||
* @function main
|
||||
*/
|
||||
int main( int argc, char** argv )
|
||||
int main( int, char** argv )
|
||||
{
|
||||
/// Load the image
|
||||
src = imread( argv[1], 1 );
|
||||
@@ -37,7 +37,7 @@ int main( int argc, char** argv )
|
||||
namedWindow( remap_window, CV_WINDOW_AUTOSIZE );
|
||||
|
||||
/// Loop
|
||||
while( true )
|
||||
for(;;)
|
||||
{
|
||||
/// Each 1 sec. Press ESC to exit the program
|
||||
int c = waitKey( 1000 );
|
||||
@@ -71,8 +71,8 @@ void update_map( void )
|
||||
case 0:
|
||||
if( i > src.cols*0.25 && i < src.cols*0.75 && j > src.rows*0.25 && j < src.rows*0.75 )
|
||||
{
|
||||
map_x.at<float>(j,i) = 2*( i - src.cols*0.25 ) + 0.5 ;
|
||||
map_y.at<float>(j,i) = 2*( j - src.rows*0.25 ) + 0.5 ;
|
||||
map_x.at<float>(j,i) = 2*( i - src.cols*0.25f ) + 0.5f ;
|
||||
map_y.at<float>(j,i) = 2*( j - src.rows*0.25f ) + 0.5f ;
|
||||
}
|
||||
else
|
||||
{ map_x.at<float>(j,i) = 0 ;
|
||||
@@ -80,16 +80,16 @@ void update_map( void )
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
map_x.at<float>(j,i) = i ;
|
||||
map_y.at<float>(j,i) = src.rows - j ;
|
||||
map_x.at<float>(j,i) = (float)i ;
|
||||
map_y.at<float>(j,i) = (float)(src.rows - j) ;
|
||||
break;
|
||||
case 2:
|
||||
map_x.at<float>(j,i) = src.cols - i ;
|
||||
map_y.at<float>(j,i) = j ;
|
||||
map_x.at<float>(j,i) = (float)(src.cols - i) ;
|
||||
map_y.at<float>(j,i) = (float)j ;
|
||||
break;
|
||||
case 3:
|
||||
map_x.at<float>(j,i) = src.cols - i ;
|
||||
map_y.at<float>(j,i) = src.rows - j ;
|
||||
map_x.at<float>(j,i) = (float)(src.cols - i) ;
|
||||
map_y.at<float>(j,i) = (float)(src.rows - j) ;
|
||||
break;
|
||||
} // end of switch
|
||||
}
|
||||
|
Reference in New Issue
Block a user