30 trieres_lib=os.environ[
'cFpRootDir'] + 
"HOST/vision/sobel/languages/python/build" 
   31 sys.path.append(trieres_lib)
 
   33 import _trieres_sobel_numpi
 
   41 image_in_filename = os.environ[
'cFpRootDir'] + 
"ROLE/vision/hls/sobel/test/512x512.png" 
   42 image_out_filename = image_in_filename + 
"_fpga_points_out_frame_" + 
str(num_frame) + 
".png" 
   51     min_size = np.amin([h,w])
 
   52     print(
"min_size="+
str(min_size))
 
   55     crop_img = img[
int(h/2-min_size/2):
int(h/2+min_size/2), 
int(w/2-min_size/2):
int(w/2+min_size/2)]
 
   60     roi = crop_img[y1:y2, x1:x2]
 
   61     resized = cv2.resize(roi , (size, size), interpolation=interpolation)
 
   70     min_size = np.amin([h,w])
 
   71     print(
"min_size="+
str(min_size))
 
   74     img[
int(h/2-min_size/2):
int(h/2+min_size/2), 
int(w/2-min_size/2):
int(w/2+min_size/2)] = crop_img
 
   85     image = cv2.imread(image_in_filename, cv2.IMREAD_UNCHANGED) 
 
   88     image = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
 
   91     if ((image.shape[0] != height) 
or (image.shape[1] != width)):
 
   93             print(
"WARNING: An image of size [", height  , 
" x ", width, 
"] will be cropped from input image of size [", image.shape[0] , 
" x ", image.shape[1] , 
"]")    
 
   95             image = 
crop_square(image_big, width, interpolation = cv2.INTER_AREA)       
 
   97             print(
"WARNING: The image was resized from [", image.shape[0] , 
" x ", image.shape[1] , 
"] to [", height  , 
" x ", width, 
"]")    
 
   99             image = cv2.resize(image, dim, interpolation = cv2.INTER_LINEAR) 
 
  102     image = image.flatten()
 
  104     total_size = height * width
 
  110     output_array = _trieres_sobel_numpi.sobel(input_array, total_size, 
"10.12.200.122", 
"2718")
 
  113     output_array_2d = np.reshape(output_array, (height, width))
 
  118 cv2.imwrite(image_out_filename, output_array_2d)
 
  119 print(
"INFO: the output file is saved at : " + image_out_filename)
 
def crop_square(img, size, interpolation=cv2.INTER_AREA)
 
def patch_square(crop_img, img, interpolation=cv2.INTER_AREA)