• Pingback: ()

  • Marco

    Hello, thanks for sharing, your code looks great because it doesn’t require additional libraries then opencv’s ones, but on line #15 and #16 there are 2 incompleted include, fixing this error gives another error on ATD, on the compiler i got (No Matching Member Function for call to ‘at’), looks like you have forgotten the , can you provide the fixed code? Thanks a lot and have a nice day!

    • Eric

      Hi Marco,

      Thanks for asking, I found that angle brackets (and code in angle brackets) in code do not show correctly and that caused the problem. The two missing includes are math.h and iostream; and the ATD part is #define ATD at(angle bracket)double(closing angle bracket). Hope this comment helps.

      • Marco

        There was another error on the vector starting from on line 216, they should be vector of Mat object, thanks again and have a nice day!

        • Eric

          Oh yeah, another angle brackets problem. U r right, vector of Mat. Cheers!

  • Marco

    #define ATD at fixed some problem but there are others like “vector rgb1;” vector does not exist…

  • Marco

    sorry the type looks like is filtered by your html tag, the define should look like this #define ATD at

  • Marco

    sorry it’s filtered even in the code tags, i hope you have understood the problem

  • Hi,
    that is a very cool algorithm. Thanks for sharing.

    Just some remarks to your code:
    – OpenCV loads color images in BGR, not in RGB. So the channel variables are labeled incorrectly. But is has no consqeuences in your case.
    – ctime has to be included to use clock()

    The fixed code (also with corrected brackets problem) can be found here: http://codepad.org/PU8ezzdl

    Perhaps you want to include a link to the correct raw code in your post, so not every of your readers has to fix this independently.


    • Eric

      Thanks Dobiasd

  • Josep Bosch

    Dobiasd’s link looks dead…
    I posted the working code in a new one:


    • Eric


    • Lee

      thank you for posting the code

      • mrhloom

        We we use only rectangular areas and no binary mask is specified?

    • Muo

      Why I can’t process the roi bigger than 100 pixels each edge.
      This line will occur error:
      “Mat A = Mat::eye(height * width, height * width, CV_64FC1);”
      The opencv show the error message “The total matrix size does not fit to “size_t” type”
      Is there anybody know this problem.

      • Richard

        I have the same problem and I think Mat type in OpenCV couldn’t support that large size mat.

  • mrhloom

    Also what if PosX=0 or PosY=0( in GetB )program breaks?

  • manuel connell

    Dobiasd’ version link is broken, where can find it ?