- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在使用 OpenCV-Python。
我已经使用 cv2.cornerHarris
识别角点。输出类型为 dst
。
我需要计算角点的 SIFT 特征。 sift.compute()
的输入必须是 KeyPoint
类型。
我不知道如何使用 cv2.KeyPoint()
。
我该怎么做?
最佳答案
Harris 检测器返回 dst,与您的图像具有相同的形状。哈里斯在它认为是角球的地方做标记。所以,你必须从 dst 中提取关键点。
def harris(self, img):
'''
Harris detector
:param img: an color image
:return: keypoint, image with feature marked corner
'''
gray_img = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
gray_img = np.float32(gray_img)
dst = cv2.cornerHarris(gray_img, 2, 3, 0.04)
result_img = img.copy() # deep copy image
# Threshold for an optimal value, it may vary depending on the image.
result_img[dst > 0.01 * dst.max()] = [0, 0, 255]
# for each dst larger than threshold, make a keypoint out of it
keypoints = np.argwhere(dst > 0.01 * dst.max())
keypoints = [cv2.KeyPoint(x[1], x[0], 1) for x in keypoints]
return (keypoints, result_img)
关于python - 如何创建关键点来计算 SIFT?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29415719/
我正在检测图像中的 SURF 特征,然后将它们写入 yml 文件。然后我想再次从 yml 文件加载特征以尝试检测对象,但目前我无法加载关键点以将它们绘制在图像上。 我是这样写要点的: cv::File
我正在学习 OpenCV,目前我正在尝试了解存储在 KeyPoint 中的基础数据,以便我可以更好地将这些数据用于我正在处理的应用程序。 到目前为止,我已经浏览了这两个页面: http://docs.
我想了解更多关于KeyPoints的知识,谁能告诉我什么是 关键点::角度 在 OpenCV 文档中提到角度是计算关键点的方向(如果不适用则为 -1)。我无法想象那是什么。那么谁能告诉我这是什么意思或
我有 3D 多边形:实体(第一种情况)和平面(第二种情况)。如何确定主控点(key point)?例如:圆柱体的主点是其盖子的中心。 我不能使用凸包算法,因为主点可以是船体的一部分,而且我不能用平面
我想在opencv中实现一揽子单词。在检测器之后-> detect(img,keypoint);当我想使用keypoint.clear()清理关键点时,会检测到关键点;或者当函数想要返回时,将出现以下
我在 python 中有以下代码 import cv2 import numpy as np def save_keypoints(image_path, type_image): img =
我想要代码根据 SIFT 关键点匹配两张图片。? 我有以下用于 SIFT 的代码 public static Image siftFunction(Bitmap sourceBitmap) {
我正在处理生物信息学的任务,需要从一些细胞图像中提取一些特征。 我使用 SIFT 算法提取图像内部的关键点,如图所示。 正如您在图片中也看到的(红色圈出),一些关键点是异常值,我不想计算它们的任何特征
在搜索了这个(1、2、3、4)的答案后,我仍然对两者感到困惑 如果可能的话 如果是,怎么做 我希望能够从一个 .xml 文件中读取,该文件有一个包含 cv::Mat 的 Point2f keypoin
我尝试比较两个不同图像中的两个点,所以我想将坐标转换为关键点,以便稍后用它们计算描述和匹配结果。 我找到了方法: keypoint = cv2.KeyPoint(x, y, 0) vec = [k
我是一名 Asp.net 开发人员,但对 Asp.net Identity 框架非常陌生。我一直在研究示例应用程序并遵循了一些关于身份的教程,但我仍然无法完全掌握这个概念。我对 Asp.net 成员(
我是一名优秀的程序员,十分优秀!