Commit 016b8b7c authored by Andrey Filippov's avatar Andrey Filippov

Acquiring images sets with LWIR16

parent 57a60fb7
......@@ -27,6 +27,14 @@
<description>A Maven project implementing imagej-elphel plugin</description>
<dependencies>
<!-- ssh support - see https://www.baeldung.com/java-ssh-connection -->
<!-- https://mvnrepository.com/artifact/org.apache.sshd/sshd-core -->
<dependency>
<groupId>org.apache.sshd</groupId>
<artifactId>sshd-core</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>net.imagej</groupId>
<artifactId>ij</artifactId>
......
......@@ -73,6 +73,7 @@ import com.elphel.imagej.common.PolynomialApproximation;
import com.elphel.imagej.common.ShowDoubleFloatArrays;
import com.elphel.imagej.common.WindowTools;
import com.elphel.imagej.jp4.JP46_Reader_camera;
import com.elphel.imagej.lwir.Lwir16Reader;
import com.elphel.imagej.lwir.LwirReader;
import com.elphel.imagej.lwir.LwirReaderParameters;
import com.elphel.imagej.readers.EyesisTiff;
......@@ -108,6 +109,7 @@ public class Aberration_Calibration extends PlugInFrame implements ActionListene
private Panel panelGoniometer;
private Panel panelPixelMapping, panelStereo,panelStereo1;
private Panel panelLWIR;
private Panel panelLWIR16;
private ShowDoubleFloatArrays SDFA_INSTANCE; // just for debugging?
JP46_Reader_camera JP4_INSTANCE;
......@@ -289,6 +291,7 @@ public class Aberration_Calibration extends PlugInFrame implements ActionListene
);
public static LwirReader LWIR_READER = null;
public static Lwir16Reader LWIR16_READER = null;
public static ProcessCalibrationFilesParameters PROCESS_PARAMETERS = new ProcessCalibrationFilesParameters(
......@@ -650,9 +653,7 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi
public static Goniometer GONIOMETER=null;
public static LwirReaderParameters LWIR_PARAMETERS=new LwirReaderParameters();
public static LwirReaderParameters LWIR_PARAMETERS = new LwirReaderParameters();
// new CalibrationHardwareInterface.LaserPointers();
public class SyncCommand{
......@@ -1030,6 +1031,11 @@ if (MORE_BUTTONS) {
panelLWIR.setLayout(new GridLayout(1, 0, 5, 5)); // rows, columns, vgap, hgap
addButton("LWIR Configure", panelLWIR,color_configure);
addButton("LWIR_TEST", panelLWIR, color_conf_process);
addButton("CMPRS_STOP", panelLWIR, color_stop);
addButton("CMPRS_START", panelLWIR, color_process);
addButton("LWIR_FFC", panelLWIR, color_conf_process);
addButton("RST BUFs", panelLWIR, color_stop);
addButton("LWIR_ACQUIRE", panelLWIR, color_conf_process);
addButton("Configure Goniometer", panelLWIR,color_configure);
addButton("Goniometer Move", panelLWIR,color_debug);
......@@ -1041,8 +1047,8 @@ if (MORE_BUTTONS) {
addButton("EO Offsets", panelLWIR,color_process);
addButton("LWIR to EO", panelLWIR,color_process);
addButton("Manual hint", panelLWIR,color_configure);
add(panelLWIR);
pack();
GUI.center(this);
setVisible(true);
......@@ -9284,25 +9290,90 @@ if (MORE_BUTTONS) {
LWIR_PARAMETERS.showJDialog();
return;
}
//startStopCompressor(LwirReaderParameters lrp, boolean start, double delay)
//condProgramLWIRCamera()
/* ======================================================================== */
if (label.equals("CMPRS_START") || label.equals("CMPRS_STOP")) {
boolean start = label.equals("CMPRS_START");
if (LWIR_PARAMETERS.isLwir16()) {
if (LWIR16_READER == null) {
LWIR16_READER = new Lwir16Reader(LWIR_PARAMETERS);
}
LWIR16_READER.condProgramLWIRCamera();
double delay = 3.0;
LWIR16_READER.startStopCompressor(LWIR_PARAMETERS, start, delay);
}
return;
}
/* ======================================================================== */
if (label.equals("LWIR_FFC")) {
if (LWIR_PARAMETERS.isLwir16()) {
if (LWIR16_READER == null) {
LWIR16_READER = new Lwir16Reader(LWIR_PARAMETERS);
}
LWIR16_READER.condProgramLWIRCamera();
int skip_frames = 0; // 300; // 5 second to come to the camera, remove later
if (skip_frames > 0) {
LWIR16_READER.skipMasterFrames(new String[] {LWIR_PARAMETERS.getLwirIP(0)}, skip_frames);
}
LWIR16_READER.runFFC(LWIR_PARAMETERS);
}
return;
}
/* ======================================================================== */
if (label.equals("RST BUFs")) {
if (LWIR_PARAMETERS.isLwir16()) {
if (LWIR16_READER == null) {
LWIR16_READER = new Lwir16Reader(LWIR_PARAMETERS);
}
LWIR16_READER.condProgramLWIRCamera();
LWIR16_READER.resetFrameBuffers(LWIR_PARAMETERS);
}
return;
}
/* ======================================================================== */
//
if (label.equals("LWIR_TEST")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
// public static LwirReader LWIR_READER = null;
ImagePlus [][] imps;
if (LWIR_PARAMETERS.isLwir16()) {
if (LWIR16_READER == null) {
LWIR16_READER = new Lwir16Reader(LWIR_PARAMETERS);
}
LWIR16_READER.programLWIRCamera(LWIR_PARAMETERS);
if (DEBUG_LEVEL <1000) {
return;
}
imps = LWIR16_READER.readAllMultiple(
LWIR_PARAMETERS.getNumFrames(), // 10, // final int num_frames,
// true, // use LWIR telemetry
true, // final boolean show,
false); // true); // final boolean scale)
} else {
if (LWIR_READER == null) {
LWIR_READER = new LwirReader(LWIR_PARAMETERS);
}
ImagePlus [][] imps = LWIR_READER.readAllMultiple(
imps = LWIR_READER.readAllMultiple(
LWIR_PARAMETERS.getNumFrames(), // 10, // final int num_frames,
// true, // use LWIR telemetry
true, // final boolean show,
false); // true); // final boolean scale)
}
for (ImagePlus imp: imps[0]) {
imp.show();
}
System.out.println("LWIR_TEST: got "+imps.length+" image sets");
if (LWIR_PARAMETERS.isLwir16()) {
// will probably not needed for Bosons
ImagePlus [][] imps_sync = LWIR16_READER.matchSets(imps, 0.001, 3); // double max_mismatch)
if (imps_sync != null) {
ImagePlus [] imps_avg = LWIR16_READER.averageMultiFrames(imps_sync);
for (ImagePlus imp: imps_avg) {
imp.show();
}
}
} else {
ImagePlus [][] imps_sync = LWIR_READER.matchSets(imps, 0.001, 3); // double max_mismatch)
if (imps_sync != null) {
ImagePlus [] imps_avg = LWIR_READER.averageMultiFrames(imps_sync);
......@@ -9310,48 +9381,68 @@ if (MORE_BUTTONS) {
imp.show();
}
}
}
return;
}
/* ======================================================================== */
if (label.equals("LWIR_ACQUIRE")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
// public static LwirReader LWIR_READER = null;
ImagePlus [][] imps;
if (LWIR_PARAMETERS.isLwir16()) {
if (LWIR16_READER == null) {
LWIR16_READER = new Lwir16Reader(LWIR_PARAMETERS);
}
// ImagePlus [] imps =
LWIR16_READER.acquire(DISTORTION_PROCESS_CONFIGURATION.sourceDirectory); // directory to save
// ImagePlus [] imps = LWIR_READER.acquire("attic/lwir_test_images"); // directory to save
} else {
if (LWIR_READER == null) {
LWIR_READER = new LwirReader(LWIR_PARAMETERS);
}
// ImagePlus [] imps =
LWIR_READER.acquire(DISTORTION_PROCESS_CONFIGURATION.sourceDirectory); // directory to save
// ImagePlus [] imps = LWIR_READER.acquire("attic/lwir_test_images"); // directory to save
}
return;
}
/* ======================================================================== */
if (label.equals("LWIR Goniometer")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
// CAMERAS.setNumberOfThreads(THREADS_MAX);
// CAMERAS.debugLevel=DEBUG_LEVEL;
if ((GONIOMETER==null) || (GONIOMETER.lwirReader == null)) {
if ((GONIOMETER==null) || (LWIR_PARAMETERS.isLwir16()?(GONIOMETER.lwir16Reader == null):(GONIOMETER.lwirReader == null))) {
if (LWIR_PARAMETERS.isLwir16()) {
if (LWIR16_READER == null) {
LWIR16_READER = new Lwir16Reader(LWIR_PARAMETERS);
}
GONIOMETER= new Goniometer(
LWIR16_READER,
DISTORTION, //MatchSimulatedPattern.DistortionParameters distortion,
PATTERN_DETECT, //MatchSimulatedPattern.PatternDetectParameters patternDetectParameters,
EYESIS_CAMERA_PARAMETERS, //EyesisCameraParameters eyesisCameraParameters,
LASER_POINTERS, // MatchSimulatedPattern.LaserPointer laserPointers
SIMUL, //SimulationPattern.SimulParameters simulParametersDefault,
GONIOMETER_PARAMETERS, //LensAdjustment.FocusMeasurementParameters focusMeasurementParameters,
DISTORTION_PROCESS_CONFIGURATION);
} else {
if (LWIR_READER == null) {
LWIR_READER = new LwirReader(LWIR_PARAMETERS);
}
GONIOMETER= new Goniometer(
LWIR_READER,
// CAMERAS, // CalibrationHardwareInterface.CamerasInterface cameras,
DISTORTION, //MatchSimulatedPattern.DistortionParameters distortion,
PATTERN_DETECT, //MatchSimulatedPattern.PatternDetectParameters patternDetectParameters,
EYESIS_CAMERA_PARAMETERS, //EyesisCameraParameters eyesisCameraParameters,
LASER_POINTERS, // MatchSimulatedPattern.LaserPointer laserPointers
SIMUL, //SimulationPattern.SimulParameters simulParametersDefault,
GONIOMETER_PARAMETERS, //LensAdjustment.FocusMeasurementParameters focusMeasurementParameters,
DISTORTION_PROCESS_CONFIGURATION
);
DISTORTION_PROCESS_CONFIGURATION);
}
if (DEBUG_LEVEL>1){
System.out.println("Initiaslizing Goniometer class");
System.out.println("Initialized Goniometer class for "+LWIR_PARAMETERS.getCameraName());
}
} else if (DEBUG_LEVEL>1){
System.out.println("GONIOMETER was initialized");
System.out.println("GONIOMETER was initialized for "+LWIR_PARAMETERS.getCameraName());
}
// calculate angular size of the target as visible from the camera
......@@ -9437,7 +9528,6 @@ if (MORE_BUTTONS) {
}
/* ======================================================================== */
IJ.showMessage("Not yet implemented");
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
return;
......@@ -34,6 +34,7 @@ import com.elphel.imagej.calibration.hardware.GoniometerMotors;
import com.elphel.imagej.cameras.EyesisCameraParameters;
import com.elphel.imagej.common.ShowDoubleFloatArrays;
import com.elphel.imagej.common.WindowTools;
import com.elphel.imagej.lwir.Lwir16Reader;
import com.elphel.imagej.lwir.LwirReader;
import ij.IJ;
......@@ -54,6 +55,7 @@ horizontal axis:
// debugging
public CamerasInterface cameras = null;
public LwirReader lwirReader = null;
public Lwir16Reader lwir16Reader = null;
// public CalibrationHardwareInterface.LaserPointers lasers = null;
// public static CalibrationHardwareInterface.FocusingMotors motorsS=null;
// public DistortionProcessConfiguration
......@@ -123,6 +125,28 @@ horizontal axis:
this.distortionProcessConfiguration=distortionProcessConfiguration;
}
public Goniometer(
Lwir16Reader lwir16Reader,
// CalibrationHardwareInterface.CamerasInterface cameras,
MatchSimulatedPattern.DistortionParameters distortionParametersDefault,
MatchSimulatedPattern.PatternDetectParameters patternDetectParameters,
EyesisCameraParameters eyesisCameraParameters,
LaserPointer laserPointers,
SimulationPattern.SimulParameters simulParametersDefault,
Goniometer.GoniometerParameters goniometerParameters,
DistortionProcessConfiguration distortionProcessConfiguration
) {
this.lwir16Reader= lwir16Reader;
// this.cameras = cameras;
this.distortionParametersDefault = distortionParametersDefault;
// this.distortion = distortion;
this.patternDetectParameters=patternDetectParameters;
this.eyesisCameraParameters = eyesisCameraParameters;
this.laserPointers = laserPointers;
this.simulParametersDefault=simulParametersDefault;
this.goniometerParameters=goniometerParameters;
this.distortionProcessConfiguration=distortionProcessConfiguration;
}
......@@ -459,6 +483,10 @@ horizontal axis:
this.lwirReader.setMotorsPosition(this.goniometerParameters.goniometerMotors.getTargetPositions()); // Used target, not current to prevent minor variations
this.lwirReader.reportTiming=debugTiming;
this.lwirReader.acquire(this.distortionProcessConfiguration.sourceDirectory); // true - use lasers, updateStatus - make false?
} else if (lwir16Reader != null) {
this.lwir16Reader.setMotorsPosition(this.goniometerParameters.goniometerMotors.getTargetPositions()); // Used target, not current to prevent minor variations
this.lwir16Reader.reportTiming=debugTiming;
this.lwir16Reader.acquire(this.distortionProcessConfiguration.sourceDirectory); // true - use lasers, updateStatus - make false?
} else {
System.out.println("Neignter traditional camera/rig, no LWIR rig are initialized, dry run");
}
......
......@@ -4793,7 +4793,7 @@ public class MatchSimulatedPattern {
// process
final double[] bPattern, final double[] windowFunction, final double[] windowFunctionCorr,
final double[] windowFunctionCorr2, final double[] windowFunctionCorr4, final double[][] locsNeib, // which
// neibors
// neighbors
// to
// try
// (here
......@@ -6919,6 +6919,8 @@ public class MatchSimulatedPattern {
noMessageBoxes);
}
// ====== end of calculateDistortions()
// ==============================================
/**
......
......@@ -318,7 +318,7 @@ public class GenericJTabbedDialog implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println(e.getActionCommand());
// System.out.println(e.getActionCommand());
if (e.getActionCommand().equals("Cancel")) {
result = e.getActionCommand();
jd.dispose();
......@@ -409,7 +409,7 @@ public class GenericJTabbedDialog implements ActionListener {
}
System.out.println(combo.getSelectedItem());
// System.out.println(combo.getSelectedItem());
// for (int i = 0; i < selectedItem.length; i++){
// System.out.println(String.format("item %s = %s", i, selectedItem[i]));
// }
......
This diff is collapsed.
......@@ -96,13 +96,13 @@ public class LwirReader {
// -- constructors
public LwirReader() {
this.lwirReaderParameters = new LwirReaderParameters(); // default
this.lwirReaderParameters = new LwirReaderParameters(LwirReaderParameters.NAME_TALON); // default
imagejJp4TiffMulti = null;
}
public LwirReader(LwirReaderParameters lwirReaderParameters) {
if (lwirReaderParameters == null) {
this.lwirReaderParameters = new LwirReaderParameters(); // default
this.lwirReaderParameters = new LwirReaderParameters(LwirReaderParameters.NAME_TALON); // default
} else {
this.lwirReaderParameters = lwirReaderParameters;
}
......@@ -404,9 +404,9 @@ public class LwirReader {
}
String hex_chan = String.format("0x%x", channels);
String url = "http://"+lrp.lwir_ip+"/parsedit.php?immediate&sensor_port="+chn+
String url = "http://"+lrp.getLwirIP()+"/parsedit.php?immediate&sensor_port="+chn+
"&SENSOR_REGS67=0*"+FRAMES_AHEAD+"!"+hex_chan;
// String url = "http://"+lrp.lwir_ip+"/parsedit.php?immediate&sensor_port="+chn+
// String url = "http://"+lrp.getLwirIP()+"/parsedit.php?immediate&sensor_port="+chn+
// "&SENSOR_REGS67=0&*SENSOR_REGS67="+hex_chan;
Document dom=null;
LOGGER.warn("calibrate(): Perform calibration (instead of 15 frames), url="+url);
......@@ -459,7 +459,7 @@ public class LwirReader {
return false;
}
int chn = lrp.lwir_channels[0];
String url = "http://"+lrp.lwir_ip+":"+IMGSRV_PORTS[chn]+SKIP_FRAME_URL;
String url = "http://"+lrp.getLwirIP()+":"+IMGSRV_PORTS[chn]+SKIP_FRAME_URL;
Document dom=null;
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
......@@ -467,7 +467,7 @@ public class LwirReader {
dom = db.parse(url);
if (!dom.getDocumentElement().getNodeName().equals("meta")) {
LOGGER.error("skipFrame() in " + url+
": Root element: expected 'me3ta', got \"" + dom.getDocumentElement().getNodeName()+"\"");
": Root element: expected 'meta', got \"" + dom.getDocumentElement().getNodeName()+"\"");
return false;
}
} catch(MalformedURLException e){
......@@ -618,7 +618,7 @@ public class LwirReader {
int num_eo = lrp.eo_channels.length;
final String [] urls = new String [num_lwir + num_eo];
for (int chn:lrp.lwir_channels) {
urls[chn] = "http://"+lrp.lwir_ip+"/parsedit.php?immediate&sensor_port="+chn+
urls[chn] = "http://"+lrp.getLwirIP()+"/parsedit.php?immediate&sensor_port="+chn+
"&BITS=16"+
"&COLOR="+COLOR_RAW+ // +"*0"; // raw mode - delay 0 - breaks compressor
"&WOI_HEIGHT="+(LWIR_HEIGHT + (lrp.lwir_telemetry?LWIR_TELEMETRY_LINES:0));
......
......@@ -76,14 +76,13 @@ public class Boson640Telemetry {
dbg = bb.get();
bb.position(offset);
// this.bbtm =
bb.get(btm, 0,btm.length);
this.bbtm = ByteBuffer.wrap(btm);
this.bbtm.order( bb.order()); // or is it already same as in bb?
System.out.println("getShort(94)"+this.bbtm.getShort(94));
System.out.println("getLong(162)"+this.bbtm.getLong(162));
System.out.println("getLong(162)"+this.bbtm.getInt(162));
// System.out.println("getShort(94)"+this.bbtm.getShort(94));
// System.out.println("getLong(162)"+this.bbtm.getLong(162));
// System.out.println("getLong(162)"+this.bbtm.getInt(162));
......
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