CDMS/src/CDMS/swiatlow/ImageMapperII
diff -u -r1.3 -r1.4
--- ImageMapperII.java 7 Mar 2011 23:07:15 -0000 1.3
+++ ImageMapperII.java 2 Apr 2011 07:09:02 -0000 1.4
@@ -11,11 +11,13 @@
import javax.imageio.ImageIO;
import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.geom.AffineTransform;
import java.awt.image.*;
public class ImageMapperII {
- private static final int INTERESTING_CUT = 20;
+ private static final int INTERESTING_CUT = 10;
private static final boolean LEVELLING_ON = false;
private static final double pixWidth = 45.0;
@@ -204,7 +206,7 @@
return out;
}
-
+
private boolean isInteresting(BufferedImage sub){
int subWidth = sub.getWidth();
int subHeight = sub.getHeight();
@@ -224,7 +226,7 @@
// if there are enough non-white pixels, it's interesting
if(nColorPix > INTERESTING_CUT){
if(debug==1){
- if(dPrint==1){
+ if(dPrint==1){ // fun debugging tool
try {
File outputfile = new File("/Users/maxinion/Documents/Work/CDMS/imagingII/out2-28/broken/b"+dPrintCounter+".jpg");
ImageIO.write(sub, "jpg", outputfile);
@@ -240,4 +242,42 @@
}
return false;
}
+
+
+ public void roughStitch() throws IOException{
+ System.out.println("Doing the rough stitching!");
+
+ image = null; // kill the stored image for memory reasons
+
+ BufferedImage stitched = new BufferedImage((int) imageWidth,(int) imageHeight,BufferedImage.TYPE_INT_RGB);
+ Graphics2D g2 = stitched.createGraphics();
+
+ int count = 1;
+
+ for(int i=0; i < nPixWidth-1; i++){
+ for(int j=0; j < nPixHeight-1; j++){
+ System.out.println("At " + i + " and " + j + ": flag is " + flag[i][j]);
+ if(flag[i][j]){
+ String imageFile = "/Users/maxinion/Desktop/MaxScanTestL09FullII/MaxScanTestL09FullII-"+count+".BMP";
+ BufferedImage read = ImageIO.read(new File( imageFile ));
+
+ System.out.println("Reading " + imageFile);
+
+ double scaleFactor = 1/14.3;
+ int xpos = 45 * i;
+ int ypos = 33 * j;
+
+ AffineTransform at = AffineTransform.getTranslateInstance(0, 0);
+ at.setTransform(scaleFactor, 0, 0, scaleFactor, xpos, ypos);
+ g2.drawRenderedImage(read, at);
+
+ count++;
+ }
+
+ }
+ }
+
+ File outputfile = new File("/Users/maxinion/Desktop/stitched.png");
+ ImageIO.write(stitched, "png", outputfile);
+ }
}
CDMS/src/CDMS/swiatlow/ImageMapperII
diff -u -r1.3 -r1.4
--- ImageMapperIIRun.java 7 Mar 2011 23:07:15 -0000 1.3
+++ ImageMapperIIRun.java 2 Apr 2011 07:09:02 -0000 1.4
@@ -10,9 +10,10 @@
public static void main(String[] args) {
try {
- ImageMapperII mapper = new ImageMapperII("/Users/maxinion/Documents/Work/CDMS/imagingII/qets2-hires.jpg",
- "/Users/maxinion/Documents/Work/CDMS/imagingII/out2-28/qets2-full-out.csv",1);
+ ImageMapperII mapper = new ImageMapperII("/Users/maxinion/Documents/Work/CDMS/imagingII/qets-hires1.png",
+ "/Users/maxinion/Documents/Work/CDMS/imagingII/out3-31/qets-full1-out.csv",1);
mapper.doAll();
+ //mapper.roughStitch();
} catch (IOException e) {
e.printStackTrace();
}