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

which point was got from bbox? #2

Open
lishi8168797 opened this issue Mar 7, 2022 · 0 comments
Open

which point was got from bbox? #2

lishi8168797 opened this issue Mar 7, 2022 · 0 comments

Comments

@lishi8168797
Copy link

hello,I can not view your blog at http://imagingsolution.blog107.fc2.com/blog-entry-137.html,but I want to know which point was got from bbox in this code.

VectorXd getCpFromBbox(PointCloud bBox){
PointXYZ p1 = bBox[0];
PointXYZ p2 = bBox[1];
PointXYZ p3 = bBox[2];
PointXYZ p4 = bBox[3];

double S1 = ((p4.x -p2.x)*(p1.y - p2.y) - (p4.y - p2.y)*(p1.x - p2.x))/2;
double S2 = ((p4.x -p2.x)*(p2.y - p3.y) - (p4.y - p2.y)*(p2.x - p3.x))/2;
double cx = p1.x + (p3.x-p1.x)*S1/(S1+S2);
double cy = p1.y + (p3.y-p1.y)*S1/(S1+S2);

VectorXd cp(2);
cp << cx, cy;
return cp;

}

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