Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>OpenCV (and with it the python Opencv binding) has a <a href="http://opencv.willowgarage.com/documentation/cpp/feature_detection.html#stardetector" rel="nofollow">StarDetector</a> class which implements <a href="http://www.springerlink.com/content/ngx06074r126x362/" rel="nofollow">this algorithm</a>.</p> <p>As an alternative you might have a look at the OpenCV <a href="http://opencv.itseez.com/modules/features2d/doc/feature_detection_and_description.html#sift" rel="nofollow">SIFT</a> class, which stands for Scale Invariant Feature Transform.</p> <p><strong>Update</strong></p> <p>Regarding your comment, I understand that the "right" transformation will maximize the cross-correlation between the images, but I don't understand how you choose the set of transformations over which to maximize. Maybe if you know the coordinates of three matching points (either by some heuristics or by choosing them by hand), and if you expect affinity, you could use something like <a href="http://opencv.willowgarage.com/documentation/cpp/imgproc_geometric_image_transformations.html#cv-getaffinetransform" rel="nofollow">cv2.getAffineTransform</a> to have a good initial transformation for your maximization process. From there you could use small additional transformations to have a set over which to maximize. But this approach seems to me like re-inventing something which SIFT could take care of.</p> <p>To actually transform your test image you can use <a href="http://opencv.willowgarage.com/documentation/cpp/imgproc_geometric_image_transformations.html#cv-warpaffine" rel="nofollow">cv2.warpAffine</a>, which also can take care of border values (e.g. pad with 0). To calculate the cross-correlation you could use <a href="http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.correlate2d.html#scipy.signal.correlate2d" rel="nofollow">scipy.signal.correlate2d</a>.</p> <p><strong>Update</strong></p> <p>Your latest update did indeed clarify some points for me. But I think that a vector field of displacements is not the most natural thing to look for, and this is also where the misunderstanding came from. I was thinking more along the lines of a <strong>global</strong> transformation T, which applied to any point (x,y) of the left image gives (x',y')=T(x,y) on the right side, but T has the same analytical form for every pixel. For example, this could be a combination of a displacement, rotation, scaling, maybe some perspective transformation. I cannot say whether it is realistic or not to hope to find such a transformation, this depends on your setup, but if the scene is physically the same on both sides I would say it is reasonable to expect some affine transformation. This is why I suggested <a href="http://opencv.willowgarage.com/documentation/cpp/imgproc_geometric_image_transformations.html#cv-getaffinetransform" rel="nofollow">cv2.getAffineTransform</a>. It is of course trivial to calculate your displacement Vector field from such a T, as this is just T(x,y)-(x,y).</p> <p>The big advantage would be that you have only very few degrees of freedom for your transformation, instead of, I would argue, 2N degrees of freedom in the displacement vector field, where N is the number of bright spots.</p> <p>If it is indeed an affine transformation, I would suggest some algorithm like this:</p> <ul> <li>identify three bright and well isolated spots on the left</li> <li>for each of these three spots, define a bounding box so that you can hope to identify the corresponding spot within it in the right image</li> <li>find the coordinates of the corresponding spots, e.g. with some correlation method as implemented in <a href="http://opencv.itseez.com/modules/imgproc/doc/object_detection.html?highlight=matchtemplate#cv2.matchTemplate" rel="nofollow">cv2.matchTemplate</a> or by also just finding the brightest spot within the bounding box.</li> <li>once you have three matching pairs of coordinates, calculate the affine transformation which transforms one set into the other with <a href="http://opencv.willowgarage.com/documentation/cpp/imgproc_geometric_image_transformations.html#cv-getaffinetransform" rel="nofollow">cv2.getAffineTransform</a>.</li> <li>apply this affine transformation to the left image, as a check if you found the right one you could calculate if the overall normalized cross-correlation is above some threshold or drops significantly if you displace one image with respect to the other.</li> <li>if you wish and still need it, calculate the displacement vector field trivially from your transformation T.</li> </ul> <p><strong>Update</strong></p> <p>It seems <a href="http://opencv.willowgarage.com/documentation/cpp/imgproc_geometric_image_transformations.html#cv-getaffinetransform" rel="nofollow">cv2.getAffineTransform</a> expects an awkward input data type 'float32'. Let's assume the source coordinates are <code>(sxi,syi)</code> and destination <code>(dxi,dyi)</code> with <code>i=0,1,2</code>, then what you need is</p> <pre><code>src = np.array( ((sx0,sy0),(sx1,sy1),(sx2,sy2)), dtype='float32' ) dst = np.array( ((dx0,dy0),(dx1,dy1),(dx2,dy2)), dtype='float32' ) result = cv2.getAffineTransform(src,dst) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

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