⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 createpatterns.java

📁 All the tool for build a network able to reconize any shapes. Very complete, a good base for anythi
💻 JAVA
字号:
package mouse;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;

import jnt.FFT.ComplexDouble2DFFT;



public class createPatterns {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		
		mouseTracker myMouseTracker = new mouseTracker();

		int size =34;
		
		int choice;
		
		int ind;
		
		double[] newPict= new double[myMouseTracker.yResolution*myMouseTracker.xResolution*2];
		
		double[] transPict= new double[size*size*2];
		
		double[][] newMat = new double[size*2][size];
		
		File outputFile = new File("AirWin_training2.csv");

			FileWriter out = new FileWriter(outputFile);
			
			ComplexDouble2DFFT methodes = new ComplexDouble2DFFT(myMouseTracker.xResolution, myMouseTracker.yResolution);
				
		for(int i=0; i<120; i++)
		{
			System.out.println(i);
			myMouseTracker.fill();
			ind=0;
			for (int j=0; j<myMouseTracker.yResolution; j++){
				for (int k=0; k<myMouseTracker.xResolution; k++){
					newPict[ind++]=myMouseTracker.binaryMap[k][j];
					newPict[ind++]=0;
				}
			}
		
		methodes.transform(newPict);
		
		ind = 0;
		for (int k=0; k<newPict.length ;k++){
			if ((k%myMouseTracker.xResolution*2<=size || k%myMouseTracker.xResolution*2>myMouseTracker.xResolution*2-size) && (k<(myMouseTracker.xResolution*2)*(size/2) || k>=(myMouseTracker.xResolution*myMouseTracker.yResolution*2)-(myMouseTracker.xResolution*2)*(size/2))){
				transPict[ind++]=newPict[k];
			}
		}
		for(int j=0; j<transPict.length;j++){
				newMat[j%(size*2)][j/(size*2)]=transPict[j];
		}
		
			for (int j=0; j<size; j++){
				for (int k=0; k<size*2; k++){
					if (j!=size-1 || k!=size*2-1) {
						out.write(newMat[k][j] + ";");
					}else{
						Reader reader = new InputStreamReader(System.in); 
						BufferedReader input = new BufferedReader(reader); 
						while (true){
						System.out.print("1 - rond\n2 - croix\n3 - 3 barres horizontales\n4 - 3 barres verticales : "); 
						choice = Integer.parseInt(input.readLine());
						if (choice>0 && choice<5)
							break;
						}
						switch (choice){
						case 1:
							out.write(newMat[k][j]+";"+1.0+";"+ -1.0+";"+ -1.0+";"+ -1.0+"\n");
							break;
						case 2:
							out.write(newMat[k][j]+";"+ -1.0+";"+1.0+";"+ -1.0+";"+ -1.0+"\n");
							break;
						case 3:
							out.write(newMat[k][j]+";"+ -1.0+";"+ -1.0+";"+1.0+";"+ -1.0+"\n");
							break;
						case 4:
							out.write(newMat[k][j]+";"+ -1.0+";"+ -1.0+";"+ -1.0+";"+1.0+"\n");
							break;
						}	
						out.flush();
					}
						
				}
			}	
		}
		out.close();
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -