code: def crop_frame_roi(frame, roi_bound, roi_size=(96, 96)):
      bound_l = max(
          roi_bound[3] - roi_bound[1], roi_bound[2] - roi_bound[0]
      )
      bound_h_extend = (bound_l - roi_bound[2] + roi_bound[0]) / 2
      bound_w_extend = (bound_l - roi_bound[3] + roi_bound[1]) / 2
      x_start, x_end = (
          int(roi_bound[1] - bound_w_extend),
          int(roi_bound[3] + bound_w_extend),
      )
      if x_start < 0:
          x_start = 0
      if x_end > frame.shape[0]:
          x_end = frame.shape[0]
      y_start, y_end = (
          int(roi_bound[0] - bound_h_extend),
          int(roi_bound[2] + bound_h_extend),
      )
      if y_start < 0:
          y_start = 0
      if y_end > frame.shape[1]:
          y_end = frame.shape[1]
      roi_frame = frame[x_start:x_end, y_start:y_end, :]
      resized_roi_frame = cv2.resize(
          roi_frame, roi_size, interpolation=cv2.INTER_AREA
      )
      return cv2.cvtColor(resized_roi_frame, cv2.COLOR_BGR2GRAY)
  
file_path: espnet/egs2/misp2021/avsr1/local/prepare_far_video_roi.py
imports: import argparse
  import codecs
  import json
  import os
  import time
  from multiprocessing import Pool
  import cv2
  import numpy
  from tqdm import tqdm
label_desc: Use image node_id 1 for calling a global function with example usage: crop_frame_roi(frame, roi_bound, roi_size) and returns: cv2