cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
test_warp_transform_numpi 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/vision/warp_transform/languages/python/build"
 
int height = 256
 
int num_frame = 1
 
string image_in_filename = os.environ['cFpRootDir'] + "ROLE/vision/hls/warp_transform/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_warp_transform_numpi.warp_transform(input_array, total_size, "10.12.200.122", "2718")
 
 output_array_2d = np.reshape(output_array, (height, width))
 

Function Documentation

◆ crop_square()

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

Definition at line 47 of file test_warp_transform_numpi.py.

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

◆ patch_square()

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

Definition at line 66 of file test_warp_transform_numpi.py.

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

Variable Documentation

◆ dim

tuple test_warp_transform_numpi.dim = (width, height)

Definition at line 98 of file test_warp_transform_numpi.py.

◆ height

int test_warp_transform_numpi.height = 256

Definition at line 36 of file test_warp_transform_numpi.py.

◆ image

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

Definition at line 85 of file test_warp_transform_numpi.py.

◆ image_big

test_warp_transform_numpi.image_big = image

Definition at line 94 of file test_warp_transform_numpi.py.

◆ image_in_filename

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

Definition at line 41 of file test_warp_transform_numpi.py.

◆ image_out_filename

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

Definition at line 42 of file test_warp_transform_numpi.py.

◆ input_array

test_warp_transform_numpi.input_array = image

Definition at line 106 of file test_warp_transform_numpi.py.

◆ num_frame

int test_warp_transform_numpi.num_frame = 1

Definition at line 38 of file test_warp_transform_numpi.py.

◆ output_array

test_warp_transform_numpi.output_array = _trieres_warp_transform_numpi.warp_transform(input_array, total_size, "10.12.200.122", "2718")

Definition at line 110 of file test_warp_transform_numpi.py.

◆ output_array_2d

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

Definition at line 113 of file test_warp_transform_numpi.py.

◆ ROI

bool test_warp_transform_numpi.ROI = False

Definition at line 44 of file test_warp_transform_numpi.py.

◆ total_size

int test_warp_transform_numpi.total_size = height * width

Definition at line 104 of file test_warp_transform_numpi.py.

◆ trieres_lib

string test_warp_transform_numpi.trieres_lib = os.environ['cFpRootDir'] + "HOST/vision/warp_transform/languages/python/build"

Definition at line 30 of file test_warp_transform_numpi.py.