Skip to content

drawMatches lines not visible in larger images #20095

@WurmD

Description

@WurmD

drawMatches https://docs.opencv.org/master/d4/d5d/group__features2d__draw.html#gad8f463ccaf0dc6f61083abd8717c261a draws 1 pixel thick lines between matching keypoints in two side-by-side images, this becomes invisible for larger images.

Please add a thickness argument, and base the default thickness on the size of the image.

System information (version)
  • OpenCV => 4.2
Steps to reproduce
```.py
left_image = cv.imread('images/IMG_6769.jpg',cv.IMREAD_COLOR)
right_image = cv.imread('images/IMG_6770.jpg',cv.IMREAD_COLOR)
width = right_image.shape[1]
height = right_image.shape[0]
orb = cv.ORB_create(nfeatures=1500)
kp1, des1 = orb.detectAndCompute(left_image,None)
kp2, des2 = orb.detectAndCompute(right_image,None)
bf = cv.BFMatcher(cv.NORM_HAMMING, crossCheck=True)
matches = bf.match(des1,des2)

bestmatches_diff_to_median_disparity_wise = get_best_matches_difference_to_median_disparity_wise(matches, kp1, kp2)
largest_trapeze_matches = get_4_matches_that_form_largest_trapeze(bestmatches_diff_to_median_disparity_wise, kp1)
destination_left_points, source_right_points = from_matches_to_2_arrays_of_points(largest_trapeze_matches, kp1, kp2)

img3 = cv.drawMatches(left_image,kp1,right_image,kp2,largest_trapeze_matches,None,flags=cv.DrawMatchesFlags_DRAW_RICH_KEYPOINTS) # cv.DrawMatchesFlags_NOT_DRAW_SINGLE_POINTS
plt.imshow(img3),plt.show()
```
Issue submission checklist

IMG_6769
IMG_6770

Failure to see lines
Barely visible in max zoom

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions