Skip to content

Commit

Permalink
asdasdasd
Browse files Browse the repository at this point in the history
  • Loading branch information
lpierezan committed Jul 1, 2011
1 parent 3638a2b commit 8028dc1
Show file tree
Hide file tree
Showing 8 changed files with 2,033 additions and 12 deletions.
Binary file added arquivoTeste/testeImg17.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added arquivoTeste/testeImg18.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added arquivoTeste/testeImg19.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2,004 changes: 2,004 additions & 0 deletions out

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/hough.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pair<double,double> calcThetaRange(double dx,double dy,double delta = 2*pi){

void houghC1(Mat &gray, int minr, int maxr , int cannyt, vector<acmPoint> &output, unsigned int thNCirc, double thVNorm){
Mat edges,Ix,Iy;
double deltaTheta = 0.79/2; // 45 graus
double deltaTheta = 0.79/2; // 45/2 graus
int i,j,rad;
pair<double,double> dTheta;
set<acmPoint> outputMinHeap;
Expand Down
30 changes: 21 additions & 9 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,20 @@

void video_mode(char file[]) {

/*"./arquivoTeste/pass.flv" "./arquivoTeste/embx.flv"*/
int globalMaxR,globalMinR;
double thRestart;

printf("Digite minr maxr e thRestart ou -1 para valores padrões\n");
scanf(" %d",&globalMinR);
if(globalMinR == -1){
globalMinR = 5;
globalMaxR = 30;
thRestart = 0.48;
}else{
scanf(" %d %lf",&globalMaxR,&thRestart);
}


VideoCapture cap(file);
if(!cap.isOpened())
exit(1);
Expand All @@ -13,14 +26,11 @@ void video_mode(char file[]) {
bool firstFrame = true;
Rect roiRect,newRoiRect;
acmPoint ballAt,newBall;

double thRestart = 0.35; //0.35;

int countRestart = 0;

int globalMinR=5,globalMaxR=30;
Rect inicRoi(130,175,25,25);

//Flags
bool fAcertou = false;
bool fPause = true;
Expand All @@ -29,19 +39,21 @@ void video_mode(char file[]) {

while(1)
{

cap >> frame;

if(!cap.grab()) break;
cap.retrieve(frame,0);


if(firstFrame){
trackBall(grayAnt,frame,inicRoi,acmPoint(),newBall,newRoiRect,globalMinR,globalMaxR,false, fAcertou);
trackBall(grayAnt,frame,inicRoi,acmPoint(),newBall,newRoiRect,globalMinR,globalMaxR,true, fAcertou);
}else{

if(ballAt.score_final < thRestart){
countRestart++;
}else countRestart = 0;


if(countRestart == 4){
if(countRestart == 5){
trackBall(grayAnt,frame,roiRect,ballAt,newBall,newRoiRect,globalMinR,globalMaxR,true, fAcertou);
countRestart = 0;
}
Expand Down
7 changes: 6 additions & 1 deletion src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ struct acmPoint{
inic = true;
}

void calculaScore(){ score_final = 0.2 * vnorm + 0.8 * vhistograma; }
void calculaScore(){
if(rad < 5)
score_final = 0.4 * vnorm + 0.6 * vhistograma;
else
score_final = 0.2 * vnorm + 0.8 * vhistograma;
}

inline bool operator< (const acmPoint &p) const{
return (score_final < p.score_final);
Expand Down
2 changes: 1 addition & 1 deletion src/roi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void trackBall(const Mat &frameAtual, Mat &frameFuturo,const Rect &ROIat,const a
int minr, int maxr, bool firstTime, bool filtraHistograma){
int deltaR=1;
int limMinR = 2;
double roiScale=3;
double roiScale=4;
Rect roiRect;
Mat frameFuturoGray;

Expand Down

0 comments on commit 8028dc1

Please sign in to comment.