Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

one big bug in code #14

Open
zttkkk opened this issue Jul 17, 2012 · 3 comments
Open

one big bug in code #14

zttkkk opened this issue Jul 17, 2012 · 3 comments

Comments

@zttkkk
Copy link

zttkkk commented Jul 17, 2012

tracker.filterPts()
It should be written this way:

//before using this function,points whose status is false has already been filted.
bool LKTracker::filterPts(vec_POINT2F *pts1,vec_POINT2F *pts2)
{
short i,a;
short n = pts2->size;

//计算FBerror和ncc的中值
medNCC = median(&similarity);
medFB = median(&FB_error);

//过滤掉相似度较低的那一半
for( i=a=0; i<n; ++i )
{
    if( vec_at(similarity,i) < medNCC || vec_at(FB_error,i) > medFB )
        continue;

    vec_at(*pts1,a) = vec_at(*pts1,i);
    vec_at(*pts2,a) = vec_at(*pts2,i);
    vec_at(FB_error,a) = vec_at(FB_error,i);
    a++;
}

vec_POINT2F_resize(pts1,a);
vec_POINT2F_resize(pts2,a);

if (a>0)
    return true;
else
    return false;

}

Check ZK's code,then you will know I'm right

@arthurv
Copy link
Collaborator

arthurv commented Jul 17, 2012

Hi, thanks for pointing this out. Can you open a push request in github for
this patch?
On Jul 17, 2012 9:56 AM, "zttkkk" <
reply@reply.github.com>
wrote:

tracker.filterPts()
It should be written this way:

//before using this function,points whose status is false has already been
filted.
bool LKTracker::filterPts(vec_POINT2F *pts1,vec_POINT2F *pts2)
{
short i,a;
short n = pts2->size;

    //计算FBerror和ncc的中值
    medNCC = median(&similarity);
    medFB = median(&FB_error);

    //过滤掉相似度较低的那一半
    for( i=a=0; i<n; ++i )
    {
    if(     vec_at(similarity,i) < medNCC || vec_at(FB_error,i) >

medFB )
continue;

            vec_at(*pts1,a) = vec_at(*pts1,i);
            vec_at(*pts2,a) = vec_at(*pts2,i);
            vec_at(FB_error,a) = vec_at(FB_error,i);
            a++;
}

    vec_POINT2F_resize(pts1,a);
    vec_POINT2F_resize(pts2,a);

    if (a>0)
            return true;
    else
            return false;

}

Check ZK's code,then you will know I'm right


Reply to this email directly or view it on GitHub:
#14

@arthurv
Copy link
Collaborator

arthurv commented Jul 17, 2012

I meant pull request, sorry
On Jul 17, 2012 9:56 AM, "zttkkk" <
reply@reply.github.com>
wrote:

tracker.filterPts()
It should be written this way:

//before using this function,points whose status is false has already been
filted.
bool LKTracker::filterPts(vec_POINT2F *pts1,vec_POINT2F *pts2)
{
short i,a;
short n = pts2->size;

    //计算FBerror和ncc的中值
    medNCC = median(&similarity);
    medFB = median(&FB_error);

    //过滤掉相似度较低的那一半
    for( i=a=0; i<n; ++i )
    {
    if(     vec_at(similarity,i) < medNCC || vec_at(FB_error,i) >

medFB )
continue;

            vec_at(*pts1,a) = vec_at(*pts1,i);
            vec_at(*pts2,a) = vec_at(*pts2,i);
            vec_at(FB_error,a) = vec_at(FB_error,i);
            a++;
}

    vec_POINT2F_resize(pts1,a);
    vec_POINT2F_resize(pts2,a);

    if (a>0)
            return true;
    else
            return false;

}

Check ZK's code,then you will know I'm right


Reply to this email directly or view it on GitHub:
#14

@zttkkk
Copy link
Author

zttkkk commented Jul 17, 2012

arthurv,I am a new user of github,so I don't know how to "pull a request".I hope you to do that.
By the way,my code is not easy to understand,for example I use vec_POINT2F instead of std::vectorcv::Point.
That's because I translate your C++ code to pure C, in my work I use some trick to simulate the STL container vector.
And vec_POINT2F is that thing,you can take it just like vector
I believe you have already understand where the bug is,so let others know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants