Attention! This forum will be made read-only by Dec-20. Please migrate to Most of existing active users should've received invitation by e-mail.
Ask Your Question

Can OpenCV be utilized to take dimensions of a shipping package

asked 2016-12-15 07:11:07 -0500

We are trying to simplify the measurements of shipping packages for UPS & Fedex. Can OpenCV use an image to calculate Length Width and Height of a package from an image taken on a Android Device?

edit retag flag offensive close merge delete


it's nothing special to opencv, but with a single (calibrated) camera, you can only calculate the size of an object, if you know the distance (and vice versa). see pinhole model

berak gravatar imageberak ( 2016-12-15 08:09:30 -0500 )edit

Thanks is there an existing program that does this that I can tap into?

qfaison gravatar imageqfaison ( 2016-12-15 09:40:36 -0500 )edit

no idea, sorry. how do you plan to solve above problem ?

opencv can help you with the calibration, and with finding the (pixel) contours of your target.

(next problem is: after a calibration, you must not change the focus, ever, which might be almost impossible on a phone, where you can't control that)

berak gravatar imageberak ( 2016-12-15 09:59:57 -0500 )edit

So my thoughts would be to have a stationary camera on a pole over the Shipping Scale that would take the exact same photo from the exact same distance every time. If I can have a program that would calculate the dimensions then I could record it in our web based system which would be good enough... Just need the program Any help is greatly appreciated

qfaison gravatar imageqfaison ( 2016-12-15 10:15:06 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-12-15 20:11:30 -0500

Tetragramm gravatar image

If you're using one camera, you use OpenCV to calibrate the camera, and the rest is straight geometry.

THIS tutorial is how to calibrate the camera.

THIS function gets you field of view in degrees.

You have an angle, and a known distance. All else is triangles.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-12-15 07:11:07 -0500

Seen: 128 times

Last updated: Dec 15 '16