Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Assuming that the camera is fixed and known, and the pedestrians are walking on a flat plane, you can get the transformation matrix (and the positions of the objects) without complex calculations on the camera parameters.

The findhomography function will give you the transformation matrix from the image plane to another coordinate system.

Define two matrices of type Point2f: src contains some points in the image (pixel coordinates) and dst the geographical coordinates of the corresponding points. The function returns the H transformation matrix, so that :

C = H x P

where P is the coordinate of a pixel and C is the corresponding geographical coordinate.

Note, that this is valid only for the ground plane, so you have to detect the feet of pedestrians or the tyres of the cars. In the example image, if you check the head of the pedestrian, it will be considered too be on the sidewalk (near the pole), but its feet will give its correct position on the bike lane.

More information about findhomography: http://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html?highlight=findhomography#findhomography