Calculating 2D Dimensions on Object using ArUco

what on earth are you doing there?

detector is entirely undefined. I don’t see a camera matrix.

you’re just drawing stuff back into the picture and getting contours. of course that’ll show the projections of any markers, and those will look as they are supposed to, if they’re angled.

aruco has pose estimation, which is what you want.

you also might want to read about “homography”… and why that only applies to plane-plane mapping.