Skip to content

Commit 5d675cf

Browse files
committed
change comments into english
1 parent cf1a740 commit 5d675cf

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

main.py

+10-12
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,22 @@
3535
assert args.queryPath[-1] == "\\"
3636
assert args.outputPath[-1] == "\\"
3737

38-
# 读取图片
38+
# load images
3939
sampleImageColorOrigin, sampleImageColorResize, sampleImageGray, queryImagesColorOrigin, queryImagesColorResize, queryImagesGray, numOfQuery, queryFileNames = imageLoad(args.samplePath, args.queryPath)
4040

41-
# 初始化ORB检测对象
41+
# initialize ORB detector
4242
orb = cv2.ORB_create()
4343

44-
# 初始化FLANN匹配对象
44+
# initialize FLANN matcher
4545
FLANN_INDEX_KDTREE=0
4646
indexParams=dict(algorithm=FLANN_INDEX_KDTREE,trees=5)
4747
searchParams=dict(checks=50)
4848
flann=cv2.FlannBasedMatcher(indexParams,searchParams)
4949

50-
# 检测与匹配
50+
# detect and match
5151
keyPointsSample, descriptorsSample, keyPointsQuery, descriptorsQuery, matchesList, goodMatchesList = detectAndMatch(orb, flann, sampleImageGray, queryImagesGray, numOfQuery)
5252

53-
# 计算相似度
53+
# caculate similarity
5454
similarity = []
5555
for i in range(numOfQuery):
5656
tempSimilarity = caculateSimilarity(goodMatchesList[i], matchesList[i])
@@ -61,11 +61,11 @@
6161
# print(bestIndex)
6262
# print(similarity)
6363

64-
# 创建输出目录
64+
# make dirs for outputs
6565
outputPath = args.outputPath
6666
makeDirs(outputPath)
6767

68-
# 保存缩放图片
68+
# save resized image
6969
resizePath = outputPath + "resize\\"
7070
sampleImageName = args.samplePath.split("\\")[-1].split('.')[-2]
7171
cv2.imwrite(resizePath + sampleImageName + "resize" + ".png", cv2.cvtColor(sampleImageColorResize, cv2.COLOR_RGB2BGR))
@@ -75,20 +75,18 @@
7575
cv2.imwrite(resizePath + queryName + "Resize" + ".png", cv2.cvtColor(queryImagesColorResize[i],cv2.COLOR_RGB2BGR))
7676
queryImageNames.append(queryName)
7777

78-
# 保存最佳匹配和最高相似度
78+
# save best matching image and top similarity
7979
cv2.imwrite(outputPath + "BestMatch.png", queryImagesColorOrigin[bestIndex])
8080
saveSimilarity(outputPath, maxSimilarity)
8181

82-
# 显示关键点和匹配情况
83-
## 绘制关键点
82+
# visualize keypoints and matches
8483
figureNameKeypoints = "FinalKeypointsWithSimilarity"
8584
plotKeypoints(sampleImageColorResize, keyPointsSample, queryImagesColorResize, keyPointsQuery, similarity, numOfQuery, outputPath, figureNameKeypoints,isShow=args.isShow)
8685

87-
# 显示匹配点对和相似度
8886
figureNameMatches = "FinalMatchesWithSimilarity"
8987
plotMatches(sampleImageColorResize,keyPointsSample, queryImagesColorResize, keyPointsQuery, similarity, goodMatchesList, numOfQuery, outputPath, figureNameMatches, isShow=args.isShow)
9088

91-
# 序列化关键点和描述子
89+
# save keypoints and descriptors
9290
saveKeypointsAndDescriptors(
9391
keypoints=keyPointsSample,
9492
kName="keyPoints" + sampleImageName,

0 commit comments

Comments
 (0)