inner corners detected
This commit is contained in:
parent
db5cb1f31c
commit
3f088ffb7d
@ -6,6 +6,17 @@ import os
|
||||
# command:
|
||||
# python template.py input_folder output_folder
|
||||
|
||||
# Returns the correct corner based on IDs
|
||||
def getCorner(id):
|
||||
if(id == 0):
|
||||
return 2
|
||||
if(id == 1):
|
||||
return 3
|
||||
if(id == 2):
|
||||
return 0
|
||||
if(id == 3):
|
||||
return 1
|
||||
|
||||
if(len(sys.argv) != 3):
|
||||
print("Wrong amount of arguments")
|
||||
|
||||
@ -35,8 +46,38 @@ for file in os.listdir(input_folder):
|
||||
small_img,
|
||||
corners,
|
||||
ids)
|
||||
for id in ids:
|
||||
print(id)
|
||||
print(corners[id[0]])
|
||||
print()
|
||||
|
||||
i = 0
|
||||
x = np.zeros(4, dtype=np.int32)
|
||||
y = np.zeros(4, dtype=np.int32)
|
||||
for corner in corners:
|
||||
# print(ids[i])
|
||||
# print(corner[0])
|
||||
# print()
|
||||
|
||||
x[i] = corner[0][getCorner(ids[i])][0]
|
||||
y[i] = corner[0][getCorner(ids[i])][1]
|
||||
cv2.circle(
|
||||
new_image,
|
||||
(x[i], y[i]),
|
||||
radius=5,
|
||||
color=(255, 100, 255),
|
||||
thickness=-1)
|
||||
|
||||
print(x[i])
|
||||
print(y[i])
|
||||
print()
|
||||
|
||||
i += 1
|
||||
|
||||
print("imshape[0]: " + str(small_img.shape[0]))
|
||||
print("imshape[1]: " + str(small_img.shape[1]))
|
||||
cv2.imshow('window', new_image)
|
||||
cv2.imwrite(out_filename, new_image)
|
||||
# cv2.imwrite(out_filename, new_image)
|
||||
|
||||
cv2.waitKey(0)
|
||||
cv2.destroyAllWindows
|
Loading…
Reference in New Issue
Block a user