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

about complexDotDivision function #63

Open
lq0104 opened this issue Nov 22, 2019 · 0 comments
Open

about complexDotDivision function #63

lq0104 opened this issue Nov 22, 2019 · 0 comments

Comments

@lq0104
Copy link

lq0104 commented Nov 22, 2019

Hi @rockkingjy thx for your sharing great work. I have a question about the "complexDotDivision" function. In my opinion, if a and b are two complex,
a = a0 + a1i
b = b0 + b1i
then a/b = (a0 + a1i) / (b0 + b1i)
= [(a0 + a1i)(b0 - b1i)] / [(b0 + b1i) (b0 - b1i)]
=[(a0
b0+a1
b1)+(a1b0-a0b1)i] / (b0^2+b1^2)

and I look your code is:
cv::Mat divisor = 1. / (pb[0].mul(pb[0]) + pb[1].mul(pb[1]));
std::vectorcv::Mat pres;
pres.push_back((pa[0].mul(pb[0]) + pa[1].mul(pb[1])).mul(divisor));
pres.push_back((pa[1].mul(pb[0]) + pa[0].mul(pb[1])).mul(divisor));

I think the last row code:
pres.push_back((pa[1].mul(pb[0]) + pa[0].mul(pb[1])).mul(divisor));
should be:
pres.push_back((pa[1].mul(pb[0]) - pa[0].mul(pb[1])).mul(divisor));

and I watch some realistic value about "pa[0].mul(pb[1])", they are nearly zeros, so the sign '+' or '-' doesn't matter. How do you think of it :)

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

1 participant