private void printUnweighted() { String type = imageType.getDataType(); String bitWise = imageType.getBitWise(); out.print( "\t@Override\n" + "\tprotected void computeUnweightedScore() {\n" + "\t\t// compute the score for each angle in the histogram\n" + "\t\tfor( int y = rect.y0; y < rect.y1; y++ ) {\n" + "\t\t\tint indexX = derivX.startIndex + derivX.stride*y + rect.x0;\n" + "\t\t\tint indexY = derivY.startIndex + derivY.stride*y + rect.x0;\n" + "\n" + "\t\t\tfor( int x = rect.x0; x < rect.x1; x++ , indexX++ , indexY++ ) {\n" + "\t\t\t\t" + type + " dx = derivX.data[indexX]" + bitWise + ";\n" + "\t\t\t\t" + type + " dy = derivY.data[indexY]" + bitWise + ";\n" + "\n" + "\t\t\t\tdouble angle = Math.atan2(dy,dx);\n" + "\t\t\t\t// compute which discretized angle it is\n" + "\t\t\t\tint discreteAngle = (int)((angle + angleRound)/angleDiv) % numAngles;\n" + "\t\t\t\t// sum up the \"score\" for this angle\n" + "\t\t\t\tsumDerivX[discreteAngle] += dx;\n" + "\t\t\t\tsumDerivY[discreteAngle] += dy;\n" + "\t\t\t}\n" + "\t\t}\n" + "\t}\n\n"); }
private void printPreamble() { out.print(CodeGeneratorUtil.copyright); out.print("package boofcv.alg.interpolate.impl;\n"); out.println(); out.print( "import boofcv.alg.interpolate.InterpolateRectangle;\n" + "import boofcv.struct.image." + image.getImageName() + ";\n"); if (image.getImageName().compareTo("ImageFloat32") != 0) out.println("import boofcv.struct.image.ImageFloat32;"); out.println(); out.println(); out.print( "/**\n" + " * <p>\n" + " * Performs bilinear interpolation to extract values between pixels in an image.\n" + " * Image borders are detected and handled appropriately.\n" + " * </p>\n" + " *\n" + " * <p>\n" + " * NOTE: This code was automatically generated using {@link GenerateBilinearRectangle}.\n" + " * </p>\n" + " *\n" + " * @author Peter Abeles\n" + " */\n" + "public class " + className + " implements InterpolateRectangle<" + image.getImageName() + "> {\n" + "\n" + "\tprivate " + image.getImageName() + " orig;\n" + "\n" + "\tprivate " + image.getDataType() + " data[];\n" + "\tprivate int stride;\n" + "\n" + "\tpublic " + className + "(" + image.getImageName() + " image) {\n" + "\t\tsetImage(image);\n" + "\t}\n" + "\n" + "\tpublic " + className + "() {\n" + "\t}\n\n"); }