CDMS/src/CDMS/swiatlow/ImageMapperII
diff -u -r1.5 -r1.6
--- ImageMapperII.java 13 Apr 2011 09:31:01 -0000 1.5
+++ ImageMapperII.java 21 Apr 2011 20:45:43 -0000 1.6
@@ -20,6 +20,8 @@
public class ImageMapperII {
private static final int INTERESTING_CUT = 1;
+ private static final int PIX_WIDEN = 2;
+
private static final double pixWidth = 45.0;
private static final double pixHeight = 33.0;
@@ -52,7 +54,10 @@
private int dPrint;
String outFolderBroken;
- public ImageMapperII(String imageFile, String outFile, int debugFlag) throws IOException{
+ private int sideNum;
+
+ public ImageMapperII(int side, String imageFile, String outFile, int debugFlag) throws IOException{
+ sideNum = side;
dPrint = 0;
doLowRes = false;
outFolderBroken = "/Users/maxinion/Documents/Work/CDMS/imagingII/out2-28/broken/";
@@ -118,8 +123,8 @@
}
//alternative longer constructor, with full debugbroken stuff
- public ImageMapperII(String imageFile, String outFile, int debugFlag, int printBroken, String outBroken) throws IOException{
- this(imageFile, outFile, debugFlag);
+ public ImageMapperII(int side, String imageFile, String outFile, int debugFlag, int printBroken, String outBroken) throws IOException{
+ this(side, imageFile, outFile, debugFlag);
dPrint = printBroken;
outFolderBroken = outBroken;
}
@@ -163,25 +168,37 @@
// return the coordinates of the subimage we take as we grid
// normally just a box of size defined by the 620x460 camera pixel grid
// sometimes, at the edges, have to define subimages only up to the edges
- int[] out = new int[2];
+ int[] out = new int[4];
+ out[0] = (int) pixWidth*i;
+ out[1] = (int) pixHeight*j;
if(i < nPixWidth-1 && j < nPixHeight -1){ // normal areas
- out[0] = (int) pixWidth;
- out[1] = (int) pixHeight;
+ out[2] = (int) pixWidth;
+ out[3] = (int) pixHeight;
}
else if(i < nPixWidth -1 && j == nPixHeight -1){ // at the bottom
- out[0] = (int) pixWidth;
- out[1] = (int) (imageHeight - pixHeight*j);
+ out[2] = (int) pixWidth;
+ out[3] = (int) (imageHeight - pixHeight*j);
}
else if(i == nPixWidth-1 && j < nPixHeight -1){// at the right
- out[0] = (int) (imageWidth - pixWidth*i);
- out[1] = (int) pixHeight;
+ out[2] = (int) (imageWidth - pixWidth*i);
+ out[3] = (int) pixHeight;
}
else{ // at the bottom right
if(debug==1) System.out.println("At the bottom right: should only be here once. i = " + i +" j = " + j);
- out[0] = (int) (imageWidth - pixWidth*i);
- out[1] = (int) (imageHeight - pixHeight*j);
+ out[2] = (int) (imageWidth - pixWidth*i);
+ out[3] = (int) (imageHeight - pixHeight*j);
+ }
+
+ if(i!=0 && i!= nPixWidth-1){ // in the left-right middle, not along the edge
+ out[0] = out[0] - PIX_WIDEN; //if(debug==1) System.out.println("widen i=" + i);
+ out[2] = out[2] + 2 * PIX_WIDEN;
+ }
+ if(j!=0 && j!=nPixHeight-1){ // in the top-bottom middle, not along the edge
+ out[1] = out[1] - PIX_WIDEN; //if(debug==1) System.out.println("widen j=" + j);
+ out[3] = out[3] + 2 * PIX_WIDEN;
}
+
return out;
}
@@ -190,8 +207,8 @@
for(int i = 0; i < nPixWidth; i++){
for(int j =0; j < nPixHeight; j++){
int[] boxCoords = getSubCoords(i,j);
- BufferedImage sub = image.getSubimage((int) pixWidth*i, (int) pixHeight*j,
- boxCoords[0], boxCoords[1]);
+ BufferedImage sub = image.getSubimage(boxCoords[0], boxCoords[1],
+ boxCoords[2], boxCoords[3]);
if(isInteresting(sub))
flag[i][j] = true;
@@ -207,7 +224,8 @@
output.write("BEGIN_RUN\n");
output.write("MM\n");
output.write("SET_DATUM\n");
- output.write("c:\\Partrtn\\IZipDatum_PeaceSide1_x2_5.RTN\n");
+ if(sideNum == 1) output.write("c:\\Partrtn\\IZipDatum_PeaceSide1_x2_5.RTN\n");
+ else if(sideNum == 2) output.write("c:\\Partrtn\\IZipDatum_PeaceSide2_x2_5.RTN\n");
}
//loop over flag list; if set to true, then output
@@ -236,7 +254,7 @@
fmt1.format("%.6f", coord[0]);
fmt2.format("%.6f", coord[1]);
- if(debug==0) output.write("c:\\Partrtn\\IZipOriginTakePicture_x2_5.RTN,"+fmt1+","+fmt2+",0,0,0,0\n");
+ if(debug==0) output.write("c:\\Partrtn\\IZipOriginTakePicture_x690.RTN,"+fmt1+","+fmt2+",0,0,0,0\n");
else if(debug==1) output.write(fmt1+","+fmt2+"\n");
}
CDMS/src/CDMS/swiatlow/ImageMapperII
diff -u -r1.5 -r1.6
--- ImageMapperIIRun.java 13 Apr 2011 09:31:01 -0000 1.5
+++ ImageMapperIIRun.java 21 Apr 2011 20:45:43 -0000 1.6
@@ -10,11 +10,11 @@
public static void main(String[] args) {
try {
- ImageMapperII mapper = new ImageMapperII("/Users/maxinion/Documents/Work/CDMS/imagingII/qets-hires1.png",
- "/Users/maxinion/Documents/Work/CDMS/imagingII/out4-11/qets1-out.txt",0);
+ ImageMapperII mapper = new ImageMapperII(1,"/Users/maxinion/Documents/Work/CDMS/imagingII/qets-hires-charge1.png",
+ "/Users/maxinion/Documents/Work/CDMS/imagingII/out4-21/qets1-charge-out.txt",0);
mapper.enableLowRes("/Users/maxinion/Documents/Work/CDMS/imagingII/OGP_scansettings_6Apr11_x177.txt");
mapper.doAll();
- //mapper.roughStitch("/Users/maxinion/Desktop/MaxScanTestL09FullII/MaxScanTestL09FullII-","/Users/maxinion/Desktop/stitched.png");
+ //mapper.roughStitch("/Users/maxinion/Desktop/IZipTestWaferBatch28_L13_Side2/IZipTestWaferBatch28_L13_Side2HR-","/Users/maxinion/Desktop/stitched-charge-2.png");
} catch (IOException e) {
e.printStackTrace();
}