0

I'm overlaying images on the cameraView and based on the user input of room width & height. The images are displaying proportionally to width & height ratio. but i need to overlay the images based on the distance. If 5feet means, then i need to display the images closer, if it's 8ft means i need to overlay images littlebit far. I referred these links https://stackoverflow.com/questions/11913355/scaling-ar-pictures-based-on-the-distance-from-the-camera , https://stackoverflow.com/questions/13190932/how-to-find-out-focal-length-of-camera-in-ios-and-what-is-the-sensor-height?lq=1. But the result size is too small.

int imagesize_height = (152.4*199)/0.33;

 int imagesize_width = (152.4*350)/0.33;

distance in cm = 152.4 and ipadMini camera focal length is 3.3mm = 0.33cm, image width is 350 & height is 199

  • 3
    I'm voting to close this question as off-topic because it's a programming question that should be on Stack Overflow (but it's too old to be migrated) – null Apr 15 '16 at 18:53
  • Focal length reported by a camera may not be accurate enough for resizing an overlay, even if it appears to have enough precision. – Mark Ransom Jan 23 '18 at 18:38
  • 5
    I'm voting to close this question as off-topic because three years later, it's still an off-topic programming question :) – mattdm Oct 21 '18 at 1:10
  • I'm voting to close this question as off-topic because it's a programming question that should be on Stack Overflow. – scottbb Dec 19 '18 at 22:46
  • 1
    I'm voting to close this question as off-topic because it is still off topic – mattdm Apr 18 at 23:03
0

Depending on the INT_MAX your variables may overflow significantly. INT_MAX being 32768 is not uncommon at all.

int imagesize_height = (152.4*199)/0.33=91901,818181818181818181818181818

int imagesize_width = (152.4*350)/0.33=161636,36363636363636363636363636

  • 1. int on iOS devices is 4 bytes, so INT_MAX is 2147483647. 2. Although one always needs to be aware of overflow, that's not what the OP is asking about here. – Caleb Apr 16 '16 at 7:41
  • @caleb: 2) "But the result size is too small." - OP asks about the reason of something being too small. This could be because of overflow. I wonder about why this question is still here, it belong to SO obviously. – Euri Pinhollow Apr 16 '16 at 7:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.