public char characterRecognisation() { PixelExtraction pixelExtraction = new PixelExtraction(); imgB2W = pixelExtraction.Img2BW(characterBitmap, BWThresh); Normalization normalization = new Normalization(pixelExtraction.getAllPoints(), pixelExtraction.getCountPoints()); PCA pca = new PCA(); // added for the test pca.setTotalCount(pixelExtraction.getCountPoints()); double[][] data = new double[5][]; for (int i = 0; i < 5; i++) { data[i] = new double[5]; } deg_value = new double[5][]; for (int i = 0; i < 5; i++) { deg_value[i] = new double[2]; } // 0 degree rotation // Console.WriteLine("0 degree rotation"); pca.pcaCalculation(normalization.getNormPoints()); data[0] = pca.getEigenVector(); deg_value[0] = pca.getEigenValue(); // Console.WriteLine("data[0]" + data[0][0] + "dafds" + data[0][1] + "0 3" + data[0][3] ); // Console.WriteLine("22 degree rotation"); Normalization normalization1 = new Normalization(normalization.getNormPointsProjection22(), pixelExtraction.getCountPoints()); pca.pcaCalculation(normalization1.getNormPoints()); data[1] = pca.getEigenVector(); deg_value[1] = pca.getEigenValue(); // Console.WriteLine("45 degree rotation"); Normalization normalization3 = new Normalization(normalization.getNormPointsProjection45(), pixelExtraction.getCountPoints()); pca.pcaCalculation(normalization3.getNormPoints()); data[2] = pca.getEigenVector(); deg_value[2] = pca.getEigenValue(); // Console.WriteLine("67 degree rotation"); Normalization normalization4 = new Normalization(normalization.getNormPointsProjection67(), pixelExtraction.getCountPoints()); pca.pcaCalculation(normalization4.getNormPoints()); data[3] = pca.getEigenVector(); deg_value[3] = pca.getEigenValue(); // Console.WriteLine("90 degree rotation"); Normalization normalization5 = new Normalization(normalization.getNormPointsProjection90(), pixelExtraction.getCountPoints()); pca.pcaCalculation(normalization5.getNormPoints()); data[4] = pca.getEigenVector(); deg_value[4] = pca.getEigenValue(); DatabaseConnection connection = new DatabaseConnection(); connection.retrieveDatabase(data, deg_value); //characters += connection.getRecognisedCharacter(); return(connection.getRecognisedCharacter()); // Console.WriteLine(" the main window characters" + characters); }
public char characterRecognisation() { PixelExtraction pixelExtraction = new PixelExtraction(); imgB2W = pixelExtraction.Img2BW(characterBitmap, BWThresh); Normalization normalization = new Normalization(pixelExtraction.getAllPoints(), pixelExtraction.getCountPoints()); PCA pca = new PCA(); // added for the test pca.setTotalCount(pixelExtraction.getCountPoints()); double[][] data = new double[5][]; for (int i = 0; i < 5; i++) { data[i] = new double[5]; } deg_value = new double[5][]; for (int i = 0; i < 5; i++) { deg_value[i] = new double[2]; } // 0 degree rotation // Console.WriteLine("0 degree rotation"); pca.pcaCalculation(normalization.getNormPoints()); data[0] = pca.getEigenVector(); deg_value[0] = pca.getEigenValue(); // Console.WriteLine("data[0]" + data[0][0] + "dafds" + data[0][1] + "0 3" + data[0][3] ); // Console.WriteLine("22 degree rotation"); Normalization normalization1 = new Normalization(normalization.getNormPointsProjection22(), pixelExtraction.getCountPoints()); pca.pcaCalculation(normalization1.getNormPoints()); data[1] = pca.getEigenVector(); deg_value[1] = pca.getEigenValue(); // Console.WriteLine("45 degree rotation"); Normalization normalization3 = new Normalization(normalization.getNormPointsProjection45(), pixelExtraction.getCountPoints()); pca.pcaCalculation(normalization3.getNormPoints()); data[2] = pca.getEigenVector(); deg_value[2] = pca.getEigenValue(); // Console.WriteLine("67 degree rotation"); Normalization normalization4 = new Normalization(normalization.getNormPointsProjection67(), pixelExtraction.getCountPoints()); pca.pcaCalculation(normalization4.getNormPoints()); data[3] = pca.getEigenVector(); deg_value[3] = pca.getEigenValue(); // Console.WriteLine("90 degree rotation"); Normalization normalization5 = new Normalization(normalization.getNormPointsProjection90(), pixelExtraction.getCountPoints()); pca.pcaCalculation(normalization5.getNormPoints()); data[4] = pca.getEigenVector(); deg_value[4] = pca.getEigenValue(); DatabaseConnection connection = new DatabaseConnection(); connection.retrieveDatabase(data, deg_value); //characters += connection.getRecognisedCharacter(); return connection.getRecognisedCharacter(); // Console.WriteLine(" the main window characters" + characters); }