Commit 97d2aa9f authored by Alex Leontiev's avatar Alex Leontiev

blur bug

parent 9e5b6684
......@@ -7,7 +7,7 @@
#include <cstring>
#include <climits>
#define CMDLINEMAX 10
#define CMDLINEMAX 30
#define ASSESS_TILL 100
#define LINEMAX 40
......@@ -20,7 +20,8 @@ using namespace cv;
static Mat image;
static bool paused;
vector<Scalar> palette;
static bool saveImageKey;
static vector<Scalar> palette;
void print_table(char* videos[],int videoNum,char* algorithms[],int algNum,const vector<vector<char*> >& results,char* tableName);
......@@ -67,20 +68,15 @@ static void help(){
exit(EXIT_SUCCESS);
}
static void parseCommandLineArgs(int argc, char** argv,char* videos[],char* gts[],
int* vc,char* algorithms[],char* initBoxes[][CMDLINEMAX],int* ac){
int* vc,char* algorithms[],char* initBoxes[][CMDLINEMAX],int* ac,char keys[CMDLINEMAX][LINEMAX]){
*ac=*vc=0;
for(int i=1;i<argc;i++){
if(argv[i][0]=='-'){
char *key=(argv[i]+1),*argument=NULL;
if(std::strcmp("h",key)==0||std::strcmp("help",key)==0){
help();
for(int j=0;j<CMDLINEMAX;j++){
if(!strcmp(argv[i],keys[j])){
keys[j][0]='\0';
}
if((argument=strchr(argv[i],'='))==NULL){
i++;
argument=argv[i];
}else{
argument++;
}
continue;
}
......@@ -193,6 +189,8 @@ static AssessmentRes assessment(char* video,char* gt_str, char* algorithms[],cha
int linecount=0;
Rect2d boundingBox;
vector<double> averageMillisPerFrame(algnum,0.0);
static int videoNum=0;
videoNum++;
FILE* gt=fopen(gt_str,"r");
if(gt==NULL){
......@@ -312,6 +310,11 @@ static AssessmentRes assessment(char* video,char* gt_str, char* algorithms[],cha
res.results[i][j]->assess(boundingBox,initBoxes[i]);
}
imshow( "Tracking API", image );
if(saveImageKey){
char inbuf[LINEMAX];
sprintf(inbuf,"image%d_%d.jpg",videoNum,frameCounter);
imwrite(inbuf,image);
}
if((frameCounter+1)>=ASSESS_TILL){
break;
......@@ -342,7 +345,11 @@ int main( int argc, char** argv ){
palette.push_back(Scalar(0,255,255));
int vcount=0,acount=0;
char* videos[CMDLINEMAX],*gts[CMDLINEMAX],*algorithms[CMDLINEMAX],*initBoxes[CMDLINEMAX][CMDLINEMAX];
parseCommandLineArgs(argc,argv,videos,gts,&vcount,algorithms,initBoxes,&acount);
char keys[CMDLINEMAX][LINEMAX];
strcpy(keys[0],"-s");
parseCommandLineArgs(argc,argv,videos,gts,&vcount,algorithms,initBoxes,&acount,keys);
saveImageKey=(keys[0][0]=='\0');
CV_Assert(acount<CMDLINEMAX && vcount<CMDLINEMAX);
printf("videos and gts\n");
for(int i=0;i<vcount;i++){
......
......@@ -48,7 +48,7 @@
using namespace cv;
namespace cv {namespace tld
namespace cv{namespace tld
{
int TLDEnsembleClassifier::getGridSize(){
return 15;
......
......@@ -53,7 +53,7 @@
#define NEG_EXAMPLES_IN_INIT_MODEL 300
#define MAX_EXAMPLES_IN_MODEL 500
#define MEASURES_PER_CLASSIFIER 13
#undef BLUR_AS_VADIM
#define BLUR_AS_VADIM
#undef CLOSED_LOOP
static const cv::Size GaussBlurKernelSize(3,3);
......@@ -66,12 +66,12 @@ using namespace tld;
* direct formula in resamples
* FIXME(issues)
* THETA_NN 0.5<->0.6 dramatic change vs video 6 !!
* FIXME(features)
* benchmark: save photos --> two streams of photos --> better video
* TODO(features)
* benchmark: two streams of photos --> better video
* (try inter_area for resize)
* TODO:
* schoolPC: codec, libopencv-dev
* fix pushbot ->pick commits -> compare_branches->all in 1->resubmit
* ||video(0.5<->0.6) --> debug if box size is less than 20 --> (remove ensemble self-loop) --> (try inter_area for resize)
* ||video(0.5<->0.6) --> debug if box size is less than 20
* perfect PN
*
* vadim:
......@@ -446,7 +446,9 @@ timeStampPositiveNext(0),timeStampNegativeNext(0),params_(params){
}
#ifdef BLUR_AS_VADIM
GaussianBlur(standardPatch,blurredPatch,GaussBlurKernelSize,0.0);
resize(standardPatch,blurredPatch,minSize);
GaussianBlur(blurredPatch,blurredPatch,GaussBlurKernelSize,0.0);
CV_Assert(blurredPatch.cols==minSize.width && blurredPatch.rows==minSize.height);
#else
resample(blurredImg,RotatedRect(center,size,angle),blurredPatch);
#endif
......@@ -767,17 +769,19 @@ int Pexpert::additionalExamples(std::vector<Mat_<uchar> >& examplesForModel,std:
size.height=(float)(closest[i].height*rng.uniform((double)0.99,(double)1.01));
float angle=(float)rng.uniform(-5.0,5.0);
#ifdef BLUR_AS_VADIM
GaussianBlur(standardPatch,blurredPatch,GaussBlurKernelSize,0.0);
#else
resample(blurredImg,RotatedRect(center,size,angle),blurredPatch);
#endif
resample(scaledImg,RotatedRect(center,size,angle),standardPatch);
for(int y=0;y<standardPatch.rows;y++){
for(int x=0;x<standardPatch.cols;x++){
standardPatch(x,y)+=(uchar)rng.gaussian(5.0);
}
}
#ifdef BLUR_AS_VADIM
resize(standardPatch,blurredPatch,initSize_);
GaussianBlur(blurredPatch,blurredPatch,GaussBlurKernelSize,0.0);
CV_Assert(blurredPatch.cols==initSize_.width && blurredPatch.rows==initSize_.height);
#else
resample(blurredImg,RotatedRect(center,size,angle),blurredPatch);
#endif
resample(scaledImg,RotatedRect(center,size,angle),standardPatch);
examplesForModel.push_back(standardPatch);
examplesForEnsemble.push_back(blurredPatch);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment