00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 import imagerec.corba.*;
00019
00020 import imagerec.graph.*;
00021
00022
00023
00024
00025 public class ATRMain_quo
00026 {
00027
00028
00029
00030
00031
00032 public static void main(String args[]) {
00033
00034
00035
00036
00037
00038
00039 if (args.length<4) {
00040 System.out.println("Usage: java -jar ATR.jar");
00041 System.out.println(" <'timer'|'notimer'>");
00042 System.out.println(" <pipeline #>");
00043 System.out.println(" <CORBA name for ATR>");
00044 System.out.println(" <CORBA name for Alert>");
00045 System.out.println(" [CORBA options]");
00046 System.out.println("--or-- ");
00047 System.out.println(" java -jar ATR.jar");
00048 System.out.println(" <'timer'|'notimer'>");
00049 System.out.println(" <pipeline #>");
00050 System.out.println(" <Event Channel Name>");
00051 System.out.println(" <CORBA name for ATR>");
00052 System.out.println(" <CORBA name for Alert>");
00053 System.out.println(" [CORBA options]");
00054 System.out.println("");
00055 System.out.println("For pipelines 1-3, use format #1.");
00056 System.out.println("For pipeline 4, use format #2.");
00057 System.exit(-1);
00058 }
00059 int pipelineNumber = 0;
00060 try {
00061 pipelineNumber = Integer.parseInt(args[1]);
00062 }
00063 catch (NumberFormatException nfe) {
00064 System.out.println("Error: Pipeline argument was not a valid integer.");
00065 System.exit(-1);
00066 }
00067
00068 if (pipelineNumber <= 0) {
00069 System.out.println("Error: Pipeline # must be > 0 (value was '"+pipelineNumber+")");
00070 System.exit(-1);
00071 }
00072 else {
00073 boolean timer = args[0].equalsIgnoreCase("timer");
00074 Node timer1;
00075 Node timer2;
00076 Node receivingTimer;
00077 Node trackingTimer;
00078
00079
00080
00081 if (timer) {
00082 timer1 = new Timer(true, false, null);
00083 timer2 = new Timer(false, true, "Processing", null);
00084 receivingTimer = new Timer(false, true, "Receiving Frame", null);
00085 trackingTimer = new Timer(true, false, "Tracking", null);
00086 }
00087 else {
00088 timer1 = new Node();
00089 timer2 = new Node();
00090 receivingTimer = new Node();
00091 trackingTimer = new Node();
00092 }
00093 Node pipe = null;
00094 Node alert = null;
00095 if ((pipelineNumber == 1)||
00096 (pipelineNumber == 2)||
00097 (pipelineNumber == 3)) {
00098 alert = new Alert(new CORBA_quo(args), args[3]);
00099 } else if (pipelineNumber == 4) {
00100 alert = new Alert(new EventChannel(args, args[3]), args[4]);
00101 pipelineNumber = 3;
00102 }
00103 if (pipelineNumber == 1) {
00104 Node robCross = new RobertsCross(null);
00105 Node thresh = new Thresholding(null);
00106 Label label = new Label(Label.DEFAULT1, null, null);
00107 label.findOneObject(true);
00108 Node range = new RangeFind(null);
00109 pipe = receivingTimer.linkL(timer1.linkL(robCross.linkL(thresh.linkL(label.link(null,
00110 range.linkL(timer2.linkL(trackingTimer.linkL(alert))))))));
00111 (new ATR(new CORBA_quo(args), args[2], pipe)).run();
00112 }
00113 else if (pipelineNumber == 2) {
00114 Node labelBlue = new LabelBlue(null, null);
00115 Node range = new RangeFind(null);
00116 pipe = receivingTimer.linkL(timer1.linkL(labelBlue.link(null,
00117 range.linkL(timer2.linkL(trackingTimer.linkL(alert))))));
00118 (new ATR(new CORBA_quo(args), args[2], pipe)).run();
00119 }
00120 else if (pipelineNumber == 3) {
00121 Node cleanCache = new Cache(1, null, null);
00122 Node n = new Node();
00123 LabelBlue labelBlue = new LabelBlue(null, null);
00124 labelBlue.calibrateAndProcessSeparately(true);
00125 Node calibCmd = new Command(Command.CALIBRATION_IMAGE, null);
00126 Node noneCmd = new Command(Command.NONE, null);
00127 Node copy = new Copy(null);
00128 Node robCross = new RobertsCross(null);
00129 Node thresh = new Thresholding(null);
00130 Node hyst = new Hysteresis(null);
00131 Node label = new Label(null, null);
00132 Node labelSmCache = new Cache(1, null, null);
00133 Node getCropCmd = new Command(Command.GET_CROPPED_IMAGE, null);
00134 Node thin = new Thinning(Thinning.BLUE, null);
00135 Node range = new RangeFind(null);
00136 Node getLabelSmCmd = new Command(Command.GET_IMAGE, null);
00137 pipe =
00138 receivingTimer.linkL(timer1.linkL(cleanCache.link(n.link(calibCmd.linkL(labelBlue),
00139 noneCmd.linkL(copy.linkL(robCross.link(null,
00140 thresh.link(null,
00141 hyst.link(null,
00142 label.link(null,
00143 labelSmCache.link(getCropCmd.linkL(cleanCache),
00144 thin.link(null,
00145 range.linkL(timer2.linkL(trackingTimer.linkL(alert)))))))))))),
00146
00147 labelBlue.link(null,
00148 getLabelSmCmd.linkL(labelSmCache)))));
00149
00150 (new ATR(new CORBA_quo(args), args[2], pipe)).run();
00151 }
00152 else if (pipelineNumber == 4) {
00153
00154 Node cleanCache = new Cache(1, null, null);
00155 Node n = new Node();
00156 LabelBlue labelBlue = new LabelBlue(null, null);
00157 labelBlue.calibrateAndProcessSeparately(true);
00158 Node calibCmd = new Command(Command.CALIBRATION_IMAGE, null);
00159 Node noneCmd = new Command(Command.NONE, null);
00160 Node copy = new Copy(null);
00161 Node robCross = new RobertsCross(null);
00162 Node thresh = new Thresholding(null);
00163 Node hyst = new Hysteresis(null);
00164 Node label = new Label(null, null);
00165 Node labelSmCache = new Cache(1, null, null);
00166 Node getCropCmd = new Command(Command.GET_CROPPED_IMAGE, null);
00167 Node thin = new Thinning(Thinning.BLUE, null);
00168 Node range = new RangeFind(null);
00169 Node getLabelSmCmd = new Command(Command.GET_IMAGE, null);
00170 pipe =
00171 receivingTimer.linkL(timer1.linkL(cleanCache.link(n.link(calibCmd.linkL(labelBlue),
00172 noneCmd.linkL(copy.linkL(robCross.link(null,
00173 thresh.link(null,
00174 hyst.link(null,
00175 label.link(null,
00176 labelSmCache.link(getCropCmd.linkL(cleanCache),
00177 thin.link(null,
00178 range.linkL(timer2.linkL(trackingTimer.linkL(alert)))))))))))),
00179
00180 labelBlue.link(null,
00181 getLabelSmCmd.linkL(labelSmCache)))));
00182
00183 } else {
00184 System.out.println("Error: Pipeline #"+pipelineNumber+" not implemented yet.");
00185 System.exit(-1);
00186 }
00187 (new ATR(new CORBA_quo(args), args[2], pipe)).run();
00188 }
00189 }
00190 }