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

Fix bounding box canvas rect #1

Closed
ArmaanAS opened this issue May 12, 2021 · 0 comments
Closed

Fix bounding box canvas rect #1

ArmaanAS opened this issue May 12, 2021 · 0 comments

Comments

@ArmaanAS
Copy link

Width and height should be be renamed to a and b as it the position of the bottom right corner.

const [y,x,height,width] = boxes[i]

const [y,x,b,a] = boxes[i]; 

Also we can fix this canvas rect draw as it currently draws a box with the wrong width and height. The function takes the top left x, y and a width, height.

ctx.rect(x*imgWidth, y*imgHeight, width*imgWidth/2, height*imgHeight/2);

ctx.rect(
  x * imgWidth, 
  y * imgHeight, 
  (a - x) * imgWidth, 
  (b - y) * imgHeight
); 
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