pythonopencvmatchfeature-extraction

How to determine the line width in OpenCV's drawMatches


I'm using OpenCV's drawMatches() to draw the matches between keypoints. Is there a way we can specify the width of the lines drawn, as in my case they appear very thin.

Thanks.


Solution

  • It should not be possible unless you are willing to edit and recompile openCV.

    From modules/features2d/src/draw.cpp

    line( outImg,
      Point(cvRound(pt1.x*draw_multiplier), cvRound(pt1.y*draw_multiplier)),
      Point(cvRound(dpt2.x*draw_multiplier), cvRound(dpt2.y*draw_multiplier)),
      color, 1, LINE_AA, draw_shift_bits );
    

    This call draws the line between the two keypoints and the 1 in the function call specifies the thickness of the line (see openCV doc). Unfortunately it has been hard-coded inside the draw function.

    However it looks quite strange that you are not able to correctly visualize the matches. They are quite fine to me.

    some stereo matches