Ask Your Question
0

Is there anyway we can find distance between the object and single mobile camera using opencv?

asked 2017-03-01 05:35:10 -0600

AJ94 gravatar image

Hi all, I need to find the distance between object and mobile camera using opencv.

I am currently working on foreground extraction algorithm using opencv and python. The object is extracted completely, if the distance between the object and mobile camera is within some specific range. I am trying to display that range on the UI. Is there any opencv api available which can calculate the distance between the object and mobile camera?

edit retag flag offensive close merge delete

Comments

May be you can search something about "laser ranging".

jsxyhelu gravatar imagejsxyhelu ( 2017-03-01 08:38:39 -0600 )edit

@AJ94 Do you know obect size in meter?

LBerger gravatar imageLBerger ( 2017-03-01 09:07:22 -0600 )edit

@LBerger Currently i do not know the size of the object. But assuming it to be 0.2 meters,is there any way i can get the distance?

AJ94 gravatar imageAJ94 ( 2017-03-01 21:51:02 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-03-02 19:06:49 -0600

Tetragramm gravatar image

If you know the geometry of the object (ie, the locations of at least 4 visible points relative to each other) (more is better), then you can use solvePnP to get the orientation and distance.

If you know the camera's position and orientation in space from another data source, and can take multiple images from different positions, you can solve to get the distance.

If you spend a lot of computing power and build a structure from motion model of the scene, you can get the distance up to a scale factor. IE, you know it's 10.5 units, but you don't know how big the units are unless there's something in the scene you know the size of to use as a reference.

edit flag offensive delete link more

Comments

Thanks a lot @Tetragramm. There are lot of external applications available which can give me the dimensions of the object. I already have the range for some fixed dimensions. Then by taking ratio, i can get the range for different objects.

AJ94 gravatar imageAJ94 ( 2017-03-02 23:25:18 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-03-01 05:35:10 -0600

Seen: 614 times

Last updated: Mar 02 '17