“…# -------------Libraries ---------------------# import cv2 # Library for image processing import numpy as np # Library for math import os # Library for organizing archives from matplotlib import pyplot as plt # Library for display imgs import time # Library for time counting # -------------Functions ---------------------# # Function to rescale an image def rescale(img, scale_factor): width = img.shape [1] ImgScale = scale_factor/width newX, newY = img.shape [1]*ImgScale, img.shape[0]*ImgScale image = cv2.resize(img,(int(newX),int(newY))) Height,Width = image.shape return image, ImgScale # Global variables that are used on the click_and_crop function refPt = [] # vector to save the selected reference coordinates cropping = False # click_and_crop shows an image and saves the reference coordinates of the user-drawn rectangle def click_and_crop(event, x, y, flags, param): global refPt, cropping # event is a user action if event == cv2.EVENT_LBUTTONDOWN: # reference initial coordinate set on the user click with refPt = [(x,y)] # left mouse button cropping = True elif event == cv2.EVENT_LBUTTONUP: # reference final coordinate set on the user click with refPt.append((x,y)) # left mouse button cropping = False # draw a retangle with the reference coordinates cv2.rectangle(image, refPt[0], refPt [1], (0, 255, 0), 2) cv2.imshow("image", image) # load_images opens the selected folder and returns a list with all images that it has inside def load_images ( 16) TransLvl = int(camera_parameter["TRANS_LVL"]) cfg = {"u32CameraType":0x4D091031, "u32Width":Width,"u32Height":Height, "usbType":0, "u8PixelBytes":ByteLength, "u16Vid":0, "u32Size":0, "u8PixelBits":BitWidth, "u32I2cAddr":I2cAddr, "emI2cMode":I2CMode, "emImageFmtMode":FmtMode, "u32TransLvl": '''print("Serial: %d%d%d%d-%d%d%d%d-%d%d%d%d"%(datas[0],datas [1],datas [2],datas [3], datas [4],datas [5],datas [6],datas [7], datas [8],datas [9],datas [10],datas [11])) ------------------------…”