代码在git
| |
p
10
p_{10}
p10 |
p
9
p_9
p9 |
p
8
p_8
p8 | | |
---|
|
p
11
p_{11}
p11 | | | |
p
7
p_7
p7 | |
p
12
p_{12}
p12 | | | | | |
p
6
p_6
p6 |
p
13
p_{13}
p13 | | | P | | |
p
5
p_5
p5 |
p
14
p_{14}
p14 | | | | | |
p
4
p_4
p4 |
|
p
15
p_{15}
p15 | | | |
p
3
p_3
p3 | |
| |
p
16
p_{16}
p16 |
p
1
p_1
p1 |
p
2
p_2
p2 | | |
fast 算法的源码实现只是比较
-
p
p
p和
p
1
p_1
p1,
p
9
p_9
p9的灰度差
-
p
p
p和
p
5
p_5
p5,
p
13
p_{13}
p13的灰度差
在计算fast 前需要进行中止滤波
在计算后要进行非极大抑制
- 第1步:在图像中选择某个像素,它的灰度值记为。
- 第2步:设定一个阈值,用于判断两个像素灰度值差异大小,为了能够自适应不同的图像,一般采用相对百分比例,比如设置为的20%。
- 第3步:以像素为中心,选取半径为3的圆上的16个像素点。选取方式见下图右所示。
- 第4步:如果16个像素点中有连续的个点的灰度大于或者小于,那么可以将像素确定为关键点。在ORB的论文中,作者说时效果较好,称之为FAST-9。实际操作中为了加速,我们可以把第1,5,9,13个像素点当做锚点,在FAST-9算法中,只有当这4个锚点中有3个及以上灰度值同时大于或者小于,当前像素才可能是一个关键点进入到下一个阶段的判断,否则就可以排除掉,这大大加速了关键点检测的速度。
- 第5步:遍历图像中每个像素点,循环执行以上四个步骤。

# 校验
rows, cols = image.shape[:2]
if row < 3 or col < 3:
return False
if row >= rows-3 or col >= cols-3:
return False
intensity = int(image[row][col])
ROI = circle(row, col)
# 获取位置1,9,5,13的像素值
row1, col1 = ROI[0]
row9, col9 = ROI[8]
row5, col5 = ROI[4]
row13, col13 = ROI[12]
intensity1 = int(image[row1][col1])
intensity9 = int(image[row9][col9])
intensity5 = int(image[row5][col5])
intensity13 = int(image[row13][col13])
# 统计上面4个位置中满足 像素值 > intensity + threshold点的个数
countMore = 0
# 统计上面4个位置中满足 像素值 < intensity - threshold点的个数
countLess = 0
if intensity1 - intensity > threshold:
countMore += 1
elif intensity1 + threshold < intensity:
countLess += 1
if intensity9 - intensity > threshold:
countMore += 1
elif intensity9 + threshold < intensity:
countLess += 1
if intensity5 - intensity > threshold:
countMore += 1
elif intensity5 + threshold < intensity:
countLess += 1
if intensity13 - intensity > threshold:
countMore += 1
elif intensity13 + threshold < intensity:
countLess += 1
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 因为Apifox不支持离线,我果断选择了Apipost!
· 通过 API 将Deepseek响应流式内容输出到前端