1. Alvaro

    Hi Eric,

    I have found this article very interesting. I am trying to build an Android app with OpenCV native functions and I was wondering if you could share your code for the QR code localization and perspective correction with me.

    Thanks in advance,


  2. Amir

    this article helped me to find a way for doing my project! i’m implementing the flag detection part right now but I think the part where you said “we can find which of the contours are inside other contours,” is really time consuming (OR am I wrong) consider we have 500 contours then the loop will execute 499*499+ checking all points in each contours !

    for (int i=0; i<contours.size()-1; i++)
    for (int j=1; j100&&contours[j].size()>100)
    if (contours[i].size()>contours[j].size())
    //check if (contours j) is inside
    else if(contours[i].size()<contours[j].size())
    //check if (contours i) is inside

    would you pls give me some guidance ?

    • Eric

      Hey Amir,

      Yes it is time-consuming, and maybe we are able to use something like dynamic programming, say we already know that contour_a is inside contour_b, and contour_b is inside contour_c, in this case, we can know contour_a must be inside contour_c. Besides, the above trick maybe works better if we randomize the vector of contours before the 2-layers loop (still 2-layers loop, but maybe much faster).

      • Amir

        thanks a lot for your help 😉
        In my project I have to detect a rectangle in the image and extract some transformation parameters ; fortunately the camera will not move after that and I can run the main process which is in real time!
        but I will work on the time as you guide me ,thanks again 😉

  3. Qai Jong

    Excellent article. Did you get to implement this? I am looking to implement the same for my project, if you could also share your implementation/code, it will be really helpful.

  4. Chris

    How are you doin the transformation with three points and getting the whole qr code? shouldnt u need all 4 points of the corners?

  5. Anonyous

    Hi, a question for a million:
    have u tried to split ur code (github link given before) on .h and .cpp file? I got some problems making a class from ur code , something I cant get yet, like how goes custing from v<v<v>> to v when u use sort on vecpair[i].begin/end and why it doesnt work during class implementation…

    • Anonyous

      got an answer for my question, dont know yet if it works, but it compiled:
      so, just set compareContourAreas static and calling it like class:compareContourAreas.

Leave a Reply

Your email address will not be published. Required fields are marked *