42 image_in_filename = os.environ[
'cFpRootDir'] +
"ROLE/vision/hls/harris/test/512x512.png"
43 image_out_filename = image_in_filename +
"_fpga_points_out_frame_" +
str(num_frame) +
".png"
52 min_size = np.amin([h,w])
53 print(
"min_size="+
str(min_size))
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)]
61 roi = crop_img[y1:y2, x1:x2]
62 resized = cv2.resize(roi , (size, size), interpolation=interpolation)
71 min_size = np.amin([h,w])
72 print(
"min_size="+
str(min_size))
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
86 image = cv2.imread(image_in_filename, cv2.IMREAD_UNCHANGED)
89 image = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
92 if ((image.shape[0] != height)
or (image.shape[1] != width)):
94 print(
"WARNING: An image of size [", height ,
" x ", width,
"] will be cropped from input image of size [", image.shape[0] ,
" x ", image.shape[1] ,
"]")
96 image =
crop_square(image_big, width, interpolation = cv2.INTER_AREA)
98 print(
"WARNING: The image was resized from [", image.shape[0] ,
" x ", image.shape[1] ,
"] to [", height ,
" x ", width,
"]")
100 image = cv2.resize(image, dim, interpolation = cv2.INTER_LINEAR)
103 image = image.flatten()
105 total_size = height * width
112 output_array = trieres.vision.median_blur(input_array, total_size,
"127.0.0.1", 2718)
115 output_array_2d = np.reshape(output_array, (height, width))
120 cv2.imwrite(image_out_filename, output_array_2d)
121 print(
"INFO: the output file is saved at : " + image_out_filename)