Skip to content

Instantly share code, notes, and snippets.

@woolpeeker
woolpeeker / draw_matches.py
Last active April 21, 2025 19:07
Python replacement for cv2.drawMatches(), for which there are no Python bindings in a release version.
# drawMatches numpy version
def draw_matches(img1, kp1, img2, kp2, matches, color=None):
"""Draws lines between matching keypoints of two images.
Keypoints not in a matching pair are not drawn.
Places the images side by side in a new image and draws circles
around each keypoint, with line segments connecting matching pairs.
You can tweak the r, thickness, and figsize values as needed.
Args:
img1: An openCV image ndarray in a grayscale or color format.
kp1: ndarray [n1, 2]
@woolpeeker
woolpeeker / Timer.cpp
Created December 20, 2021 14:03 — forked from mcleary/Timer.cpp
C++ Timer using std::chrono
#include <iostream>
#include <chrono>
#include <ctime>
#include <cmath>
class Timer
{
public:
void start()
{