cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
test_median_blur Namespace Reference

Functions

def crop_square (img, size, interpolation=cv2.INTER_AREA)
 
def patch_square (crop_img, img, interpolation=cv2.INTER_AREA)
 

Variables

string trieres_lib = os.environ['cFpRootDir'] + "HOST/"
 
string config_file = os.environ['cFpRootDir'] + "HOST/vision/median_blur/languages/cplusplus/include/config.h"
 
 width = int(line.split()[2])
 
 height = int(line.split()[2])
 
 total_size = height * width
 
int num_frame = 1
 
string image_in_filename = os.environ['cFpRootDir'] + "ROLE/vision/hls/harris/test/512x512.png"
 
string image_out_filename = image_in_filename + "_fpga_points_out_frame_" + str(num_frame) + ".png"
 
bool ROI = False
 
 image = cv2.imread(image_in_filename, cv2.IMREAD_UNCHANGED)
 
 image_big = image
 
tuple dim = (width, height)
 
 input_array = image
 
 output_array = vision.median_blur(input_array, total_size, "10.12.200.66", 2718, logging.ERROR)
 
 output_array_2d = np.reshape(output_array, (height, width))
 

Function Documentation

◆ crop_square()

def test_median_blur.crop_square (   img,
  size,
  interpolation = cv2.INTER_AREA 
)

Definition at line 60 of file test_median_blur.py.

60 def crop_square(img, size, interpolation=cv2.INTER_AREA):
61  h, w = img.shape[:2]
62  print("h="+str(h))
63  print("w="+str(w))
64  min_size = np.amin([h,w])
65  print("min_size="+str(min_size))
66 
67  # Centralize and crop
68  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)]
69  y1=10
70  y2=y1+100
71  x1=10
72  x2=x1+100
73  roi = crop_img[y1:y2, x1:x2]
74  resized = cv2.resize(roi , (size, size), interpolation=interpolation)
75 
76  return resized
77 
78 
def crop_square(img, size, interpolation=cv2.INTER_AREA)

◆ patch_square()

def test_median_blur.patch_square (   crop_img,
  img,
  interpolation = cv2.INTER_AREA 
)

Definition at line 79 of file test_median_blur.py.

79 def patch_square(crop_img, img, interpolation=cv2.INTER_AREA):
80  h, w = img.shape[:2]
81  print("h="+str(h))
82  print("w="+str(w))
83  min_size = np.amin([h,w])
84  print("min_size="+str(min_size))
85 
86  # Centralize and patch
87  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
88 
89  return img
90 
91 
92 
93 
def patch_square(crop_img, img, interpolation=cv2.INTER_AREA)

Variable Documentation

◆ config_file

string test_median_blur.config_file = os.environ['cFpRootDir'] + "HOST/vision/median_blur/languages/cplusplus/include/config.h"

Definition at line 36 of file test_median_blur.py.

◆ dim

tuple test_median_blur.dim = (width, height)

Definition at line 109 of file test_median_blur.py.

◆ height

test_median_blur.height = int(line.split()[2])

Definition at line 43 of file test_median_blur.py.

◆ image

def test_median_blur.image = cv2.imread(image_in_filename, cv2.IMREAD_UNCHANGED)

Definition at line 96 of file test_median_blur.py.

◆ image_big

test_median_blur.image_big = image

Definition at line 105 of file test_median_blur.py.

◆ image_in_filename

string test_median_blur.image_in_filename = os.environ['cFpRootDir'] + "ROLE/vision/hls/harris/test/512x512.png"

Definition at line 54 of file test_median_blur.py.

◆ image_out_filename

string test_median_blur.image_out_filename = image_in_filename + "_fpga_points_out_frame_" + str(num_frame) + ".png"

Definition at line 55 of file test_median_blur.py.

◆ input_array

test_median_blur.input_array = image

Definition at line 117 of file test_median_blur.py.

◆ num_frame

int test_median_blur.num_frame = 1

Definition at line 51 of file test_median_blur.py.

◆ output_array

test_median_blur.output_array = vision.median_blur(input_array, total_size, "10.12.200.66", 2718, logging.ERROR)

Definition at line 121 of file test_median_blur.py.

◆ output_array_2d

test_median_blur.output_array_2d = np.reshape(output_array, (height, width))

Definition at line 124 of file test_median_blur.py.

◆ ROI

bool test_median_blur.ROI = False

Definition at line 57 of file test_median_blur.py.

◆ total_size

test_median_blur.total_size = height * width

Definition at line 46 of file test_median_blur.py.

◆ trieres_lib

string test_median_blur.trieres_lib = os.environ['cFpRootDir'] + "HOST/"

Definition at line 31 of file test_median_blur.py.

◆ width

test_median_blur.width = int(line.split()[2])

Definition at line 41 of file test_median_blur.py.