Skip to content

about complexDotDivision function #63

Description

@lq0104

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 :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions