Commit aa2f8dcb authored by Andrey Filippov's avatar Andrey Filippov

Merge branch 'lwir-distort' of git.elphel.com:Elphel/imagej-elphel into lwir-distort

parents 9833be98 c305ce42
......@@ -9421,7 +9421,7 @@ if (MORE_BUTTONS) {
LWIR_READER = new LwirReader(LWIR_PARAMETERS);
}
ImagePlus [][] imps = LWIR_READER.readAllMultiple(
10, // final int num_frames,
LWIR_PARAMETERS.getNumFrames(), // 10, // final int num_frames,
// true, // use LWIR telemetry
true, // final boolean show,
false); // true); // final boolean scale)
......@@ -31,6 +31,7 @@ public class GoniometerMotors{
public double coefficientETA=1.5; // allow moving 1.5 longer than at maximal speed
private long nanoETA;
private long nanoReferenceTime; // last time the position was checked
private int []referencePosition=null;
......@@ -110,6 +111,8 @@ public class GoniometerMotors{
commandElphel10364Motors("http://"+this.ipAddress+"/10364.php?m"+(motorNumber+1)+"="+this.targetPosition[motorNumber]+"sleep=1");
enableMotors(true);
nanoETA=System.nanoTime()+((long)(1E9*(Math.abs(this.targetPosition[motorNumber]-this.curpos[motorNumber])*(this.coefficientETA/this.stepsPerSecond))));
nanoETA += (long)(1E9*this.motorsStuckTestTime); // =5.0; // seconds
return true;
}
/*
......
......@@ -189,7 +189,10 @@ public class LwirReader {
} catch (Exception e) {
LOGGER.error("Something is wrong!");
}
if (dt==null) {
System.out.println("n="+n+", i="+i+", dt is NULL! (may need to reduce number of acquire images to "+(n-1));
}
// System.out.println("n="+n+", i="+i+", dt="+dt);
img_seconds[n][i] = Double.parseDouble(dt.substring(dt.lastIndexOf(":")+1));
try {
img_numbers[n][i] = Integer.parseInt((String) imps[n][i].getProperty("STD_Image_Number"));
......@@ -497,6 +500,11 @@ public class LwirReader {
calibrate(lrp); // seems to work. test calibration duration and if any images are sent during calibration
}
int num_frames = lrp.avg_number + lrp.eo_lag + 2 * lrp.max_frame_diff;
if (num_frames > lrp.num_frames) {
LOGGER.warn("acquire(): Wanted to acquire "+num_frames+", but hard limit is set to "+lrp.num_frames+
" TDOD: stop EO compressor after acquisition of the required number of frames") ;
num_frames = lrp.num_frames;
}
ImagePlus [][] imps = readAllMultiple(
num_frames,
// lrp.lwir_telemetry,
......
......@@ -38,6 +38,7 @@ import ij.Prefs;
public class LwirReaderParameters {
private boolean parameters_updated = false;
protected int avg_number = 4; // number of measurements to average
protected int num_frames = 7; // misses images if high quality large size?
protected boolean lwir_ffc = true;
protected boolean avg_all = true;
protected String lwir_ip = "192.168.0.36";
......@@ -84,6 +85,9 @@ public class LwirReaderParameters {
// --- interface methods
public int getNumFrames() {
return num_frames;
}
public int getLwirChn0 () {
return lwir_chn0;
}
......@@ -113,6 +117,7 @@ public class LwirReaderParameters {
}
public void setProperties(String prefix,Properties properties){
properties.setProperty(prefix+"avg_number", this.avg_number+"");
properties.setProperty(prefix+"num_frames", this.num_frames+"");
properties.setProperty(prefix+"lwir_ffc", this.lwir_ffc+"");
properties.setProperty(prefix+"avg_all", this.avg_all+"");
properties.setProperty(prefix+"lwir_ip", this.lwir_ip+"");
......@@ -158,6 +163,8 @@ public class LwirReaderParameters {
if (properties.getProperty(prefix+"vnir_lag")!=null) this.eo_lag=Integer.parseInt(properties.getProperty(prefix+"vnir_lag")); // old version
if (properties.getProperty(prefix+"avg_number")!=null) this.avg_number=Integer.parseInt(properties.getProperty(prefix+"avg_number"));
if (properties.getProperty(prefix+"num_frames")!=null) this.num_frames=Integer.parseInt(properties.getProperty(prefix+"num_frames"));
if (properties.getProperty(prefix+"lwir_ffc")!=null) this.lwir_ffc= Boolean.parseBoolean(properties.getProperty(prefix+"lwir_ffc"));
if (properties.getProperty(prefix+"avg_all")!=null) this.avg_all= Boolean.parseBoolean(properties.getProperty(prefix+"avg_all"));
if (properties.getProperty(prefix+"lwir_ip")!=null) this.lwir_ip= properties.getProperty(prefix+"lwir_ip");
......@@ -190,6 +197,7 @@ public class LwirReaderParameters {
public LwirReaderParameters clone() { // throws CloneNotSupportedException {
LwirReaderParameters lrp = new LwirReaderParameters();
lrp.avg_number= this.avg_number;
lrp.num_frames= this.num_frames;
lrp.lwir_ffc= this.lwir_ffc;
lrp.avg_all= this.avg_all;
lrp.lwir_ip= this.lwir_ip;
......@@ -292,6 +300,8 @@ public class LwirReaderParameters {
public void dialogQuestions(GenericJTabbedDialog gd) {
gd.addNumericField("Number to average",this.avg_number, 0,3,"","Number of acquired consecutive images to average");
gd.addNumericField("Number of sets to acquire",this.num_frames, 0,3,"","Total number, may be limited by EO quality/frame size (last will be missed/null)");
gd.addCheckbox ("Run FFC", this.lwir_ffc, "Perform calibration before each measurements to average (takes ~1.6 sec, 15 frames)");
gd.addCheckbox ("Average all", this.avg_all, "Average all simultaneously acquired images (unchecked - only requested number to average)");
gd.addStringField ("LWIR IP", this.lwir_ip, 20, "LWIR camera IP address");
......@@ -322,6 +332,7 @@ public class LwirReaderParameters {
public void dialogAnswers(GenericJTabbedDialog gd) {
this.avg_number = (int) gd.getNextNumber();
this.num_frames = (int) gd.getNextNumber();
this.lwir_ffc = gd.getNextBoolean();
this.avg_all = gd.getNextBoolean();
this.lwir_ip = gd.getNextString();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment