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

Functions

def gammaCorrection (src, gamma)
 

Variables

 debug_level = logging.DEBUG
 
 stream
 
 stdout
 
 level
 
int REPEATS = 5
 
list kernels
 
 frame = cv.imread(cv.samples.findFile("CARLA.jpg"))
 
 orig_frame = cv.cvtColor(frame, cv.COLOR_RGB2GRAY)
 
 toc_capture = time.perf_counter()
 
list elapsed_times = [[0 for j in range(REPEATS)] for i in range(len(kernels))]
 
list results = [[0 for j in range(REPEATS)] for i in range(len(kernels))]
 
 start_time = time.time()
 
int blockSize = 2
 
int ksize = 3
 
float freeParameter = 0.04
 
 tmp = frame
 
list channels = [0]
 
 mask = None
 
list histSize = [256]
 
list ranges = [0,256]
 
 hist = cv.calcHist(tmp, channels, mask, histSize, ranges)
 
int t_lower = 50
 
int t_upper = 150
 
 canny = cv.Canny(frame, t_lower, t_upper)
 
 lines = cv.HoughLines(canny, 1, np.pi / 180, 150, None, 0, 0)
 
 x = cv.Sobel(frame, cv.CV_64F, 1, 0, ksize=5)
 
 y = cv.Sobel(frame, cv.CV_64F, 0, 1, ksize=5)
 
 absx = cv.convertScaleAbs(x)
 
 absy = cv.convertScaleAbs(y)
 
 ddepth = cv.CV_16S
 
int kernel_size = 5
 
 source
 
 destination
 
 grid_x
 
 grid_y
 
 grid_z = griddata(destination, source, (grid_x, grid_y), method='cubic')
 
 map_x = np.append([], [ar[:,1] for ar in grid_z]).reshape(784,784)
 
 map_y = np.append([], [ar[:,0] for ar in grid_z]).reshape(784,784)
 
 map_x_32 = map_x.astype('float32')
 
 map_y_32 = map_y.astype('float32')
 
 rows
 
 cols
 
 input_pts = np.float32([[0,0], [cols-1,0], [0,rows-1]])
 
 output_pts = np.float32([[cols-1,0], [0,0], [cols-1,rows-1]])
 
 M = cv.getAffineTransform(input_pts , output_pts)
 
 hog = cv.HOGDescriptor()
 
 h = hog.compute(frame)
 
 end_time = time.time()
 
string image_name = "CARLA_out_kernel_" + kernels[i] + ".jpg"
 
int average_elapsed_time = sum(elapsed_times) / REPEATS
 
 df = pd.DataFrame(elapsed_times)
 
 ax = sns.boxplot(data=df)
 
 loc
 
 axis
 
 labelrotation
 
 fontsize
 
 x1
 
 y1
 
 x2
 
 y2
 

Function Documentation

◆ gammaCorrection()

def test_harris_standalone.gammaCorrection (   src,
  gamma 
)

Definition at line 63 of file test_harris_standalone.py.

63 def gammaCorrection(src, gamma):
64  invGamma = 1 / gamma
65 
66  table = [((i / 255) ** invGamma) * 255 for i in range(256)]
67  table = np.array(table, np.uint8)
68 
69  return cv.LUT(src, table)
70 
71 
72 
73 
74 
75 # When everything done, release the video capture object

Variable Documentation

◆ absx

test_harris_standalone.absx = cv.convertScaleAbs(x)

Definition at line 129 of file test_harris_standalone.py.

◆ absy

test_harris_standalone.absy = cv.convertScaleAbs(y)

Definition at line 130 of file test_harris_standalone.py.

◆ average_elapsed_time

int test_harris_standalone.average_elapsed_time = sum(elapsed_times) / REPEATS

Definition at line 203 of file test_harris_standalone.py.

◆ ax

test_harris_standalone.ax = sns.boxplot(data=df)

Definition at line 215 of file test_harris_standalone.py.

◆ axis

test_harris_standalone.axis

Definition at line 218 of file test_harris_standalone.py.

◆ blockSize

int test_harris_standalone.blockSize = 2

Definition at line 94 of file test_harris_standalone.py.

◆ canny

test_harris_standalone.canny = cv.Canny(frame, t_lower, t_upper)

Definition at line 118 of file test_harris_standalone.py.

◆ channels

list test_harris_standalone.channels = [0]

Definition at line 106 of file test_harris_standalone.py.

◆ cols

test_harris_standalone.cols

Definition at line 167 of file test_harris_standalone.py.

◆ ddepth

test_harris_standalone.ddepth = cv.CV_16S

Definition at line 135 of file test_harris_standalone.py.

◆ debug_level

test_harris_standalone.debug_level = logging.DEBUG

Definition at line 47 of file test_harris_standalone.py.

◆ destination

test_harris_standalone.destination
Initial value:
1 = np.array([
2  [14, 14],
3  [770, 14],
4  [238, 238],
5  [546, 238],
6  [238, 546],
7  [546, 546],
8  [14, 770],
9  [770, 770]
10  ], dtype=int)

Definition at line 149 of file test_harris_standalone.py.

◆ df

test_harris_standalone.df = pd.DataFrame(elapsed_times)

Definition at line 213 of file test_harris_standalone.py.

◆ elapsed_times

test_harris_standalone.elapsed_times = [[0 for j in range(REPEATS)] for i in range(len(kernels))]

Definition at line 80 of file test_harris_standalone.py.

◆ end_time

test_harris_standalone.end_time = time.time()

Definition at line 194 of file test_harris_standalone.py.

◆ fontsize

test_harris_standalone.fontsize

Definition at line 220 of file test_harris_standalone.py.

◆ frame

test_harris_standalone.frame = cv.imread(cv.samples.findFile("CARLA.jpg"))

Definition at line 55 of file test_harris_standalone.py.

◆ freeParameter

float test_harris_standalone.freeParameter = 0.04

Definition at line 96 of file test_harris_standalone.py.

◆ grid_x

test_harris_standalone.grid_x

Definition at line 159 of file test_harris_standalone.py.

◆ grid_y

test_harris_standalone.grid_y

Definition at line 159 of file test_harris_standalone.py.

◆ grid_z

test_harris_standalone.grid_z = griddata(destination, source, (grid_x, grid_y), method='cubic')

Definition at line 160 of file test_harris_standalone.py.

◆ h

test_harris_standalone.h = hog.compute(frame)

Definition at line 191 of file test_harris_standalone.py.

◆ hist

test_harris_standalone.hist = cv.calcHist(tmp, channels, mask, histSize, ranges)

Definition at line 111 of file test_harris_standalone.py.

◆ histSize

list test_harris_standalone.histSize = [256]

Definition at line 108 of file test_harris_standalone.py.

◆ hog

test_harris_standalone.hog = cv.HOGDescriptor()

Definition at line 190 of file test_harris_standalone.py.

◆ image_name

string test_harris_standalone.image_name = "CARLA_out_kernel_" + kernels[i] + ".jpg"

Definition at line 198 of file test_harris_standalone.py.

◆ input_pts

test_harris_standalone.input_pts = np.float32([[0,0], [cols-1,0], [0,rows-1]])

Definition at line 177 of file test_harris_standalone.py.

◆ kernel_size

int test_harris_standalone.kernel_size = 5

Definition at line 136 of file test_harris_standalone.py.

◆ kernels

list test_harris_standalone.kernels
Initial value:
1 = ["MedianFilter", "HarrisDetector", "Histogram", "CannyEdgeDetector", "HoughLineTransform",
2  "Demosaicing", "GammaCorrection", "Sobel", "GaussianBlur", "Laplacian", "Remap", "PyrUp",
3  "PyrDown", "Rotate", "WarpAffine", "HOGDescriptor"]

Definition at line 51 of file test_harris_standalone.py.

◆ ksize

test_harris_standalone.ksize = 3

Definition at line 95 of file test_harris_standalone.py.

◆ labelrotation

test_harris_standalone.labelrotation

Definition at line 218 of file test_harris_standalone.py.

◆ level

test_harris_standalone.level

Definition at line 48 of file test_harris_standalone.py.

◆ lines

test_harris_standalone.lines = cv.HoughLines(canny, 1, np.pi / 180, 150, None, 0, 0)

Definition at line 121 of file test_harris_standalone.py.

◆ loc

test_harris_standalone.loc

Definition at line 217 of file test_harris_standalone.py.

◆ M

test_harris_standalone.M = cv.getAffineTransform(input_pts , output_pts)

Definition at line 186 of file test_harris_standalone.py.

◆ map_x

test_harris_standalone.map_x = np.append([], [ar[:,1] for ar in grid_z]).reshape(784,784)

Definition at line 161 of file test_harris_standalone.py.

◆ map_x_32

test_harris_standalone.map_x_32 = map_x.astype('float32')

Definition at line 163 of file test_harris_standalone.py.

◆ map_y

test_harris_standalone.map_y = np.append([], [ar[:,0] for ar in grid_z]).reshape(784,784)

Definition at line 162 of file test_harris_standalone.py.

◆ map_y_32

test_harris_standalone.map_y_32 = map_y.astype('float32')

Definition at line 164 of file test_harris_standalone.py.

◆ mask

test_harris_standalone.mask = None

Definition at line 107 of file test_harris_standalone.py.

◆ orig_frame

test_harris_standalone.orig_frame = cv.cvtColor(frame, cv.COLOR_RGB2GRAY)

Definition at line 59 of file test_harris_standalone.py.

◆ output_pts

test_harris_standalone.output_pts = np.float32([[cols-1,0], [0,0], [cols-1,rows-1]])

Definition at line 178 of file test_harris_standalone.py.

◆ ranges

list test_harris_standalone.ranges = [0,256]

Definition at line 109 of file test_harris_standalone.py.

◆ REPEATS

int test_harris_standalone.REPEATS = 5

Definition at line 50 of file test_harris_standalone.py.

◆ results

list test_harris_standalone.results = [[0 for j in range(REPEATS)] for i in range(len(kernels))]

Definition at line 81 of file test_harris_standalone.py.

◆ rows

test_harris_standalone.rows

Definition at line 167 of file test_harris_standalone.py.

◆ source

test_harris_standalone.source
Initial value:
1 = np.array([
2  [315, 15],
3  [962, 18],
4  [526, 213],
5  [754, 215],
6  [516, 434],
7  [761, 433],
8  [225, 701],
9  [1036, 694],
10  ], dtype=int)

Definition at line 139 of file test_harris_standalone.py.

◆ start_time

test_harris_standalone.start_time = time.time()

Definition at line 87 of file test_harris_standalone.py.

◆ stdout

test_harris_standalone.stdout

Definition at line 48 of file test_harris_standalone.py.

◆ stream

test_harris_standalone.stream

Definition at line 48 of file test_harris_standalone.py.

◆ t_lower

int test_harris_standalone.t_lower = 50

Definition at line 115 of file test_harris_standalone.py.

◆ t_upper

int test_harris_standalone.t_upper = 150

Definition at line 116 of file test_harris_standalone.py.

◆ tmp

list test_harris_standalone.tmp = frame

Definition at line 101 of file test_harris_standalone.py.

◆ toc_capture

test_harris_standalone.toc_capture = time.perf_counter()

Definition at line 76 of file test_harris_standalone.py.

◆ x

test_harris_standalone.x = cv.Sobel(frame, cv.CV_64F, 1, 0, ksize=5)

Definition at line 127 of file test_harris_standalone.py.

◆ x1

test_harris_standalone.x1

Definition at line 230 of file test_harris_standalone.py.

◆ x2

test_harris_standalone.x2

Definition at line 230 of file test_harris_standalone.py.

◆ y

test_harris_standalone.y = cv.Sobel(frame, cv.CV_64F, 0, 1, ksize=5)

Definition at line 128 of file test_harris_standalone.py.

◆ y1

test_harris_standalone.y1

Definition at line 230 of file test_harris_standalone.py.

◆ y2

test_harris_standalone.y2

Definition at line 230 of file test_harris_standalone.py.