小编mik*_*123的帖子

Pandas 使用 apply lambda 和两个不同的运算符

这个问题与我之前发布的问题非常相似,只有一处更改。我不仅想计算所有列的绝对差异,还想找到“Z”列的幅度差异,因此如果当前 Z 比前一个大 1.1 倍,则保留它。

(问题的更多背景)

Pandas 使用先前的排名值来过滤当前行

df = pd.DataFrame({
    'rank': [1, 1, 2, 2, 3, 3],
    'x': [0, 3, 0, 3, 4, 2],
    'y': [0, 4, 0, 4, 5, 5],
    'z': [1, 3, 1.2, 3.25, 3, 6],
})
print(df)
#    rank  x  y     z
# 0     1  0  0  1.00
# 1     1  3  4  3.00
# 2     2  0  0  1.20
# 3     2  3  4  3.25
# 4     3  4  5  3.00
# 5     3  2 …
Run Code Online (Sandbox Code Playgroud)

python lambda pandas

6
推荐指数
2
解决办法
593
查看次数

使用 opencv 查找包含另一张图像的最相似图像

如果标题不清楚,假设我有一个图像列表(10k+),并且我有一个我正在搜索的目标图像。

这是目标图像的示例:

在此处输入图片说明

这是我想要搜索以找到“相似”内容(ex1、ex2 和 ex3)的图像示例:

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

这是我做的匹配(我使用 KAZE)

from matplotlib import pyplot as plt
import numpy as np
import cv2
from typing import List
import os
import imutils


def calculate_matches(des1: List[cv2.KeyPoint], des2: List[cv2.KeyPoint]):
    """
    does a matching algorithm to match if keypoints 1 and 2 are similar
    @param des1: a numpy array of floats that are the descriptors of the keypoints
    @param des2: a numpy array of floats that are the descriptors of the keypoints
    @return:
    """
    # bf matcher with …
Run Code Online (Sandbox Code Playgroud)

python opencv machine-learning image-processing image-recognition

5
推荐指数
2
解决办法
715
查看次数