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

Functions

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

Variables

int height = 256
 
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)
 
int total_size = height * width
 
 input_array = image
 
 output_array = trieres.vision.median_blur(input_array, total_size, "127.0.0.1", 2718)
 
 output_array_2d = np.reshape(output_array, (height, width))
 

Function Documentation

◆ crop_square()

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

Definition at line 48 of file test_median_blur_numpi.py.

48 def crop_square(img, size, interpolation=cv2.INTER_AREA):
49  h, w = img.shape[:2]
50  print("h="+str(h))
51  print("w="+str(w))
52  min_size = np.amin([h,w])
53  print("min_size="+str(min_size))
54 
55  # Centralize and crop
56  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)]
57  y1=10
58  y2=y1+100
59  x1=10
60  x2=x1+100
61  roi = crop_img[y1:y2, x1:x2]
62  resized = cv2.resize(roi , (size, size), interpolation=interpolation)
63 
64  return resized
65 
66 
def crop_square(img, size, interpolation=cv2.INTER_AREA)

◆ patch_square()

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

Definition at line 67 of file test_median_blur_numpi.py.

67 def patch_square(crop_img, img, interpolation=cv2.INTER_AREA):
68  h, w = img.shape[:2]
69  print("h="+str(h))
70  print("w="+str(w))
71  min_size = np.amin([h,w])
72  print("min_size="+str(min_size))
73 
74  # Centralize and patch
75  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
76 
77  return img
78 
79 
80 
81 
82 
83 
def patch_square(crop_img, img, interpolation=cv2.INTER_AREA)

Variable Documentation

◆ dim

tuple test_median_blur_numpi.dim = (width, height)

Definition at line 99 of file test_median_blur_numpi.py.

◆ height

int test_median_blur_numpi.height = 256

Definition at line 37 of file test_median_blur_numpi.py.

◆ image

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

Definition at line 86 of file test_median_blur_numpi.py.

◆ image_big

test_median_blur_numpi.image_big = image

Definition at line 95 of file test_median_blur_numpi.py.

◆ image_in_filename

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

Definition at line 42 of file test_median_blur_numpi.py.

◆ image_out_filename

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

Definition at line 43 of file test_median_blur_numpi.py.

◆ input_array

test_median_blur_numpi.input_array = image

Definition at line 107 of file test_median_blur_numpi.py.

◆ num_frame

int test_median_blur_numpi.num_frame = 1

Definition at line 39 of file test_median_blur_numpi.py.

◆ output_array

test_median_blur_numpi.output_array = trieres.vision.median_blur(input_array, total_size, "127.0.0.1", 2718)

Definition at line 112 of file test_median_blur_numpi.py.

◆ output_array_2d

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

Definition at line 115 of file test_median_blur_numpi.py.

◆ ROI

bool test_median_blur_numpi.ROI = False

Definition at line 45 of file test_median_blur_numpi.py.

◆ total_size

int test_median_blur_numpi.total_size = height * width

Definition at line 105 of file test_median_blur_numpi.py.