mirror of
https://github.com/qurator-spk/eynollah.git
synced 2026-01-29 13:46:58 +01:00
fix: prevent crash when printspace is missing in xmls used for label generation
This commit is contained in:
parent
6ae244bf9b
commit
33f6a231bc
1 changed files with 8 additions and 5 deletions
|
|
@ -734,12 +734,15 @@ def get_images_of_ground_truth(gt_list, dir_in, output_dir, output_type, config_
|
||||||
_, thresh = cv2.threshold(imgray, 0, 255, 0)
|
_, thresh = cv2.threshold(imgray, 0, 255, 0)
|
||||||
|
|
||||||
contours, _ = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
|
contours, _ = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
|
||||||
|
|
||||||
cnt_size = np.array([cv2.contourArea(contours[j]) for j in range(len(contours))])
|
cnt_size = np.array([cv2.contourArea(contours[j]) for j in range(len(contours))])
|
||||||
|
|
||||||
cnt = contours[np.argmax(cnt_size)]
|
try:
|
||||||
|
cnt = contours[np.argmax(cnt_size)]
|
||||||
x, y, w, h = cv2.boundingRect(cnt)
|
x, y, w, h = cv2.boundingRect(cnt)
|
||||||
|
except:
|
||||||
|
x, y , w, h = 0, 0, x_len, y_len
|
||||||
|
|
||||||
bb_xywh = [x, y, w, h]
|
bb_xywh = [x, y, w, h]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue