Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Knowing the acquisition frequency, you must now find the distance between the successive positions of the marker.</p> <p>To find this distance, I suggest you estimate the <em>pose</em> of the marker for each image. Loosely speaking, the "pose" is the transformation matrix expressing the coordinates of an object relative to a camera. Once you have those successive coordinates, you can compute the distance, and then the speed.</p> <p>Pose estimation is the process of computing the position and orientation of a <strong>known</strong> 3D object relative to a 2D camera. The resulting pose is the transformation matrix describing the object's referential in the camera's referential.</p> <p><img src="https://i.stack.imgur.com/4DwCu.png" alt="Pose description"></p> <p>OpenCV implements a pose estimation algorithm: <strong><a href="http://opencv.willowgarage.com/wiki/Posit" rel="noreferrer">Posit</a></strong>. The doc says:</p> <blockquote> <p>Given some 3D points (in object coordinate system) of the object, at least four non-coplanar points, their corresponding 2D projections in the image, and the focal length of the camera, the algorithm is able to estimate the object's pose.</p> </blockquote> <p>This means:</p> <ol> <li>You must know the focal length of your camera</li> <li>You must know the geometry of your marker</li> <li>You must be able to match four know points of your marker in the 2D image</li> </ol> <p>You may have to compute the focal length of the camera using the <a href="http://opencv.willowgarage.com/documentation/python/camera_calibration_and_3d_reconstruction.html" rel="noreferrer">calibration routines</a> provided by OpenCV. I think you have the two other required data.</p> <p><strong>Edit:</strong></p> <pre><code>// Algorithm example MarkerCoords = {Four coordinates of know 3D points} I1 = take 1st image F1 = focal(I1) MarkerPixels1 = {Matching pixels in I1} Pose1 = posit(MarkerCoords, MarkerPixels1, F1) I2 = take 2nd image F2 = focal(I2) MarkerPixels2 = {Matching pixels in I2 by optical flow} Pose2 = posit(MarkerCoords, MarkerPixels2, F2) o1 = origin_of_camera * Pose1 // Origin of camera is o2 = origin_of_camera * Pose2 // typically [0,0,0] dist = euclidean_distance(o1, o2) speed = dist/frequency </code></pre> <p><strong>Edit 2:</strong> (Answers to comments)</p> <blockquote> <p>"What is the acquisition frequency?"</p> </blockquote> <p>Computing the speed of your vehicle is equivalent to computing the speed of the marker. (In the first case, the referential is the marker attached to the earth, in the second case, the referential is the camera attached to the vehicle.) This is expressed by the following equation:</p> <pre><code>speed = D/(t2-t1) </code></pre> <p>With:</p> <ul> <li><code>D</code> the distance <code>[o1 o2]</code></li> <li><code>o1</code> the position of the marker at time <code>t1</code></li> <li><code>o2</code> the position of the marker at time <code>t2</code></li> </ul> <p>You can retrieve the elapsed time either by extracting <code>t1</code> and <code>t2</code> from the metadata of your photos, or from the <em>acquisition frequency</em> of your imaging device: <code>t2-t1 = T = 1/F</code>.</p> <blockquote> <p>"Won't it be better to mark simple things like posters? And if doing so can't we consider it as a 2d object?"</p> </blockquote> <p>This is not possible with the Posit algorithm (or with any other pose estimation algorithm as far as I know): it requires four <strong>non-coplanar</strong> points. This means you cannot chose a 2D object embedded in a 3D space, you have to chose an object with some depth.</p> <p>On the other hand, you can use a <em>really</em> simple shape, as far as it is a volume. (A cube for example.)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload