12 from PIL
import Image
as Image_
17 parser = argparse.ArgumentParser()
18 parser.add_argument(
'type', help=
'visualize train or test', choices=[
'train',
'test'])
19 args = parser.parse_args()
20 rospack = rospkg.RosPack()
21 data_dir = osp.join(rospack.get_path(
'sound_classification'),
22 'train_data',
'dataset')
23 print(
"Press 'q' to exit. Press any other keys to show next image.")
24 for f
in os.listdir(data_dir):
25 if not f.startswith(args.type)
or f.endswith(
'txt'):
27 img = np.array(Image_.open(osp.join(data_dir, f)))
28 img = img[:, :, [2, 1, 0]]
29 cv2.imshow(
'RGB labeled Image', img)
36 if __name__ ==
'__main__':