Sample code for
- numpy to CSV
- numpy to pandas
- pandas to CSV
importnumpyasnpimportpandasaspdf1_numpy="./data/test1.csv"f2_pandas="./data/test2.csv"#numpy to csvnp.savetxt(f1_numpy,np.array([10,20]))print(f1_numpy)#numpy to pandas and csvpda=pd.DataFrame(np.array([10,20]),columns=['data'])pda.to_csv(f2_pandas,index=False)
This is perspective example source code.
Basically, perspective is multiple by H(homography) matrix.
Like this : B = H*A
In here, B is perspective image, A is original image and H is homography matrix.
For this calculate, we can use opencv function this -> warpPerspective(..)
easily.
And to find H, we also can use findHomography opencv function as well.
and below source code:
code looks a little complicated, but just see getPerspectiveImg function carefully, other codes are just for making random and set value.
This article is example source code for
3D array numpy -> pandas -> csv -> pandas -> 3D array numpy
Let's see step by step
Step 1, make example data
importnumpyasnpimportpandasaspd#make lista=[[11,12,13,14,15],[15,16,17,18,19]]b=[[21,22,23,24,25],[25,26,27,28,29]]c=[]c.append(a)c.append(b)#make numpynpa=np.array(c)print('npa\n',npa)print('npa shape\n',npa.shape)#2 by 2 by 5