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

function phaseUpwrapper3 doesn't initailize variable 'ind_min' 'ind_second' before used #3

Open
liwenjian12 opened this issue Oct 11, 2019 · 1 comment

Comments

@liwenjian12
Copy link

Hi, there!below is your code,i don't if i misunderstanding ,something seems to be wrong for vaviable 'int_min,ind_second',and what does it mean!
thank you for you time!

void phaseUnWrapper3(float t0, float t1,float t2, float* phase_first, float* phase_second, float* phase_third, float* err_w1, float* err_w2, float* err_w3)
{
float err;
float err1,err2,err3;

    float w1 = 1.0f;
    float w2 = 10.0f;
    float w3 = 1.0218f;

    float err_min=100000.0f;
    float err_min_second = 200000.0f;
    float err_min_third = 300000.0f;
    unsigned int ind_min, ind_second, ind_third;

    float k,n,m;

    for(int i=0; i<30; i++)
    {
	    m = m_list[i];
	    n = n_list[i];
	    k = k_list[i];
	    calcErr(k,n,m,t0,t1,t2,&err1,&err2,&err3);
	    err = w1*err1*err1+w2*err2*err2+w3*err3*err3;
	    if(err<err_min)
	    {
		    err_min_third = err_min_second;
		    ind_third = ind_second;
		    err_min_second = err_min;
		    ind_second = ind_min;
		    err_min = err;
		    ind_min = i;

	    }
@felja633
Copy link
Owner

I admit this piece of code is ugly. It is simply goes through all phase unwrapping hypotheses and rank the three with the lowest error. I guess you could instead loop through and compute all the errors and then sort them afterwards...

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