Thursday, December 26, 2013

SURF and BRISK in OpenCV

Today I spent half a day to compare the two feature detector and descriptor SURF and BRISK.

The conclusion is

  • SURF is more accurate but takes much longer
  • BRISK is 10 times faster with comparable accuracy. 
One thing to notice:
when using Brute-force matcher, mind the normType. See HERE
C++: BFMatcher::BFMatcher(int normType=NORM_L2, bool crossCheck=false )
Parameters:
* normType – One of NORM_L1, NORM_L2, NORM_HAMMING,NORM_HAMMING2. L1 and L2 norms are preferable choices for SIFT and SURF descriptors, 
* NORM_HAMMING should be used with ORB, BRISK and BRIEF, NORM_HAMMING2 should be used with ORB when WTA_K==3 or 4.

The other thing to notice is the threshold used to select good matches. Maybe RANSAC should be used.
SURF feature
BRISK feature
 



Saturday, November 16, 2013

Das ist eine brilliante Idee

Teil 4 Lektion 1


  • Gibt es schon Reaktionen auf den Sprachkurse?
  • Ja, wir haben viele Hörerbriefe bekommen.
  • Und was steht in den Briefen?
  • Die kann ich doch nicht alle vorlesen. Das dauert viel zu lange.
  • Nicht alle, aber einige - bitte!
  • Ja, das interessiert mich auch.
  • Na gut. 
  • Aber bitte, machen Sie es kurz!
  • Hier habe ich einen Brief von Herrn Card aus Amerika - Moment. Mir gefallen die Abenteuer von Andreas - asl Portier im Hotel Europa.
  • Mir auch
  • s
  • Und hier ist ein Brief von Angela aus Kolumbien. Sie schreibt, ' Ich bin so glücklick, weil ich die Grammatik studiert habe. Jetzt verstehe ich den Akkusativ - der war immer ...'
  • Grammatik, Grammatik, Akkusativ - das ist ja langweilig! Schreiben die Hörer den nichts über mich?! Wie finden die Hörer mich, das will ich wissen!
  • Kein Problem, Ex.  Hier ist ein Brief aus England - da steht etwas über dich! ' The intruduction of Ex is a brilliant idea. '
  • Das verstehe ich doch nicht! Was heißt das denn auf deutsch?
  • Du bist eine brillante Idee!
  • Idee? Wieso bin ich eine Idee? Ich bin ich!
  • s
  • Das hier ist noch ganz wichtig: Manche Hörer schreiben, daß sie Ex nicht so gut verstehen. 
  • Wir können ihr ja eine andere Stimme geben.
  • Probieren wir es doch mal! Ex, sprich mal etwas!
  • Ben dem Zauberwort sollte ich das Buch verlassen und ...
  • Okay! Stop! Und noch einmal bitte!
  • Ben dem Zauberwort sollte ich das Buch verlassen und ...
  • Kann ihre Stimme nicht ganz normal bleiben?
  • Nein - Ex ist ja eine besondere Person, ein weiblicher kobold, da braucht sie auch eine besondere Stimme. 
  • Das finde ich auch!
  • Aber das ist ein technisches Problem. Das lösen wir später. 

Saturday, November 2, 2013

Finds an object pose from 3D-2D point correspondences

C++: bool solvePnP(InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix, InputArray distCoeffs, OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess=false, int flags=ITERATIVE )


Parameters:
  • objectPoints – Array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, where N is the number of points. vector<Point3f> can be also passed here.
  • imagePoints – Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, where N is the number of points. vector<Point2f> can be also passed here.
  • cameraMatrix – Input camera matrix A = \vecthreethree{fx}{0}{cx}{0}{fy}{cy}{0}{0}{1} .
  • distCoeffs – Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
  • rvec – Output rotation vector (see Rodrigues() ) that, together with tvec , brings points from the model coordinate system to the camera coordinate system.
  • tvec – Output translation vector.
  • useExtrinsicGuess – If true (1), the function uses the provided rvec and tvec values as initial approximations of the rotation and translation vectors, respectively, and further optimizes them.
  • flags –
    Method for solving a PnP problem:
    • CV_ITERATIVE Iterative method is based on Levenberg-Marquardt optimization. In this case the function finds such a pose that minimizes reprojection error, that is the sum of squared distances between the observed projections imagePoints and the projected (using projectPoints() ) objectPoints .
    • CV_P3P Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang “Complete Solution Classification for the Perspective-Three-Point Problem”. In this case the function requires exactly four object and image points.
    • CV_EPNP Method has been introduced by F.Moreno-Noguer, V.Lepetit and P.Fua in the paper “EPnP: Efficient Perspective-n-Point Camera Pose Estimation”.
The function estimates the object pose given a set of object points, their corresponding image projections, as well as the camera matrix and the distortion coefficients.

Friday, October 11, 2013

Tuesday, September 10, 2013

Two UAV from NWPU

西工大 灵龙  NWPU Ling Long
风火轮 滚翼机



Thursday, August 15, 2013

Image stiching in OpenCV

Reference to http://ramsrigoutham.com/2012/11/22/panorama-image-stitching-in-opencv/

Main steps of the code:
  1. Load two images;
  2. Convert to gray scale;
  3. Using SURF detector to find SURF descriptor in both images;
  4. matching the SURF descriptor using FLANN Matcher;
  5. Postprocessing matches to find good matches
  6. Using RANSAC to estimate the Homography matrix using the matched SURF descriptors;
  7. Warping the images based on the homography matrix

The image shows the definition of Homography which transforms 2d Planar point to the image plane. 


 The following image is shows the initial image and the matched SURF features of the two. Homography is derived from the left image to the right image.


Stiching image result.

Source Code

Tuesday, August 6, 2013

Resource to learn optimization

http://www.quora.com/Mathematical-Optimization/What-are-some-good-resources-to-learn-about-optimization#


Theory behind MPC


MPC is based on iterative, finite horizon optimization of a plant model. At time t the current plant state is sampled and a cost minimizing control strategy is computed (via a numerical minimization algorithm) for a relatively short time horizon in the future: [t,t+T]. Specifically, an online or on-the-fly calculation is used to explore state trajectories that emanate from the current state and find (via the solution of Euler-Lagrange equations) a cost-minimizing control strategy until time t+T. Only the first step of the control strategy is implemented, then the plant state is sampled again and the calculations are repeated starting from the current state, yielding a new control and new predicted state path. The prediction horizon keeps being shifted forward and for this reason MPC is also called receding horizon control.