@@ -47,16 +47,9 @@ def main(argv):
4747 print ('Failed to load image' , args [1 ])
4848 exit (1 )
4949
50- # imread returns images in BGR format, so we need to convert to RGB
51- img = cv2 .cvtColor (img , cv2 .COLOR_BGR2RGB )
52-
5350 # get_features_from_image also takes a crop direction arguments in case you don't have square images
5451 features , cropped = runner .get_features_from_image (img )
5552
56- # the image will be resized and cropped, save a copy of the picture here
57- # so you can see what's being passed into the classifier
58- cv2 .imwrite ('debug.jpg' , cv2 .cvtColor (cropped , cv2 .COLOR_RGB2BGR ))
59-
6053 res = runner .classify (features )
6154
6255 if "classification" in res ["result" ].keys ():
@@ -70,6 +63,12 @@ def main(argv):
7063 print ('Found %d bounding boxes (%d ms.)' % (len (res ["result" ]["bounding_boxes" ]), res ['timing' ]['dsp' ] + res ['timing' ]['classification' ]))
7164 for bb in res ["result" ]["bounding_boxes" ]:
7265 print ('\t %s (%.2f): x=%d y=%d w=%d h=%d' % (bb ['label' ], bb ['value' ], bb ['x' ], bb ['y' ], bb ['width' ], bb ['height' ]))
66+ cropped = cv2 .rectangle (cropped , (bb ['x' ], bb ['y' ]), (bb ['x' ] + bb ['width' ], bb ['y' ] + bb ['height' ]), (255 , 0 , 0 ), 1 )
67+
68+ # the image will be resized and cropped, save a copy of the picture here
69+ # so you can see what's being passed into the classifier
70+ cv2 .imwrite ('debug.jpg' , cv2 .cvtColor (cropped , cv2 .COLOR_RGB2BGR ))
71+
7372 finally :
7473 if (runner ):
7574 runner .stop ()
0 commit comments