@@ -75,8 +75,10 @@ def on_captured_result_received(self, captured_result):
7575 captured_result = result_queue .get_nowait ()
7676 items = captured_result .get_items ()
7777 for item in items :
78- location = item . get_location ()
78+
7979 if item .get_type () == EnumCapturedResultItemType .CRIT_BARCODE :
80+ text = item .get_text ()
81+ location = item .get_location ()
8082 x1 = location .points [0 ].x
8183 y1 = location .points [0 ].y
8284 x2 = location .points [1 ].x
@@ -87,7 +89,14 @@ def on_captured_result_received(self, captured_result):
8789 y4 = location .points [3 ].y
8890 cv2 .drawContours (
8991 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+
9098 elif item .get_type () == EnumCapturedResultItemType .CRIT_NORMALIZED_IMAGE :
99+ location = item .get_location ()
91100 x1 = location .points [0 ].x
92101 y1 = location .points [0 ].y
93102 x2 = location .points [1 ].x
@@ -99,7 +108,10 @@ def on_captured_result_received(self, captured_result):
99108 cv2 .drawContours (
100109 frame , [np .intp ([(x1 , y1 ), (x2 , y2 ), (x3 , y3 ), (x4 , y4 )])], 0 , (255 , 0 , 0 ), 2 )
101110
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
103115
104116 if cv2 .waitKey (1 ) & 0xFF == ord ('q' ):
105117 break
0 commit comments