use Corner calss
This commit is contained in:
@@ -4,7 +4,7 @@ import imutils as im
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from util import bbox_extend, bbox_round, image_crop, to_rect, bbox_add_position, bbox_center
|
from util import bbox_extend, bbox_round, image_crop, to_rect, bbox_add_position, bbox_center
|
||||||
from ocv_corner_tracker import CornerTracker
|
from ocv_corner_tracker import Corner
|
||||||
|
|
||||||
|
|
||||||
def refine_corner(src_gray, corners_original: np.array):
|
def refine_corner(src_gray, corners_original: np.array):
|
||||||
@@ -51,13 +51,11 @@ crop = image_crop(image.copy(), bb_crop)
|
|||||||
|
|
||||||
ct_list = []
|
ct_list = []
|
||||||
count = 1
|
count = 1
|
||||||
key_wait = -1
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
print(f"Add Corner {count}")
|
print(f"Add Corner {count}")
|
||||||
bb_template = cv2.selectROI("Image", crop, fromCenter=True, showCrosshair=True)
|
bb_template = cv2.selectROI("Image", crop, fromCenter=True, showCrosshair=True)
|
||||||
template = cv2.cvtColor(image_crop(crop.copy(), bb_template), cv2.COLOR_BGR2GRAY)
|
template = cv2.cvtColor(image_crop(crop.copy(), bb_template), cv2.COLOR_BGR2GRAY)
|
||||||
ct_list.append(CornerTracker(template, bb_template))
|
ct_list.append(Corner(template, bb_template, name=f"C-{count}"))
|
||||||
print(f"Corner {count} added")
|
print(f"Corner {count} added")
|
||||||
print(f"Press any key to add another corner or ESC to continue")
|
print(f"Press any key to add another corner or ESC to continue")
|
||||||
|
|
||||||
@@ -72,6 +70,7 @@ print(f"Added {count} corners")
|
|||||||
tracker = cv2.TrackerKCF().create()
|
tracker = cv2.TrackerKCF().create()
|
||||||
tracker.init(image, bb_crop)
|
tracker.init(image, bb_crop)
|
||||||
|
|
||||||
|
key_wait = -1
|
||||||
while True:
|
while True:
|
||||||
# Read a new frame
|
# Read a new frame
|
||||||
ok, image = video.read()
|
ok, image = video.read()
|
||||||
|
|||||||
Reference in New Issue
Block a user