<jupyter_start><jupyter_text>Multi Camera Fusion<jupyter_code>import os
import cv2
import numpy as np
import matplotlib.pyplot as plt

import matplotlib.patches as patches
from PIL import Image

files = 'C://users/cathx/repos/squeezedet/squeezedet-pytorch/data/argo'
train_img = os.path.join(files, 'training/image_2')
train_label = os.path.join(files, 'training/label_2')
testid = '000001'
# open the image:
imagef = os.path.join(train_img, testid+'.png')
image = cv2.imread(imagef)
cv2.imshow('img', image)
cv2.waitKey(0)
cv2.destroyAllWindows()
for b in range(len(boxes)):
#     print(b)
    img = cv2.rectangle(image, (boxes[b][0], boxes[b][1]), (boxes[b][2], boxes[b][3]), color= (255,200,0), thickness=1)
    
cv2.imshow('img', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
img = cv2.rectangle(image, (boxes[3][0], boxes[3][1]), (boxes[3][2], boxes[3][3]), color = (255,0,0), thickness=1)

cv2.imshow('img', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
plt.imshow(image)
im = Image.open(imagef)

fig, ax = plt.subplots()
ax.imshow(im)
rect = patches.Rectangle((boxes[3][0], boxes[3][1]), w, h, linewidth = 1, edgecolor='r', facecolor='none')
ax.add_patch(rect)
plt.show()
# to get w, h:
w = boxes[3][2] - boxes[3][0]
w
h = boxes[3][3] - boxes[3][1]
h
rect = patches.Rectangle((boxes[3][0], boxes[3][1]), w, h, linewidth = 1)
labelf = os.path.join(train_label, testid+'.txt')
with open(labelf, 'r') as fp:
    labels = fp.readlines()
labs = [ann.strip().split(' ') for ann in labels]

classes, boxes = [], []
for ann  in labs:
    classes.append(ann[0])
    boxes.append([float(x) for x in ann[4:8]])
    
clases = np.array(classes)
boxes = np.array(boxes, dtype=np.float32)
# classes, boxes
labels<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1936416184971098, 'fraction_numerical': 0.042196531791907514, 'mean_word_length': 5.434944237918216, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '460251', 'license': 'MIT', 'n_tokens_mistral': 722, 'n_tokens_neox': 704, 'n_words': 148, 'path': 'MultipleCameraInfusion.ipynb', 'repo_name': 'Hira63S/KnightRyder', 'size': '1730'}