add logging engine
add options to control harris algorithum
This commit is contained in:
19
main.cpp
19
main.cpp
@ -8,6 +8,7 @@
|
||||
#include "unwrap.h"
|
||||
#include "bgremoval.h"
|
||||
#include "normalize.h"
|
||||
#include "log.h"
|
||||
|
||||
void cd_to_exe_dir( char *argv[] )
|
||||
{
|
||||
@ -42,11 +43,13 @@ int main(int argc, char* argv[])
|
||||
Config config;
|
||||
argp_parse(&argp, argc, argv, 0, 0, &config);
|
||||
|
||||
Log::level = config.quiet ? Log::WARN : config.verbose ? Log::DEBUG : Log::INFO;
|
||||
|
||||
std::vector<cv::Mat> inImages = loadImages(config.inFileNames);
|
||||
|
||||
if(inImages.empty())
|
||||
{
|
||||
std::cout<<"Input images must be provided!\n";
|
||||
Log(Log::ERROR)<<"Input images must be provided!";
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -80,16 +83,18 @@ int main(int argc, char* argv[])
|
||||
cv::waitKey(0);
|
||||
}
|
||||
}
|
||||
else std::cout<<"can not read background image from "<<config.bg<<'\n';
|
||||
else Log(Log::WARN)<<"can not read background image from "<<config.bg;
|
||||
}
|
||||
createRemapMap(inImages[0], config.inFileNames[0], mask, config.verbose);
|
||||
createRemapMap(inImages[0], config.inFileNames[0], mask,
|
||||
config.blockSize, config.apature, config.detectorParameter,
|
||||
config.minSize, config.verbose);
|
||||
}
|
||||
else
|
||||
{
|
||||
cv::FileStorage fs(config.maps, cv::FileStorage::READ);
|
||||
if (!fs.isOpened())
|
||||
{
|
||||
std::cerr<<"could not open maps file " <<config.maps<<'\n';
|
||||
Log(Log::ERROR)<<"could not open maps file " <<config.maps;
|
||||
return -1;
|
||||
}
|
||||
cv::Mat xMat;
|
||||
@ -103,9 +108,9 @@ int main(int argc, char* argv[])
|
||||
cv::Mat tmp = cv::imread(config.norm);
|
||||
if(!tmp.data)
|
||||
{
|
||||
std::cerr<<"could not open normalize file " <<config.norm<<'\n';
|
||||
Log(Log::WARN)<<"could not open normalize file " <<config.norm;
|
||||
}
|
||||
applyRemap(tmp, norm, xMat, yMat, cv::Size(900,1000));
|
||||
applyRemap(tmp, norm, xMat, yMat, 500);
|
||||
if(config.verbose)
|
||||
{
|
||||
cv::imshow("Viewer", norm );
|
||||
@ -121,7 +126,7 @@ int main(int argc, char* argv[])
|
||||
cv::waitKey(0);
|
||||
}
|
||||
cv::Mat remaped;
|
||||
applyRemap(image, remaped, xMat, yMat, cv::Size(900,1000));
|
||||
applyRemap(image, remaped, xMat, yMat, 500);
|
||||
if(norm.data) normalize(remaped, norm);
|
||||
cv::imshow( "Viewer", remaped );
|
||||
cv::waitKey(0);
|
||||
|
Reference in New Issue
Block a user