@@ -75,8 +75,10 @@ def on_captured_result_received(self, captured_result):
75
75
captured_result = result_queue .get_nowait ()
76
76
items = captured_result .get_items ()
77
77
for item in items :
78
- location = item . get_location ()
78
+
79
79
if item .get_type () == EnumCapturedResultItemType .CRIT_BARCODE :
80
+ text = item .get_text ()
81
+ location = item .get_location ()
80
82
x1 = location .points [0 ].x
81
83
y1 = location .points [0 ].y
82
84
x2 = location .points [1 ].x
@@ -87,7 +89,14 @@ def on_captured_result_received(self, captured_result):
87
89
y4 = location .points [3 ].y
88
90
cv2 .drawContours (
89
91
frame , [np .intp ([(x1 , y1 ), (x2 , y2 ), (x3 , y3 ), (x4 , y4 )])], 0 , (0 , 255 , 0 ), 2 )
92
+
93
+ cv2 .putText (frame , text , (x1 , y1 ),
94
+ cv2 .FONT_HERSHEY_SIMPLEX , 1 , (0 , 255 , 0 ), 2 )
95
+
96
+ del location
97
+
90
98
elif item .get_type () == EnumCapturedResultItemType .CRIT_NORMALIZED_IMAGE :
99
+ location = item .get_location ()
91
100
x1 = location .points [0 ].x
92
101
y1 = location .points [0 ].y
93
102
x2 = location .points [1 ].x
@@ -99,7 +108,10 @@ def on_captured_result_received(self, captured_result):
99
108
cv2 .drawContours (
100
109
frame , [np .intp ([(x1 , y1 ), (x2 , y2 ), (x3 , y3 ), (x4 , y4 )])], 0 , (255 , 0 , 0 ), 2 )
101
110
102
- del location
111
+ cv2 .putText (frame , "Edge Detection" , (x1 , y1 ),
112
+ cv2 .FONT_HERSHEY_SIMPLEX , 1 , (255 , 0 , 0 ), 2 )
113
+
114
+ del location
103
115
104
116
if cv2 .waitKey (1 ) & 0xFF == ord ('q' ):
105
117
break
0 commit comments