mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-19 11:21:39 +08:00
commit
This commit is contained in:
@@ -133,7 +133,7 @@ void print_table(char* videos[],int videoNum,char* algorithms[],int algNum,const
|
|||||||
grid[0]=std::max(grid[0],(int)strlen(videos[i]));
|
grid[0]=std::max(grid[0],(int)strlen(videos[i]));
|
||||||
}
|
}
|
||||||
for(int i=0;i<algNum;i++){
|
for(int i=0;i<algNum;i++){
|
||||||
grid[i+1]=strlen(algorithms[i]);
|
grid[i+1]=(int)strlen(algorithms[i]);
|
||||||
for(int j=0;j<videoNum;j++)
|
for(int j=0;j<videoNum;j++)
|
||||||
grid[i+1]=std::max(grid[i+1],(int)strlen(results[j][i]));
|
grid[i+1]=std::max(grid[i+1],(int)strlen(results[j][i]));
|
||||||
}
|
}
|
||||||
@@ -199,11 +199,11 @@ private:
|
|||||||
};
|
};
|
||||||
AssessmentRes::AssessmentRes(int algnum):len(0),results(algnum){
|
AssessmentRes::AssessmentRes(int algnum):len(0),results(algnum){
|
||||||
for(int i=0;i<(int)results.size();i++){
|
for(int i=0;i<(int)results.size();i++){
|
||||||
if(!false){
|
#if !0
|
||||||
results[i].push_back(Ptr<Assessment>(new CorrectFrames(0.0)));
|
results[i].push_back(Ptr<Assessment>(new CorrectFrames(0.0)));
|
||||||
}else{
|
#else
|
||||||
results[i].push_back(Ptr<Assessment>(new CorrectFrames(0.5)));
|
results[i].push_back(Ptr<Assessment>(new CorrectFrames(0.5)));
|
||||||
}
|
#endif
|
||||||
results[i].push_back(Ptr<Assessment>(new PRF()));
|
results[i].push_back(Ptr<Assessment>(new PRF()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -295,7 +295,7 @@ static AssessmentRes assessment(char* video,char* gt_str, char* algorithms[],cha
|
|||||||
imshow( "Tracking API", image );
|
imshow( "Tracking API", image );
|
||||||
|
|
||||||
int frameCounter = 0;
|
int frameCounter = 0;
|
||||||
AssessmentRes res(trackers.size());
|
AssessmentRes res((int)trackers.size());
|
||||||
|
|
||||||
for ( ;; ){
|
for ( ;; ){
|
||||||
if( !paused ){
|
if( !paused ){
|
||||||
@@ -330,13 +330,15 @@ static AssessmentRes assessment(char* video,char* gt_str, char* algorithms[],cha
|
|||||||
rectangle( image, initBoxes[i], palette[i+1], 2, 1 );
|
rectangle( image, initBoxes[i], palette[i+1], 2, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!true && i==1){
|
#if !1
|
||||||
|
if(i==1){
|
||||||
printf("TLD\n");
|
printf("TLD\n");
|
||||||
printf("boundingBox=[%f,%f,%f,%f]\n",boundingBox.x,boundingBox.y,boundingBox.width,boundingBox.height);
|
printf("boundingBox=[%f,%f,%f,%f]\n",boundingBox.x,boundingBox.y,boundingBox.width,boundingBox.height);
|
||||||
printf("initBoxes[i]=[%f,%f,%f,%f]\n",initBoxes[i].x,initBoxes[i].y,initBoxes[i].width,initBoxes[i].height);
|
printf("initBoxes[i]=[%f,%f,%f,%f]\n",initBoxes[i].x,initBoxes[i].y,initBoxes[i].width,initBoxes[i].height);
|
||||||
printf("overlap=%f\n",overlap(initBoxes[i],boundingBox));
|
printf("overlap=%f\n",overlap(initBoxes[i],boundingBox));
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
for(int j=0;j<(int)res.results[i].size();j++)
|
for(int j=0;j<(int)res.results[i].size();j++)
|
||||||
res.results[i][j]->assess(boundingBox,initBoxes[i]);
|
res.results[i][j]->assess(boundingBox,initBoxes[i]);
|
||||||
|
@@ -58,7 +58,7 @@ static void onMouse( int event, int x, int y, int, void* )
|
|||||||
//draw the bounding box
|
//draw the bounding box
|
||||||
Mat currentFrame;
|
Mat currentFrame;
|
||||||
image.copyTo( currentFrame );
|
image.copyTo( currentFrame );
|
||||||
rectangle( currentFrame, Point( boundingBox.x, boundingBox.y ), Point( x, y ), Scalar( 255, 0, 0 ), 2, 1 );
|
rectangle( currentFrame, Point((int) boundingBox.x, (int)boundingBox.y ), Point( x, y ), Scalar( 255, 0, 0 ), 2, 1 );
|
||||||
imshow( "Tracking API", currentFrame );
|
imshow( "Tracking API", currentFrame );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -96,7 +96,7 @@ int main( int argc, char** argv ){
|
|||||||
|
|
||||||
int coords[4]={0,0,0,0};
|
int coords[4]={0,0,0,0};
|
||||||
bool initBoxWasGivenInCommandLine=false;
|
bool initBoxWasGivenInCommandLine=false;
|
||||||
do{
|
{
|
||||||
String initBoundingBox=parser.get<String>(3);
|
String initBoundingBox=parser.get<String>(3);
|
||||||
for(size_t npos=0,pos=0,ctr=0;ctr<4;ctr++){
|
for(size_t npos=0,pos=0,ctr=0;ctr<4;ctr++){
|
||||||
npos=initBoundingBox.find_first_of(',',pos);
|
npos=initBoundingBox.find_first_of(',',pos);
|
||||||
@@ -119,7 +119,7 @@ int main( int argc, char** argv ){
|
|||||||
if(coords[0]>0 && coords[1]>0 && coords[2]>0 && coords[3]>0){
|
if(coords[0]>0 && coords[1]>0 && coords[2]>0 && coords[3]>0){
|
||||||
initBoxWasGivenInCommandLine=true;
|
initBoxWasGivenInCommandLine=true;
|
||||||
}
|
}
|
||||||
}while(0);
|
}
|
||||||
|
|
||||||
//open the capture
|
//open the capture
|
||||||
VideoCapture cap;
|
VideoCapture cap;
|
||||||
|
@@ -199,8 +199,8 @@ double variance(Mat_<unsigned int>& intImgP,Mat_<unsigned int>& intImgP2,Rect bo
|
|||||||
}
|
}
|
||||||
|
|
||||||
double NCC(Mat_<uchar> patch1,Mat_<uchar> patch2){
|
double NCC(Mat_<uchar> patch1,Mat_<uchar> patch2){
|
||||||
CV_Assert(patch1.rows=patch2.rows);
|
CV_Assert(patch1.rows==patch2.rows);
|
||||||
CV_Assert(patch1.cols=patch2.cols);
|
CV_Assert(patch1.cols==patch2.cols);
|
||||||
|
|
||||||
int N=patch1.rows*patch1.cols;
|
int N=patch1.rows*patch1.cols;
|
||||||
double s1=sum(patch1)(0),s2=sum(patch2)(0);
|
double s1=sum(patch1)(0),s2=sum(patch2)(0);
|
||||||
|
@@ -772,8 +772,8 @@ Data::Data(Rect2d initBox){
|
|||||||
printf("initial box has size %dx%d, while both dimensions should be no less than %d\n",(int)initBox.width,(int)initBox.height,20);
|
printf("initial box has size %dx%d, while both dimensions should be no less than %d\n",(int)initBox.width,(int)initBox.height,20);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}*/
|
}*/
|
||||||
minSize.width=initBox.width*20.0/minDim;
|
minSize.width=(int)(initBox.width*20.0/minDim);
|
||||||
minSize.height=initBox.height*20.0/minDim;
|
minSize.height=(int)(initBox.height*20.0/minDim);
|
||||||
frameNum=0;
|
frameNum=0;
|
||||||
printf("minSize= %dx%d\n",minSize.width,minSize.height);
|
printf("minSize= %dx%d\n",minSize.width,minSize.height);
|
||||||
}
|
}
|
||||||
@@ -811,19 +811,19 @@ void MyMouseCallbackDEBUG::onMouse( int event, int x, int y){
|
|||||||
detector_->computeIntegralImages(resized_img,intImgP,intImgP2);
|
detector_->computeIntegralImages(resized_img,intImgP,intImgP2);
|
||||||
|
|
||||||
int dx=initSize.width/10, dy=initSize.height/10,
|
int dx=initSize.width/10, dy=initSize.height/10,
|
||||||
i=x/scale/dx, j=y/scale/dy;
|
i=(int)(x/scale/dx), j=(int)(y/scale/dy);
|
||||||
|
|
||||||
fprintf(stdout,"patchVariance=%s\n",(detector_->patchVariance(intImgP,intImgP2,originalVariance,Point(dx*i,dy*j),initSize))?"true":"false");
|
fprintf(stderr,"patchVariance=%s\n",(detector_->patchVariance(intImgP,intImgP2,originalVariance,Point(dx*i,dy*j),initSize))?"true":"false");
|
||||||
fprintf(stdout,"p=%f\n",(detector_->ensembleClassifierNum(&blurred_img.at<uchar>(dy*j,dx*i),blurred_img.step[0])));
|
fprintf(stderr,"p=%f\n",(detector_->ensembleClassifierNum(&blurred_img.at<uchar>(dy*j,dx*i),(int)blurred_img.step[0])));
|
||||||
fprintf(stdout,"ensembleClassifier=%s\n",
|
fprintf(stderr,"ensembleClassifier=%s\n",
|
||||||
(detector_->ensembleClassifier(&blurred_img.at<uchar>(dy*j,dx*i),blurred_img.step[0]))?"true":"false");
|
(detector_->ensembleClassifier(&blurred_img.at<uchar>(dy*j,dx*i),(int)blurred_img.step[0]))?"true":"false");
|
||||||
|
|
||||||
resample(resized_img,Rect2d(Point(dx*i,dy*j),initSize),standardPatch);
|
resample(resized_img,Rect2d(Point(dx*i,dy*j),initSize),standardPatch);
|
||||||
tmp=tldModel->Sr(standardPatch);
|
tmp=tldModel->Sr(standardPatch);
|
||||||
fprintf(stdout,"Sr=%f\n",tmp);
|
fprintf(stderr,"Sr=%f\n",tmp);
|
||||||
fprintf(stdout,"isObject=%s\n",(tmp>THETA_NN)?"true":"false");
|
fprintf(stderr,"isObject=%s\n",(tmp>THETA_NN)?"true":"false");
|
||||||
fprintf(stdout,"shouldBeIntegrated=%s\n",(abs(tmp-THETA_NN)<0.1)?"true":"false");
|
fprintf(stderr,"shouldBeIntegrated=%s\n",(abs(tmp-THETA_NN)<0.1)?"true":"false");
|
||||||
fprintf(stdout,"Sc=%f\n",tldModel->Sc(standardPatch));
|
fprintf(stderr,"Sc=%f\n",tldModel->Sc(standardPatch));
|
||||||
|
|
||||||
rectangle(imgCanvas,Rect2d(Point2d(scale*dx*i,scale*dy*j),Size2d(initSize.width*scale,initSize.height*scale)), 0, 2, 1 );
|
rectangle(imgCanvas,Rect2d(Point2d(scale*dx*i,scale*dy*j),Size2d(initSize.width*scale,initSize.height*scale)), 0, 2, 1 );
|
||||||
imshow("picker",imgCanvas);
|
imshow("picker",imgCanvas);
|
||||||
|
Reference in New Issue
Block a user