@@ -390,50 +390,6 @@ def _to_color(indx):
390390 return b * 255 , r * 255 , g * 255
391391
392392
393- # opencv显示boxes
394- def CVShowBoxes (image , detectresult , num_classes = 90 , waitkey = - 1 , named_windows = "result" ):
395- base = int (np .ceil (pow (num_classes , 1. / 3 )))
396- colors = [_to_color (x ) for x in range (num_classes )]
397- if type (image ) == str :
398- image = cv2 .imread (image )
399- image2 = image .copy ()
400- boxes = detectresult .boxes
401- for i in range (len (boxes )):
402- if boxes [i ][0 ] <= 1 and boxes [i ][1 ] <= 1 and boxes [i ][2 ] <= 1 and boxes [i ][3 ] <= 1 :
403- xmin = int (boxes [i ][0 ] * image .shape [1 ])
404- ymin = int (boxes [i ][1 ] * image .shape [0 ])
405- xmax = int (boxes [i ][2 ] * image .shape [1 ])
406- ymax = int (boxes [i ][3 ] * image .shape [0 ])
407- else :
408- xmin = int (boxes [i ][0 ])
409- ymin = int (boxes [i ][1 ])
410- xmax = int (boxes [i ][2 ])
411- ymax = int (boxes [i ][3 ])
412- if boxes is not None :
413- image2 = cv2 .rectangle (image2 , (xmin , ymin ), (xmax , ymax ), GetRandomColor (), 3 , 3 )
414- if detectresult .label_texts is not None :
415- if detectresult .scores is not None :
416- image2 = Add_Chinese_Label (img = image2 , label = detectresult .label_texts [i ] + ":" + str (
417- int (detectresult .scores [i ] * 100 )),
418- pt1 = (xmin , ymin ))
419- else :
420- image2 = Add_Chinese_Label (img = image2 , label = detectresult .label_texts [i ],
421- pt1 = (xmin , ymin ))
422- if detectresult .label_ids is not None :
423- image2 = cv2 .rectangle (image2 , (xmin , ymin ), (xmax , ymax ), colors [int (detectresult .label_ids [i ])],
424- 3 , 3 )
425- else :
426- image2 = cv2 .rectangle (image2 , (xmin , ymin ), (xmax , ymax ), GetRandomColor (), 3 , 3 )
427-
428- if waitkey >= 0 :
429- cv2 .namedWindow (named_windows , 0 )
430- # cv2.resizeWindow("result", 840, 680)
431- cv2 .imshow (named_windows , image2 )
432- cv2 .waitKey (waitkey )
433- else :
434- return image2
435-
436-
437393# opencv显示points
438394def CVShowPoints (img_path , points , waitkey = 1 ):
439395 if type (img_path ) != list :
@@ -916,5 +872,5 @@ def run(self):
916872if __name__ == '__main__' :
917873 from jade import JadeLogging
918874 JadeLog = JadeLogging ("log" ,Level = "DEBUG" )
919- videoCaptureThread = VideoCaptureBaseProcess ("rtsp://admin:samples123@192.168.29.181:554/h264/ch1/main/av_stream" ,"top" ,True ,30 ,JadeLog )
875+ videoCaptureThread = VideoCaptureBaseProcess ("rtsp://admin:samples123@192.168.29.181:554/h264/ch1/main/av_stream" ,"top" ,False ,30 ,JadeLog )
920876 videoCaptureThread .start ()
0 commit comments