mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-20 04:25:42 +08:00
blur bug
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
|
|
||||||
#define CMDLINEMAX 10
|
#define CMDLINEMAX 30
|
||||||
#define ASSESS_TILL 100
|
#define ASSESS_TILL 100
|
||||||
#define LINEMAX 40
|
#define LINEMAX 40
|
||||||
|
|
||||||
@@ -20,7 +20,8 @@ using namespace cv;
|
|||||||
|
|
||||||
static Mat image;
|
static Mat image;
|
||||||
static bool paused;
|
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);
|
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);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
static void parseCommandLineArgs(int argc, char** argv,char* videos[],char* gts[],
|
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;
|
*ac=*vc=0;
|
||||||
for(int i=1;i<argc;i++){
|
for(int i=1;i<argc;i++){
|
||||||
if(argv[i][0]=='-'){
|
if(argv[i][0]=='-'){
|
||||||
char *key=(argv[i]+1),*argument=NULL;
|
for(int j=0;j<CMDLINEMAX;j++){
|
||||||
if(std::strcmp("h",key)==0||std::strcmp("help",key)==0){
|
if(!strcmp(argv[i],keys[j])){
|
||||||
help();
|
keys[j][0]='\0';
|
||||||
}
|
}
|
||||||
if((argument=strchr(argv[i],'='))==NULL){
|
|
||||||
i++;
|
|
||||||
argument=argv[i];
|
|
||||||
}else{
|
|
||||||
argument++;
|
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -193,6 +189,8 @@ static AssessmentRes assessment(char* video,char* gt_str, char* algorithms[],cha
|
|||||||
int linecount=0;
|
int linecount=0;
|
||||||
Rect2d boundingBox;
|
Rect2d boundingBox;
|
||||||
vector<double> averageMillisPerFrame(algnum,0.0);
|
vector<double> averageMillisPerFrame(algnum,0.0);
|
||||||
|
static int videoNum=0;
|
||||||
|
videoNum++;
|
||||||
|
|
||||||
FILE* gt=fopen(gt_str,"r");
|
FILE* gt=fopen(gt_str,"r");
|
||||||
if(gt==NULL){
|
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]);
|
res.results[i][j]->assess(boundingBox,initBoxes[i]);
|
||||||
}
|
}
|
||||||
imshow( "Tracking API", image );
|
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){
|
if((frameCounter+1)>=ASSESS_TILL){
|
||||||
break;
|
break;
|
||||||
@@ -342,7 +345,11 @@ int main( int argc, char** argv ){
|
|||||||
palette.push_back(Scalar(0,255,255));
|
palette.push_back(Scalar(0,255,255));
|
||||||
int vcount=0,acount=0;
|
int vcount=0,acount=0;
|
||||||
char* videos[CMDLINEMAX],*gts[CMDLINEMAX],*algorithms[CMDLINEMAX],*initBoxes[CMDLINEMAX][CMDLINEMAX];
|
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);
|
CV_Assert(acount<CMDLINEMAX && vcount<CMDLINEMAX);
|
||||||
printf("videos and gts\n");
|
printf("videos and gts\n");
|
||||||
for(int i=0;i<vcount;i++){
|
for(int i=0;i<vcount;i++){
|
||||||
|
@@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
|
||||||
namespace cv {namespace tld
|
namespace cv{namespace tld
|
||||||
{
|
{
|
||||||
int TLDEnsembleClassifier::getGridSize(){
|
int TLDEnsembleClassifier::getGridSize(){
|
||||||
return 15;
|
return 15;
|
||||||
|
@@ -53,7 +53,7 @@
|
|||||||
#define NEG_EXAMPLES_IN_INIT_MODEL 300
|
#define NEG_EXAMPLES_IN_INIT_MODEL 300
|
||||||
#define MAX_EXAMPLES_IN_MODEL 500
|
#define MAX_EXAMPLES_IN_MODEL 500
|
||||||
#define MEASURES_PER_CLASSIFIER 13
|
#define MEASURES_PER_CLASSIFIER 13
|
||||||
#undef BLUR_AS_VADIM
|
#define BLUR_AS_VADIM
|
||||||
#undef CLOSED_LOOP
|
#undef CLOSED_LOOP
|
||||||
static const cv::Size GaussBlurKernelSize(3,3);
|
static const cv::Size GaussBlurKernelSize(3,3);
|
||||||
|
|
||||||
@@ -66,12 +66,12 @@ using namespace tld;
|
|||||||
* direct formula in resamples
|
* direct formula in resamples
|
||||||
* FIXME(issues)
|
* FIXME(issues)
|
||||||
* THETA_NN 0.5<->0.6 dramatic change vs video 6 !!
|
* THETA_NN 0.5<->0.6 dramatic change vs video 6 !!
|
||||||
* FIXME(features)
|
* TODO(features)
|
||||||
* benchmark: save photos --> two streams of photos --> better video
|
* benchmark: two streams of photos --> better video
|
||||||
|
* (try inter_area for resize)
|
||||||
* TODO:
|
* TODO:
|
||||||
* schoolPC: codec, libopencv-dev
|
|
||||||
* fix pushbot ->pick commits -> compare_branches->all in 1->resubmit
|
* 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
|
* perfect PN
|
||||||
*
|
*
|
||||||
* vadim:
|
* vadim:
|
||||||
@@ -446,7 +446,9 @@ timeStampPositiveNext(0),timeStampNegativeNext(0),params_(params){
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BLUR_AS_VADIM
|
#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
|
#else
|
||||||
resample(blurredImg,RotatedRect(center,size,angle),blurredPatch);
|
resample(blurredImg,RotatedRect(center,size,angle),blurredPatch);
|
||||||
#endif
|
#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));
|
size.height=(float)(closest[i].height*rng.uniform((double)0.99,(double)1.01));
|
||||||
float angle=(float)rng.uniform(-5.0,5.0);
|
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 y=0;y<standardPatch.rows;y++){
|
||||||
for(int x=0;x<standardPatch.cols;x++){
|
for(int x=0;x<standardPatch.cols;x++){
|
||||||
standardPatch(x,y)+=(uchar)rng.gaussian(5.0);
|
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);
|
examplesForModel.push_back(standardPatch);
|
||||||
examplesForEnsemble.push_back(blurredPatch);
|
examplesForEnsemble.push_back(blurredPatch);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user