#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
static void help( void )
{
printf("\nThis program illustrates Linear-Polar and Log-Polar image transforms\n"
"Usage :\n"
"./polar_transforms [[camera number -- Default 0],[path_to_filename]]\n\n");
}
int main( int argc, char** argv )
{
Mat log_polar_img, lin_polar_img, recovered_log_polar, recovered_lin_polar_img;
help();
std::string arg = parser.
get<std::string>(
"@input");
if( arg.size() == 1 && isdigit(arg[0]) )
capture.
open( arg[0] -
'0' );
else
capture.
open( arg.c_str() );
{
const char* name = argv[0];
fprintf(stderr,"Could not initialize capturing...\n");
fprintf(stderr,"Usage: %s <CAMERA_NUMBER> , or \n %s <VIDEO_FILE>\n", name, name);
return -1;
}
for(;;)
{
capture >> frame;
if( frame.empty() )
break;
Point2f center( (
float)frame.cols / 2, (
float)frame.rows / 2 );
double radius = (double)frame.cols / 4;
double M = (
double)frame.cols /
log(radius);
imshow(
"Log-Polar", log_polar_img );
imshow(
"Linear-Polar", lin_polar_img );
imshow(
"Recovered Linear-Polar", recovered_lin_polar_img );
imshow(
"Recovered Log-Polar", recovered_log_polar );
break;
}
return 0;
}