How to detect object is perpendicular to camera optical axis?

asked 2018-04-04 03:57:52 -0500

I want to detect whether object is perpendicular to optical axis.

image description

Sample input will be an image that has and object (cylinder shape similar to a bottle) in it and a mostly plain background.

Output will be a boolean determining whether that object is perpendicular to camera axis. This does not require to have much accuracy.

For example following image is not perpendicular to camera axis

image description

Following image is not perpendicular too because camera angle is little bit from above

image description

Next image is perpendicular and in the correct position

image description

Is there any algorithm in OpenCV to do this?

edit retag flag offensive close merge delete

Comments

this might work for the xy plane

(and note, that it's probably impossible for objects in the yz plane, with a single camera)

berak gravatar imageberak ( 2018-04-04 04:12:01 -0500 )edit

In a video for a fixed distance I would say when visible surface is minimum

LBerger gravatar imageLBerger ( 2018-04-04 04:28:54 -0500 )edit
1

First, it is necessary to define the concept "perpendicular". For planar objects it is obvious. All your examples are cylindrical. Also just elongated objects may be considered as a generalization. For all of them you need to determine the central axis (one straight line) and talk about perpendicularity of this line. It may be tricky if the camera doesn't look right at the object. If it does, I think that this task has no solution in general case. For example, how will you tell a perpendicular cone from turned cylinder? That is, you need the shape of the object.

ya_ocv_user gravatar imageya_ocv_user ( 2018-04-04 07:55:08 -0500 )edit

@chamoda, may i ask,which problem you're trying to solve in the "real world" with this ?

berak gravatar imageberak ( 2018-04-05 02:32:55 -0500 )edit
1

@berak Doing some analytics on core samples https://en.wikipedia.org/wiki/Core_sa... . Trying to take a photo and analize the image for some features.

chamoda gravatar imagechamoda ( 2018-04-05 02:38:47 -0500 )edit

but then your images are misleading.

without proper context, anyone is solving an XY problem

berak gravatar imageberak ( 2018-04-05 02:44:21 -0500 )edit