Yaohong

为了真相不惜被羞辱

How does warp Perspective work?

How does warp Perspective work? 1.warp perspective with cv2 if __name__ == "__main__": # coordinate: (y,x), left_top, right_rop, left_bottom, right_bottom src = np.float32([[20.0, 0.0], [20.0 ,315.0], [186.0, 17.2], [181.0, 299.0]]) dst = np.float32([[0.0, 0.0], [0.0, 315.0], [202.0, 7.0], [200.0, 306.0]]) # load image warp_img = cv2.imread("./my_wide_angle_orig.jpg") warp_img = cv2.cvtColor(warp_img, cv2.COLOR_BGR2RGB) print("warp_img: ",warp_img.shape) # (638, 958, 3) width = int(warp_img.shape[1]/3) height = int(warp_img.shape[0]/3) warp_img = cv2.resize(warp_img, (width,height), interpolation=cv2.INTER_LINEAR) print("warp_img.shape:",warp_img.shape) # (212, 319, 3) ## orig image plt.

Differences On Numpyp.Floor And Python Int method.md

Differences On Numpyp.Floor And Python Int method.md numpy.floor Return the floor of the input. The floor of the scalar x is the largest integer i, such that i <= x; np.floor() will not change its data type; Example: import numpy as np tmp_list = list([-3.3, -2.22, -1.56, -0.56, 0.56, 1.56, 2.22, 3.33]) tmp_list = np.array(tmp_list) print("type(tmp_list[0]):", type(tmp_list[0]) ) print("type(np.floor(tmp_list)[0]):", type(np.floor(tmp_list)[0]) ) print("np.floor(tmp_list):", np.floor(tmp_list)) # Output: # type(tmp_list[0]): <class 'numpy.float64'> # type(np.

How does numpy add two arrays with different shapes?

How does numpy add two arrays with different shapes? Numpy has a add method which add two numpy array. Arithmetic operation + does the same thing as Numpy.add; 1.Add a same shapes array Let’s see a example. import numpy as np list1 = np.array([1, 2, 3]); list2= np.array([10, 20, 30]); print("list1:",list1,"list2:",list2); # Print: list1: [1 2 3] list2: [10 20 30] added_list = list1 + list2; print("added_list.shape:",added_list.shape,"\nadded_list:",added_list); # Print: # added_list.

Understanding Transpose

Understanding Numpy Transpose 1.Transpose is to switch the row and column indices of the matrix A; x = np.arange(8).reshape((4,2)) print(x) print(x.T) # output: # [[0 1] # x # [2 3] # [4 5] # [6 7]] # [[0 2 4 6] # x.T # [1 3 5 7]] x = np.arange(9).reshape((3,3)) print(x) print(x.T) print(x.shape, x.T.shape) # output: # [[0 1 2] # [3 4 5] # [6 7 8]] # [[0 3 6] # [1 4 7] # [2 5 8]] x = np.

Understanding Numpy expand_dims

Inserting 1 into the shape brackets base on the axis value

Understanding Numpy expand_dims Shape (n,)(n is a number) means it has only one dimension. The number of values is shape brackets represents the number of dimensions. import numpy as np arr = np.array([1,2,3,4,5]); print("arr shape: ",arr.shape) print("arr shape: ",arr) arr2 = np.expand_dims(arr, 0); print("expand_dims axis=0, shape:",arr2.shape) print("expand_dims axis=0, arr2:",arr2) arr2 = np.expand_dims(arr, 1); print("expand_dims axis=1, shape:",arr2.shape) print("expand_dims axis=1, arr2:",arr2) output: arr shape: (5,) arr shape: [1 2 3 4 5] expand_dims axis=0, shape: (1, 5) expand_dims axis=0, arr2: [[1 2 3 4 5]] expand_dims axis=1, shape: (5, 1) expand_dims axis=1, arr2: [[1] [2] [3] [4] [5]] numpy.

Sed

Sed sed is a steam editor. sed treats multiple input files as one long stream. The full format for invoking sed is: sed OPTIONS... [SCRIPT] [INPUTFILE...] Some common OPTIONS: -n to suppress output, sed -n '45p' file.txt this command prints only line 45 of input file; -e options are used to specify a script expression, such as sed -e 's/hello/world/' input.txt > output.txt; -f specify a script file, such as sed -f myscript.

Simple Tree command

Simple Tree command Using the follow command can view current folder tree: find . -print| sed -e 's;[^/]*/;|____;g;s;____|; |;g' output $ find . -print| sed -e 's;[^/]*/;|____;g;s;____|; |;g' . |____composer.lock |____LICENSE |____README.md |____.gitignore |____build-phar.php |____.git | |____config | |____objects ... Below command only descend at most 2 directory levels: find . -maxdepth 2 -e -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g' REFERENCE Using a Mac Equivalent of Unix “tree” Command to View Folder Trees at Terminal

Quickly host your hugo web on Gitlab

Quickly host your hugo web on Gitlab Quickly host your hugo web on gitlab. 1.Login gitlab Gitlab 2.click new project after login Click Create from template in Create new project and use “Hugo template” In this example, my project name is: testPage Now you can see your username on Project URL, for example, mine is https://gitlab.com/RhysYao/, and username is RhysYao which will be used later. 3.Edit config.toml and commit Change the baseurl https://pages.