Commit 8295add0 authored by Andrey Filippov's avatar Andrey Filippov

implementing initial orientation estimation, full window for eo

acquisition
parent f406805d
......@@ -2165,7 +2165,7 @@ if (MORE_BUTTONS) {
);
// set initial orientation of the cameras from the sensors that see mpst of the matching pointers
// just for the LMA to start
DISTORTION_CALIBRATION_DATA.setInitialOrientation(true);
DISTORTION_CALIBRATION_DATA.setInitialOrientation(PATTERN_PARAMETERS, true);
return;
}
......@@ -5871,7 +5871,7 @@ if (MORE_BUTTONS) {
DISTORTION_CALIBRATION_DATA.updateSetOrientation(null); // restore orientation from (enabled) image files
if (DEBUG_LEVEL>0) System.out.println("Setting sets orientation from per-grid image data");
}
if (overwriteAll) DISTORTION_CALIBRATION_DATA.setInitialOrientation(overwriteAll); // needed here? modify?
if (overwriteAll) DISTORTION_CALIBRATION_DATA.setInitialOrientation(PATTERN_PARAMETERS, overwriteAll); // needed here? modify?
if ((DEBUG_LEVEL>0) && (DISTORTION_CALIBRATION_DATA.gIS!=null)){
System.out.println("There are now "+DISTORTION_CALIBRATION_DATA.getNumberOfEstimated(true)+ "("+DISTORTION_CALIBRATION_DATA.getNumberOfEstimated(false)+") images with estimated orientation");
}
......@@ -6255,7 +6255,7 @@ if (MORE_BUTTONS) {
/* ======================================================================== */
if (label.equals("Get Orientation")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
if (DEBUG_LEVEL>0){
if (DEBUG_LEVEL>10) { // 0){
IJ.showMessage("disabled option");
return;
}
......@@ -6278,11 +6278,22 @@ if (MORE_BUTTONS) {
System.out.println("GONIOMETER was initialized");
}
// initialize needed classes
DISTORTION_CALIBRATION_DATA=new DistortionCalibrationData( // images are not setup yet
EYESIS_CAMERA_PARAMETERS, //EyesisCameraParameters eyesisCameraParameters
GONIOMETER_PARAMETERS);
if (DISTORTION_CALIBRATION_DATA == null ) {
System.out.println("Initiaslizing DISTORTION_CALIBRATION_DATA");
DISTORTION_CALIBRATION_DATA=new DistortionCalibrationData( // images are not setup yet
EYESIS_CAMERA_PARAMETERS, //EyesisCameraParameters eyesisCameraParameters
GONIOMETER_PARAMETERS);
} else if (DEBUG_LEVEL>1){
System.out.println("DISTORTION_CALIBRATION_DATA was initialized");
}
if ((LENS_DISTORTIONS!=null) && (LENS_DISTORTIONS.fittingStrategy!=null)) {
LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData=DISTORTION_CALIBRATION_DATA;
if (DEBUG_LEVEL>0){
System.out.println("Setting LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData=DISTORTION_CALIBRATION_DATA");
}
} else if (DEBUG_LEVEL>0){
System.out.println("Was already set: LENS_DISTORTIONS.fittingStrategy.distortionCalibrationData=DISTORTION_CALIBRATION_DATA");
}
if (DEBUG_LEVEL>1){
......@@ -6301,9 +6312,10 @@ if (MORE_BUTTONS) {
IJ.showMessage("Error",msg);
return;
}
LENS_DISTORTIONS=new Distortions(LENS_DISTORTION_PARAMETERS,PATTERN_PARAMETERS,REFINE_PARAMETERS,this.SYNC_COMMAND.stopRequested);
if (DEBUG_LEVEL>1){
System.out.println("Initiaslizing Distortions class");
System.out.println("Initiaslizing Distortions class (LENS_DISTORTIONS)");
}
} else if (DEBUG_LEVEL>1){
System.out.println("LENS_DISTORTIONS was initialized");
......@@ -6324,10 +6336,13 @@ if (MORE_BUTTONS) {
return;
}
GONIOMETER_PARAMETERS.gridGeometryFile=gridPathname;
if (DEBUG_LEVEL > 0){
System.out.println("Using pattern file: "+gridPathname);
}
// Find curernt orientation
double [] currentOrientation=GONIOMETER.estimateOrientation (
CAMERAS.getImages(1), // last acquired images with number of pointers detected>0
CAMERAS.getImages(1), // last acquired images with number of pointers detected>0
DISTORTION_CALIBRATION_DATA, // DistortionCalibrationData distortionCalibrationData,
PATTERN_PARAMETERS, //PatternParameters patternParameters, // should not be null
LENS_DISTORTIONS, //Distortions lensDistortions, // should not be null
......@@ -9871,7 +9886,22 @@ if (MORE_BUTTONS) {
PATTERN_PARAMETERS.debugLevel=MASTER_DEBUG_LEVEL;
EYESIS_CAMERA_PARAMETERS.updateNumstations (numStations);
DISTORTION_CALIBRATION_DATA=new DistortionCalibrationData( // new way for LWIR - initialize form dirs
// Adding class here to use for orientation estimation - will not be needed?
if (GONIOMETER==null) {
GONIOMETER= new Goniometer(
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_CALIBRATION_DATA=new DistortionCalibrationData( // new way for LWIR - initialize from dirs
gridFileDirs,
sourceStationDirs,
gridFilter,
......@@ -9889,7 +9919,7 @@ if (MORE_BUTTONS) {
);
// set initial orientation of the cameras from the sensors that see most of the matching pointers
// just for the LMA to start
DISTORTION_CALIBRATION_DATA.setInitialOrientation(true);
DISTORTION_CALIBRATION_DATA.setInitialOrientation(PATTERN_PARAMETERS, true);
return true;
......@@ -46,6 +46,7 @@ import com.elphel.imagej.common.ShowDoubleFloatArrays;
import com.elphel.imagej.common.WindowTools;
import com.elphel.imagej.jp4.JP46_Reader_camera;
import Jama.Matrix;
import ij.IJ;
import ij.ImagePlus;
import ij.ImageStack;
......@@ -122,7 +123,7 @@ import ij.text.TextWindow;
public String source_path = null; // Full path of the source image this grid was calculated from
public double [][] laserPixelCoordinates=null; // first index - absolute number of pointer. Each element may be either null or {x,y} pair
// moving for new files to have laser UV contained in the file
public double [][] laserUVCoordinates=null; // first index - absolute number of pointer. Each element may be either null or {u,v} pair
public double [][] laserUVCoordinates=null; // first index - absolute number of pointer. Each element may be either null or {u,v} pair - never used??????
public int matchedPointers=0;
public int hintedMatch=-1; // -1 - not tried, 0 - no real grid (i.e. double reflection), applied orientation, applied orientation and shift
public boolean enabled=true; //false; // to mask out some images from all strategy steps (i.e w/o reliable absolute calibration)
......@@ -153,6 +154,7 @@ import ij.text.TextWindow;
public double getGridPeriod() { return gridPeriod;}
public void setGridPeriod(double v) {gridPeriod = v;}
public int getSetNumber(){return this.setNumber;}
public int getImageNumber() {return this.imgNumber;}
public GridImageParameters(int index){
this.imgNumber=index;
}
......@@ -2259,7 +2261,7 @@ import ij.text.TextWindow;
((this.gIP[i].matchedPointers>0) && (this.gIP[i].hintedMatch>0)) || // orientation and one pointer
((this.gIP[i].hintedMatch>1) && enableNoLaser)) { // do not use bottom images w/o matched pointers
// before enabling - copy orientation from gIS
if (!this.gIP[i].enabled && (gIS_index[i]>=0)){
if (!this.gIP[i].enabled && (gIS_index[i]>=0)){ // FIXME - is it correct to use set index 0?
if (!Double.isNaN(this.gIS[gIS_index[i]].goniometerTilt)) setGH(i,this.gIS[gIS_index[i]].goniometerTilt );
if (!Double.isNaN(this.gIS[gIS_index[i]].goniometerAxial)) setGA(i,this.gIS[gIS_index[i]].goniometerAxial );
}
......@@ -2407,9 +2409,11 @@ import ij.text.TextWindow;
/**
* Set goniometer initial orientation from the image with maximal number of laser pointers (make averaging later?)
* Needed before LMA to have some reasonable initial orientation
* @param overwriteAll if true, overwrite orientation data even if it is alredy not NaN, false -skipp those that have orientation set
* @param overwriteAll if true, overwrite orientation data even if it is already not NaN, false -skip those that have orientation set
*/
public void setInitialOrientation(boolean overwriteAll){
public void setInitialOrientation(
PatternParameters patternParameters,
boolean overwriteAll) {
if (this.debugLevel>0) {
System.out.println("setInitialOrientation("+overwriteAll+"), debugLevel= "+this.debugLevel);
}
......@@ -2427,6 +2431,70 @@ import ij.text.TextWindow;
}
if (bestRating>0){
EyesisSubCameraParameters esp = this.eyesisCameraParameters.eyesisSubCameras[stationNumber][bestChannel];
double [] uv_center = getGridUVfromXY(
esp.px0, // final double px,
esp.py0, // final double py,
this.gIS[i].imageSet[bestChannel].getImageNumber(), // final int fileNumber,
true); // boolean use_extra)
// find UV of the center of the image getImageNumber
if (uv_center == null) {
if (this.debugLevel>0) {
System.out.println("Center UV = NULL");
}
} else {
if (this.debugLevel>0) {
System.out.println("Center UV = "+uv_center[0]+","+uv_center[1]);
}
double [] patt_xyz = patternParameters.getXYZ(
uv_center, // double [] uv,
false, // boolean verbose,
this.gIS[i].getStationNumber()); // int station); // u=0,v=0 - center!
if (patt_xyz == null) {
if (this.debugLevel>0) {
System.out.println("Center UV = NULL");
}
} else {
if (this.debugLevel>0) {
System.out.println("Center XYZ = "+patt_xyz[0]+","+patt_xyz[1]+","+patt_xyz[2]);
}
// Calculate position relative to the view point on the target
double [] aview = {
patt_xyz[0]- this.gIS[i].GXYZ[0],
-patt_xyz[1]+ (this.gIS[i].GXYZ[1] - this.gIS[i].centerAboveHorizontal),
-patt_xyz[2]+ this.gIS[i].GXYZ[2]
};
Matrix mview = new Matrix(aview,3);
double phi = -Math.PI/180.0*this.gIS[i].horAxisErrPhi;
double cp = Math.cos(phi);
double sp = Math.sin(phi);
double [][] aphi = {
{ cp, 0.0, sp},
{0.0, 1.0, 0.0},
{-sp, 0.0, cp}};
Matrix mphi = new Matrix(aphi);
Matrix mview_gon = mphi.times(mview); // view point on the target from the goniometer
double tilt = -Math.atan2(mview_gon.get(1, 0), mview_gon.get(2, 0)); // y pointed up
double ct = Math.cos(tilt);
double st = Math.sin(tilt);
double [][] atilt = {
{1.0, 0.0, 0.0},
{0.0, ct, st},
{0.0, -st, ct}};
Matrix mtilt = new Matrix(atilt);
Matrix mview_tilt = mtilt.times(mview_gon); // view point on the target from the tilted goniometer
double az = Math.atan2(mview_tilt.get(0, 0), mview_tilt.get(2, 0)); // x pointed right
double tilt_deg = tilt/Math.PI*180;
double az_deg = az/Math.PI*180;
if (this.debugLevel>0) {
System.out.println("Tilt = "+tilt_deg+", az = "+az_deg);
System.out.print("");
}
}
}
if (overwriteAll || Double.isNaN(this.gIS[i].goniometerAxial)){
// System.out.println("setInitialOrientation("+overwriteAll+"), Double.isNaN(this.gIS["+i+"].goniometerAxial)="+Double.isNaN(this.gIS[i].goniometerAxial));
......@@ -2435,7 +2503,9 @@ import ij.text.TextWindow;
for (int j=0;j<this.gIS[i].imageSet.length;j++) if (this.gIS[i].imageSet[j]!=null) setGA(this.gIS[i].imageSet[j].imgNumber,this.gIS[i].goniometerAxial);
this.gIS[i].orientationEstimated=true;
if (this.debugLevel>1) {
System.out.println("Setting goniometerAxial for the image set #"+i+" ("+this.gIS[i].timeStamp+") to "+this.gIS[i].goniometerAxial+" +++++ orientationEstimated==true +++++");
System.out.print(String.format("Setting goniometerAxial for the image set #%4d (%18.6f) to ", i, this.gIS[i].timeStamp));
System.out.println(""+this.gIS[i].goniometerAxial+" +++++ orientationEstimated==true +++++");
// System.out.println("Setting goniometerAxial for the image set #"+i+" ("+this.gIS[i].timeStamp+") to "+this.gIS[i].goniometerAxial+" +++++ orientationEstimated==true +++++");
}
}
if (overwriteAll || Double.isNaN(this.gIS[i].goniometerTilt )){
......@@ -2444,7 +2514,8 @@ import ij.text.TextWindow;
for (int j=0;j<this.gIS[i].imageSet.length;j++) if (this.gIS[i].imageSet[j]!=null) setGH(this.gIS[i].imageSet[j].imgNumber,this.gIS[i].goniometerTilt);
this.gIS[i].orientationEstimated=true;
if (this.debugLevel>1) {
System.out.println("Setting goniometerTilt for the image set #"+i+" ("+this.gIS[i].timeStamp+") to "+this.gIS[i].goniometerTilt+" ===== orientationEstimated==true =====");
System.out.print(String.format("Setting goniometerTilt for the image set #%4d (%18.6f) to ", i, this.gIS[i].timeStamp));
System.out.println(""+this.gIS[i].goniometerTilt+" ===== orientationEstimated==true =====");
}
}
}
......@@ -3334,7 +3405,7 @@ import ij.text.TextWindow;
len += this.gIP[fileNumber].pixelsXY_extra.length;
}
if (len<3) {
this.gIP[fileNumber].gridPeriod=Double.NaN;
this.gIP[fileNumber].setGridPeriod(Double.NaN);
} else {
// double [][][] data =new double [this.gIP[fileNumber].pixelsXY.length][2][2];
double [][][] data =new double [len][2][2];
......@@ -3359,12 +3430,12 @@ import ij.text.TextWindow;
}
double [][] coeff=new PolynomialApproximation(this.debugLevel).quadraticApproximation(data, true); // force linear
if (coeff!=null) {
this.gIP[fileNumber].gridPeriod=2.0/Math.sqrt(coeff[0][0]*coeff[0][0]+coeff[0][1]*coeff[0][1]+coeff[1][0]*coeff[1][0]+coeff[1][1]*coeff[1][1]);
this.gIP[fileNumber].setGridPeriod(2.0/Math.sqrt(coeff[0][0]*coeff[0][0]+coeff[0][1]*coeff[0][1]+coeff[1][0]*coeff[1][0]+coeff[1][1]*coeff[1][1]));
if (this.debugLevel>3) {
System.out.println("coeff[][]={{"+coeff[0][0]+","+coeff[0][1]+"},{"+coeff[1][0]+","+coeff[1][1]+"}}");
}
} else {
this.gIP[fileNumber].gridPeriod=Double.NaN;
this.gIP[fileNumber].setGridPeriod(Double.NaN);
}
}
if (this.debugLevel>3) {
......@@ -3374,6 +3445,93 @@ import ij.text.TextWindow;
}
public double [] getGridUVfromXY(
final double px,
final double py,
final int fileNumber,
boolean use_extra){ // use out-of grid nodes (can be w/o absolute matching
use_extra &= (this.gIP[fileNumber].pixelsXY_extra !=null);
int len = (this.gIP[fileNumber].pixelsXY==null)? 0 : this.gIP[fileNumber].pixelsXY.length;
final int len0 = len;
if (use_extra ) {
len += this.gIP[fileNumber].pixelsXY_extra.length;
}
if (len<3) {
return null;
}
final double [][] all_xy = new double [len][2];
final int [][] all_uv = new int [len][2];
if (len0 > 0) {
System.arraycopy(this.gIP[fileNumber].pixelsXY, 0, all_xy, 0, len0);
System.arraycopy(this.gIP[fileNumber].pixelsUV, 0, all_uv, 0, len0);
}
if (len > len0) {
System.arraycopy(this.gIP[fileNumber].pixelsXY_extra, 0, all_xy, len0, len-len0);
System.arraycopy(this.gIP[fileNumber].pixelsUV_extra, 0, all_uv, len0, len-len0);
}
ArrayList<Integer> neibs = new ArrayList<Integer>();
for (int i = 0; i < len; i++) neibs.add(i);
Collections.sort(neibs, new Comparator<Integer>() {
@Override
public int compare(Integer lhs, Integer rhs) {
// double [] xy_lhs = (lhs < len0)? gIP[fileNumber].pixelsXY[lhs] : gIP[fileNumber].pixelsXY_extra[lhs-len0];
// double [] xy_rhs = (rhs < len0)? gIP[fileNumber].pixelsXY[rhs] : gIP[fileNumber].pixelsXY_extra[rhs-len0];
double x_lhs = all_xy[lhs][0] - px;
double y_lhs = all_xy[lhs][1] - py;
double x_rhs = all_xy[rhs][0] - px;
double y_rhs = all_xy[rhs][1] - py;
double l2_lhs = x_lhs*x_lhs + y_lhs*y_lhs;
double l2_rhs = x_rhs*x_rhs + y_rhs*y_rhs;
return l2_rhs > l2_lhs ? -1 : (l2_rhs < l2_lhs) ? 1 : 0;
}
});
// now list neibs start with closest to px,py node. Get first with non-collinearU,V
int dlen = -1;
int [] i01 = {neibs.get(0), neibs.get(1)};
int [] duv0 = {all_uv[i01[1]][0]-all_uv[i01[0]][0], all_uv[i01[1]][1]-all_uv[i01[0]][1]};
for (int ii = 2;ii < len; ii++) {
int i = neibs.get(ii);
// int [] duv = {all_uv[i][0]-all_uv[0][0], all_uv[i][1]-all_uv[0][1]};
int idet = (duv0[0] * (all_uv[i][1]-all_uv[i01[0]][1]))
- (duv0[1] * (all_uv[i][0]-all_uv[i01[0]][0]));
if (idet != 0) {
dlen = i + 1;
break;
}
}
if (dlen < 0) {
return null;
}
double [][][] data =new double [dlen][2][2];
// U(x,y), v(x,y)
for (int i=0; i < dlen; i++){
int indx = neibs.get(i);
data[i][0][0]=all_xy[indx][0];
data[i][0][1]=all_xy[indx][1];
data[i][1][0]=all_uv[indx][0];
data[i][1][1]=all_uv[indx][1];
}
double [][] coeff=new PolynomialApproximation(this.debugLevel).quadraticApproximation(data, true); // force linear
if (coeff == null) {
return null;
}
double [] uv0 =
{ (coeff[0][0] * px + coeff[0][1] * py + coeff[0][2]),
(coeff[1][0] * px + coeff[1][1] * py + coeff[1][2])};
int [][] reMap= MatchSimulatedPattern.getRemapMatrix(this.gIP[fileNumber].getUVShiftRot());
// double [] uv = { reMap[0][0]*uv0[0] + reMap[0][1]* uv0[1] + reMap[0][2], // u
// ( reMap[1][0]*uv0[0] + reMap[1][1]* uv0[1] + reMap[1][2])}; // v;
// Sign?
double [] uv = { reMap[0][0]*uv0[0] + reMap[0][1]* uv0[1] - reMap[0][2], // u
( reMap[1][0]*uv0[0] + reMap[1][1]* uv0[1] - reMap[1][2])}; // v;
return uv;
}
public int [] setGridsWithRemap(
int fileNumber,
int [][] reMap,
......
......@@ -771,7 +771,7 @@ horizontal axis:
throw new IllegalArgumentException(msg);
}
// remove unneeded, copied from updateFocusGrid()
// remove unneeded, copied from updateFocusGrid() Now it is not needed?
SimulationPattern.SimulParameters simulParameters = modifySimulParameters();
MatchSimulatedPattern.DistortionParameters distortionParameters = modifyDistortionParameters();
......@@ -1007,6 +1007,10 @@ horizontal axis:
};
return result;
}
public static class GoniometerParameters {
public String gridGeometryFile="";
public String initialCalibrationFile="";
......
......@@ -6818,8 +6818,11 @@ public class MatchSimulatedPattern {
numPointerDetected++;
}
}
if (numPointerDetected>0) return pointersXY;
else return null;
if (numPointerDetected>0) {
return pointersXY;
} else {
return null;
}
}
public static void setPointersXYUV(ImagePlus imp, double [][] pointersXYUV){
......
......@@ -739,6 +739,7 @@ import ij.io.Opener;
int [] iUV={u1-this.U0, v1-this.V0};
return iUV;
}
public double[] getXYZM(int u, int v, boolean verbose, int station){ // u=0,v=0 - center!
int u1=u+this.U0;
int v1=v+this.V0;
......@@ -761,6 +762,31 @@ import ij.io.Opener;
return result;
// return this.gridGeometry[v1][u1];
}
public double[] getXYZ(
double [] uv,
boolean verbose,
int station){ // u=0,v=0 - center!
int iu = (int) Math.floor(uv[0]);
int iv = (int) Math.floor(uv[1]);
double fu = uv[0] - iu;
double fv = uv[1] - iv;
double [][] corn = new double [4][];
corn[0] = getXYZM(iu, iv, verbose, station);
corn[1] = getXYZM(iu + 1, iv, verbose, station);
corn[2] = getXYZM(iu, iv + 1, verbose, station);
corn[3] = getXYZM(iu + 1, iv + 1, verbose, station);
if ((corn[0] == null) || (corn[1] == null) || (corn[2] == null) || (corn[3] == null)) {
System.out.println("Optical axis outside of te grid: TODO: modify getXYZM() to handle!");
return null;
}
double [] rslt_xyz = new double[3];
rslt_xyz[0] = (1-fu) * (1-fv) * corn[0][0] + fu * (1-fv) * corn[1][0] + (1-fu) * fv * corn[2][0] + fu * fv * corn[3][0];
rslt_xyz[1] = (1-fu) * (1-fv) * corn[0][1] + fu * (1-fv) * corn[1][1] + (1-fu) * fv * corn[2][1] + fu * fv * corn[3][1];
rslt_xyz[2] = (1-fu) * (1-fv) * corn[0][2] + fu * (1-fv) * corn[1][2] + (1-fu) * fv * corn[2][2] + fu * fv * corn[3][2];
return rslt_xyz;
}
public int getGridIndex(int u, int v){ // u=0,v=0 - center!
int u1=u+this.U0;
int v1=v+this.V0;
......
......@@ -77,7 +77,7 @@ public class LwirReader {
public static final int MAX_THREADS = 100; // combine from all classes?
public static final int FRAMES_AHEAD = 5;
/** Logger for this class. */
private static final Logger LOGGER =
LoggerFactory.getLogger(LwirReader.class);
......@@ -568,7 +568,7 @@ public class LwirReader {
fs.saveAsTiff(path);
}
}
if (lrp.isShowImages()) {
if (imps_avg != null) {
for (ImagePlus imp: imps_avg) {
......@@ -665,8 +665,13 @@ public class LwirReader {
"&TRIG_BITLENGTH=31*0"+
"&EXTERN_TIMESTAMP=1*0";
}
if (lrp.eo_full_window) {
urls[num_lwir+chn] +=
"&WOI_LEFT=0"+
"&WOI_TOP=0"+
"&WOI_WIDTH=2592"+
"&WOI_HEIGHT=1936";
}
}
for (int i = 0; i < urls.length; i++) {
LOGGER.debug("programLWIRCamera(): reading url " + urls[i]);
......
......@@ -36,26 +36,27 @@ import ij.ImagePlus;
import ij.Prefs;
public class LwirReaderParameters {
private boolean parameters_updated = false;
protected int avg_number = 4; // number of measurements to average
protected boolean lwir_ffc = true;
protected boolean avg_all = true;
protected String lwir_ip = "192.168.0.36";
protected String eo_ip = "192.168.0.38";
protected int [] lwir_channels = {0, 1, 2 ,3};
protected int [] eo_channels = {0, 1, 2 ,3};
protected boolean lwir_telemetry = true;
protected double eo_quality = 98.0;
protected boolean eo_scale = false; // restore sensor pixel values, undo camera white balancing
protected boolean eo_autoexp = false;
protected double eo_max_autoexp_ms = 20.0;
protected double eo_exposure_ms = 5.0;
protected boolean eo_whitebal = false;
protected double eo_gain_g = 2.0;
protected double eo_gain_rg = 0.7705; // 1.116; halogen/fluorescent
protected double eo_gain_bg = 2.401; // 1.476;
protected boolean [] selected_channels = {true, true, true, true, true, true, true, true};
protected int max_lwir_width = 1024; //
private boolean parameters_updated = false;
protected int avg_number = 4; // number of measurements to average
protected boolean lwir_ffc = true;
protected boolean avg_all = true;
protected String lwir_ip = "192.168.0.36";
protected String eo_ip = "192.168.0.38";
protected int [] lwir_channels = {0, 1, 2 ,3};
protected int [] eo_channels = {0, 1, 2 ,3};
protected boolean lwir_telemetry = true;
protected boolean eo_full_window = true;
protected double eo_quality = 98.0;
protected boolean eo_scale = false; // restore sensor pixel values, undo camera white balancing
protected boolean eo_autoexp = false;
protected double eo_max_autoexp_ms = 20.0;
protected double eo_exposure_ms = 5.0;
protected boolean eo_whitebal = false;
protected double eo_gain_g = 2.0;
protected double eo_gain_rg = 0.7705; // 1.116; halogen/fluorescent
protected double eo_gain_bg = 2.401; // 1.476;
protected boolean [] selected_channels = {true, true, true, true, true, true, true, true};
protected int max_lwir_width = 1024; //
/*
protected double [] eo_exp_corr = {1.0, 1.0, 1.0, 1.0};
protected double [] eo_gcorr_rbgb = {
......@@ -115,21 +116,22 @@ public class LwirReaderParameters {
properties.setProperty(prefix+"lwir_ffc", this.lwir_ffc+"");
properties.setProperty(prefix+"avg_all", this.avg_all+"");
properties.setProperty(prefix+"lwir_ip", this.lwir_ip+"");
properties.setProperty(prefix+"eo_ip", this.eo_ip+"");
properties.setProperty(prefix+"eo_ip", this.eo_ip+"");
properties.setProperty(prefix+"lwir_channels", arr_to_str(this.lwir_channels));
properties.setProperty(prefix+"eo_channels", arr_to_str(this.eo_channels));
properties.setProperty(prefix+"eo_channels", arr_to_str(this.eo_channels));
properties.setProperty(prefix+"lwir_telemetry", this.lwir_telemetry+"");
properties.setProperty(prefix+"eo_quality", this.eo_quality+"");
properties.setProperty(prefix+"eo_scale", this.eo_scale+"");
properties.setProperty(prefix+"eo_autoexp", this.eo_autoexp+"");
properties.setProperty(prefix+"eo_max_autoexp_ms", this.eo_max_autoexp_ms+"");
properties.setProperty(prefix+"eo_exposure_ms", this.eo_exposure_ms+"");
properties.setProperty(prefix+"eo_whitebal", this.eo_whitebal+"");
properties.setProperty(prefix+"eo_gain_g", this.eo_gain_g+"");
properties.setProperty(prefix+"eo_gain_rg", this.eo_gain_rg+"");
properties.setProperty(prefix+"eo_gain_bg", this.eo_gain_bg+"");
properties.setProperty(prefix+"eo_exp_corr", arr_to_str(this.eo_exp_corr));
properties.setProperty(prefix+"eo_gcorr_rbgb", arr_to_str(this.eo_gcorr_rbgb));
properties.setProperty(prefix+"eo_full_window", this.eo_full_window+"");
properties.setProperty(prefix+"eo_quality", this.eo_quality+"");
properties.setProperty(prefix+"eo_scale", this.eo_scale+"");
properties.setProperty(prefix+"eo_autoexp", this.eo_autoexp+"");
properties.setProperty(prefix+"eo_max_autoexp_ms", this.eo_max_autoexp_ms+"");
properties.setProperty(prefix+"eo_exposure_ms", this.eo_exposure_ms+"");
properties.setProperty(prefix+"eo_whitebal", this.eo_whitebal+"");
properties.setProperty(prefix+"eo_gain_g", this.eo_gain_g+"");
properties.setProperty(prefix+"eo_gain_rg", this.eo_gain_rg+"");
properties.setProperty(prefix+"eo_gain_bg", this.eo_gain_bg+"");
properties.setProperty(prefix+"eo_exp_corr", arr_to_str(this.eo_exp_corr));
properties.setProperty(prefix+"eo_gcorr_rbgb", arr_to_str(this.eo_gcorr_rbgb));
properties.setProperty(prefix+"lwir_trig_dly", this.lwir_trig_dly+"");
properties.setProperty(prefix+"eo_lag", this.eo_lag+"");
properties.setProperty(prefix+"max_mismatch_ms", this.max_mismatch_ms+"");
......@@ -137,7 +139,6 @@ public class LwirReaderParameters {
properties.setProperty(prefix+"debug_level", this.debug_level+"");
properties.setProperty(prefix+"selected_channels", arr_to_str(this.selected_channels));
properties.setProperty(prefix+"show_images", this.show_images+"");
}
public void getProperties(String prefix,Properties properties){
......@@ -160,21 +161,22 @@ public class LwirReaderParameters {
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");
if (properties.getProperty(prefix+"eo_ip")!=null) this.eo_ip= properties.getProperty(prefix+"eo_ip");
if (properties.getProperty(prefix+"eo_ip")!=null) this.eo_ip= properties.getProperty(prefix+"eo_ip");
if (properties.getProperty(prefix+"lwir_channels")!=null) this.lwir_channels=str_to_iarr(properties.getProperty(prefix+"lwir_channels"));
if (properties.getProperty(prefix+"eo_channels")!=null) this.eo_channels=str_to_iarr(properties.getProperty(prefix+"eo_channels"));
if (properties.getProperty(prefix+"lwir_telemetry")!=null) this.lwir_telemetry= Boolean.parseBoolean(properties.getProperty(prefix+"lwir_telemetry"));
if (properties.getProperty(prefix+"eo_quality")!=null) this.eo_quality=Double.parseDouble(properties.getProperty(prefix+"eo_quality"));
if (properties.getProperty(prefix+"eo_full_window")!=null) this.eo_full_window= Boolean.parseBoolean(properties.getProperty(prefix+"eo_full_window"));
if (properties.getProperty(prefix+"eo_quality")!=null) this.eo_quality=Double.parseDouble(properties.getProperty(prefix+"eo_quality"));
if (properties.getProperty(prefix+"eo_scale")!=null) this.eo_scale= Boolean.parseBoolean(properties.getProperty(prefix+"eo_scale"));
if (properties.getProperty(prefix+"eo_autoexp")!=null) this.eo_autoexp= Boolean.parseBoolean(properties.getProperty(prefix+"eo_autoexp"));
if (properties.getProperty(prefix+"eo_max_autoexp_ms")!=null) this.eo_max_autoexp_ms=Double.parseDouble(properties.getProperty(prefix+"eo_max_autoexp_ms"));
if (properties.getProperty(prefix+"eo_exposure_ms")!=null) this.eo_exposure_ms=Double.parseDouble(properties.getProperty(prefix+"eo_exposure_ms"));
if (properties.getProperty(prefix+"eo_whitebal")!=null) this.eo_whitebal= Boolean.parseBoolean(properties.getProperty(prefix+"eo_whitebal"));
if (properties.getProperty(prefix+"eo_gain_g")!=null) this.eo_gain_g=Double.parseDouble(properties.getProperty(prefix+"eo_gain_g"));
if (properties.getProperty(prefix+"eo_gain_rg")!=null) this.eo_gain_rg=Double.parseDouble(properties.getProperty(prefix+"eo_gain_rg"));
if (properties.getProperty(prefix+"eo_gain_bg")!=null) this.eo_gain_bg=Double.parseDouble(properties.getProperty(prefix+"eo_gain_bg"));
if (properties.getProperty(prefix+"eo_exp_corr")!=null) this.eo_exp_corr=str_to_darr(properties.getProperty(prefix+"eo_exp_corr"));
if (properties.getProperty(prefix+"eo_gcorr_rbgb")!=null) this.eo_gcorr_rbgb=str_to_darr(properties.getProperty(prefix+"eo_gcorr_rbgb"));
if (properties.getProperty(prefix+"eo_autoexp")!=null) this.eo_autoexp= Boolean.parseBoolean(properties.getProperty(prefix+"eo_autoexp"));
if (properties.getProperty(prefix+"eo_max_autoexp_ms")!=null) this.eo_max_autoexp_ms=Double.parseDouble(properties.getProperty(prefix+"eo_max_autoexp_ms"));
if (properties.getProperty(prefix+"eo_exposure_ms")!=null) this.eo_exposure_ms=Double.parseDouble(properties.getProperty(prefix+"eo_exposure_ms"));
if (properties.getProperty(prefix+"eo_whitebal")!=null) this.eo_whitebal= Boolean.parseBoolean(properties.getProperty(prefix+"eo_whitebal"));
if (properties.getProperty(prefix+"eo_gain_g")!=null) this.eo_gain_g=Double.parseDouble(properties.getProperty(prefix+"eo_gain_g"));
if (properties.getProperty(prefix+"eo_gain_rg")!=null) this.eo_gain_rg=Double.parseDouble(properties.getProperty(prefix+"eo_gain_rg"));
if (properties.getProperty(prefix+"eo_gain_bg")!=null) this.eo_gain_bg=Double.parseDouble(properties.getProperty(prefix+"eo_gain_bg"));
if (properties.getProperty(prefix+"eo_exp_corr")!=null) this.eo_exp_corr=str_to_darr(properties.getProperty(prefix+"eo_exp_corr"));
if (properties.getProperty(prefix+"eo_gcorr_rbgb")!=null) this.eo_gcorr_rbgb=str_to_darr(properties.getProperty(prefix+"eo_gcorr_rbgb"));
if (properties.getProperty(prefix+"lwir_trig_dly")!=null) this.lwir_trig_dly=Integer.parseInt(properties.getProperty(prefix+"lwir_trig_dly"));
if (properties.getProperty(prefix+"eo_lag")!=null) this.eo_lag=Integer.parseInt(properties.getProperty(prefix+"eo_lag"));
if (properties.getProperty(prefix+"max_mismatch_ms")!=null) this.max_mismatch_ms=Double.parseDouble(properties.getProperty(prefix+"max_mismatch_ms"));
......@@ -186,33 +188,34 @@ public class LwirReaderParameters {
}
@Override
public LwirReaderParameters clone() { // throws CloneNotSupportedException {
LwirReaderParameters lrp = new LwirReaderParameters();
lrp.avg_number= this.avg_number;
lrp.lwir_ffc= this.lwir_ffc;
lrp.avg_all= this.avg_all;
lrp.lwir_ip= this.lwir_ip;
lrp.eo_ip= this.eo_ip;
lrp.lwir_channels= this.lwir_channels.clone();
lrp.eo_channels= this.eo_channels.clone();
lrp.lwir_telemetry= this.lwir_telemetry;
lrp.eo_quality= this.eo_quality;
lrp.eo_scale= this.eo_scale;
lrp.eo_autoexp= this.eo_autoexp;
lrp.eo_max_autoexp_ms= this.eo_max_autoexp_ms;
lrp.eo_exposure_ms= this.eo_exposure_ms;
lrp.eo_whitebal= this.eo_whitebal;
lrp.eo_gain_g= this.eo_gain_g;
lrp.eo_gain_rg= this.eo_gain_rg;
lrp.eo_gain_bg= this.eo_gain_bg;
lrp.eo_exp_corr= this.eo_exp_corr.clone();
lrp.eo_gcorr_rbgb= this.eo_gcorr_rbgb.clone();
lrp.lwir_trig_dly= this.lwir_trig_dly;
lrp.eo_lag= this.eo_lag;
lrp.max_mismatch_ms= this.max_mismatch_ms;
lrp.max_frame_diff= this.max_frame_diff;
lrp.debug_level= this.debug_level;
lrp.selected_channels = this.selected_channels.clone();
lrp.show_images = this.show_images;
LwirReaderParameters lrp = new LwirReaderParameters();
lrp.avg_number= this.avg_number;
lrp.lwir_ffc= this.lwir_ffc;
lrp.avg_all= this.avg_all;
lrp.lwir_ip= this.lwir_ip;
lrp.eo_ip= this.eo_ip;
lrp.lwir_channels= this.lwir_channels.clone();
lrp.eo_channels= this.eo_channels.clone();
lrp.lwir_telemetry= this.lwir_telemetry;
lrp.eo_full_window= this.eo_full_window;
lrp.eo_quality= this.eo_quality;
lrp.eo_scale= this.eo_scale;
lrp.eo_autoexp= this.eo_autoexp;
lrp.eo_max_autoexp_ms= this.eo_max_autoexp_ms;
lrp.eo_exposure_ms= this.eo_exposure_ms;
lrp.eo_whitebal= this.eo_whitebal;
lrp.eo_gain_g= this.eo_gain_g;
lrp.eo_gain_rg= this.eo_gain_rg;
lrp.eo_gain_bg= this.eo_gain_bg;
lrp.eo_exp_corr= this.eo_exp_corr.clone();
lrp.eo_gcorr_rbgb= this.eo_gcorr_rbgb.clone();
lrp.lwir_trig_dly= this.lwir_trig_dly;
lrp.eo_lag= this.eo_lag;
lrp.max_mismatch_ms= this.max_mismatch_ms;
lrp.max_frame_diff= this.max_frame_diff;
lrp.debug_level= this.debug_level;
lrp.selected_channels = this.selected_channels.clone();
lrp.show_images = this.show_images;
return lrp;
}
......@@ -233,6 +236,7 @@ public class LwirReaderParameters {
(java.util.Arrays.equals(lrp.lwir_channels, this.lwir_channels)) &&
(java.util.Arrays.equals(lrp.eo_channels, this.eo_channels)) &&
(lrp.lwir_telemetry == this.lwir_telemetry) &&
(lrp.eo_full_window == this.eo_full_window) &&
(lrp.eo_quality == this.eo_quality) &&
(lrp.eo_scale == this.eo_scale) &&
(lrp.eo_autoexp == this.eo_autoexp) &&
......@@ -265,6 +269,7 @@ public class LwirReaderParameters {
result = prime * result + arr_to_str(lwir_channels).hashCode();
result = prime * result + arr_to_str(eo_channels).hashCode();
result = prime * result + (lwir_telemetry?1:0);
result = prime * result + (eo_full_window?1:0);
result = prime * result + (new Double(eo_quality)).hashCode();
result = prime * result + (eo_scale?1:0);
result = prime * result + (eo_autoexp?1:0);
......@@ -290,19 +295,20 @@ public class LwirReaderParameters {
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");
gd.addStringField ("EO IP", this.eo_ip, 20, "Visible range high resolution camera IP address");
gd.addStringField ("EO IP", this.eo_ip, 20, "Visible range high resolution camera IP address");
gd.addStringField ("LWIR channels", arr_to_str(this.lwir_channels), 20, "Space-separated list of used LWIR camera channels, such as '0 1 2 3'");
gd.addStringField ("EO channels", arr_to_str(this.eo_channels), 20, "Space-separated list of used visible range camera channels, such as '0 1 2 3'");
gd.addCheckbox ("LWIR telemetry", this.lwir_telemetry, "Set LWIR sesnors to provide telemetry data in the last 2 lines (may become mandatory later)");
gd.addNumericField("EO quality", this.eo_quality, 3,6,"%", "Visible range camera JPEG compression quality (all channels)");
gd.addCheckbox ("LWIR telemetry",this.lwir_telemetry, "Set LWIR sesnors to provide telemetry data in the last 2 lines (may become mandatory later)");
gd.addCheckbox ("EO full window",this.eo_full_window, "Set EO to full window, disregarding preset margins (need reset to restore original)");
gd.addNumericField("EO quality", this.eo_quality, 3,6,"%", "Visible range camera JPEG compression quality (all channels)");
gd.addCheckbox ("EO undo white balance", this.eo_scale, "Undo in-camera white balancing");
gd.addCheckbox ("EO autoexposure", this.eo_autoexp, "Enable autoexposure for the visible range camera");
gd.addCheckbox ("EO autoexposure",this.eo_autoexp, "Enable autoexposure for the visible range camera");
gd.addNumericField("EO eo_max_autoexp_ms", this.eo_max_autoexp_ms, 3,6,"ms", "Visible range camera maximal exposure in autoexposure mode");
gd.addNumericField("EO exposure", this.eo_exposure_ms, 3,6,"ms", "Visible range camera exposure time (all channels)");
gd.addNumericField("EO exposure", this.eo_exposure_ms, 3,6,"ms", "Visible range camera exposure time (all channels)");
gd.addCheckbox ("EO white balance", this.eo_whitebal, "Enable automatic white balancing for the visible range camera");
gd.addNumericField("EO gain G", this.eo_gain_g, 3,6,"","Analog gain for green channel for all visible range camera channels (normally 2.0)");
gd.addNumericField("EO gain R/G", this.eo_gain_rg, 3,6,"","Red to green gain ratio for all visible range camera channels");
gd.addNumericField("EO gain B/G", this.eo_gain_bg, 3,6,"","Blue to green gain ratio for all visible range camera channels");
gd.addNumericField("EO gain G", this.eo_gain_g, 3,6,"","Analog gain for green channel for all visible range camera channels (normally 2.0)");
gd.addNumericField("EO gain R/G", this.eo_gain_rg, 3,6,"","Red to green gain ratio for all visible range camera channels");
gd.addNumericField("EO gain B/G", this.eo_gain_bg, 3,6,"","Blue to green gain ratio for all visible range camera channels");
gd.addStringField ("EO exposuere corrections", arr_to_str(this.eo_exp_corr), 50, "Fine corrections of channel exposures (4 channel relative exposures)");
gd.addStringField ("EO gain corrections", arr_to_str(this.eo_gcorr_rbgb), 100, "Fine corrections to per channel, per color gains:'r0 b0 gb0 r1 b1 gb1 ...'");
gd.addNumericField("LWIR trig dly", this.lwir_trig_dly, 0,10,"x10ns","Output trigger delay, should eventually match Lepton+FPGA latency to trigger EO exactly 1 frame after LWIR. 0 does not work with current FPGA - usec do not match sec in transmitted timestamp");
......@@ -315,38 +321,39 @@ public class LwirReaderParameters {
}
public void dialogAnswers(GenericJTabbedDialog gd) {
this.avg_number = (int) gd.getNextNumber();
this.lwir_ffc = gd.getNextBoolean();
this.avg_all = gd.getNextBoolean();
this.lwir_ip = gd.getNextString();
this.eo_ip = gd.getNextString();
this.lwir_channels = str_to_iarr(gd.getNextString());
this.eo_channels = str_to_iarr(gd.getNextString());
this.lwir_telemetry = gd.getNextBoolean();
this.eo_quality = gd.getNextNumber();
this.eo_scale = gd.getNextBoolean();
this.eo_autoexp = gd.getNextBoolean();
this.eo_max_autoexp_ms = gd.getNextNumber();
this.eo_exposure_ms = gd.getNextNumber();
this.eo_whitebal = gd.getNextBoolean();
this.eo_gain_g = gd.getNextNumber();
this.eo_gain_rg = gd.getNextNumber();
this.eo_gain_bg = gd.getNextNumber();
this.eo_exp_corr = str_to_darr(gd.getNextString());
this.eo_gcorr_rbgb = str_to_darr(gd.getNextString());
this.lwir_trig_dly = (int) gd.getNextNumber();
this.eo_lag = (int) gd.getNextNumber();
this.max_mismatch_ms = gd.getNextNumber();
this.max_frame_diff = (int) gd.getNextNumber();
this.debug_level = (int) gd.getNextNumber();
this.selected_channels = str_to_barr(gd.getNextString());
this.show_images = gd.getNextBoolean();
this.avg_number = (int) gd.getNextNumber();
this.lwir_ffc = gd.getNextBoolean();
this.avg_all = gd.getNextBoolean();
this.lwir_ip = gd.getNextString();
this.eo_ip = gd.getNextString();
this.lwir_channels = str_to_iarr(gd.getNextString());
this.eo_channels = str_to_iarr(gd.getNextString());
this.lwir_telemetry = gd.getNextBoolean();
this.eo_full_window = gd.getNextBoolean();
this.eo_quality = gd.getNextNumber();
this.eo_scale = gd.getNextBoolean();
this.eo_autoexp = gd.getNextBoolean();
this.eo_max_autoexp_ms = gd.getNextNumber();
this.eo_exposure_ms = gd.getNextNumber();
this.eo_whitebal = gd.getNextBoolean();
this.eo_gain_g = gd.getNextNumber();
this.eo_gain_rg = gd.getNextNumber();
this.eo_gain_bg = gd.getNextNumber();
this.eo_exp_corr = str_to_darr(gd.getNextString());
this.eo_gcorr_rbgb = str_to_darr(gd.getNextString());
this.lwir_trig_dly = (int) gd.getNextNumber();
this.eo_lag = (int) gd.getNextNumber();
this.max_mismatch_ms = gd.getNextNumber();
this.max_frame_diff = (int) gd.getNextNumber();
this.debug_level = (int) gd.getNextNumber();
this.selected_channels = str_to_barr(gd.getNextString());
this.show_images = gd.getNextBoolean();
parameters_updated = true;
}
public boolean showJDialog() {
GenericJTabbedDialog gd = new GenericJTabbedDialog("Set CLT parameters",800,900);
GenericJTabbedDialog gd = new GenericJTabbedDialog("Set LWIR/EO parameters",800,900);
// gd.addTab ("General", "General parameters");
dialogQuestions(gd);
gd.showDialog();
......
......@@ -3378,15 +3378,52 @@ public class QuadCLT {
}
/// float [] pixels=(float []) imp_srcs[srcChannel].getProcessor().getPixels();
float [] vign_pixels = eyesisCorrections.channelVignettingCorrection[srcChannel];
if (pixels.length!=vign_pixels.length){
// System.out.println("Vignetting data for channel "+srcChannel+" has "+vign_pixels.length+" pixels, image "+sourceFiles[nFile]+" has "+pixels.length);
int woi_width = Integer.parseInt((String) imp_srcs[srcChannel].getProperty("WOI_WIDTH"));
int woi_height = Integer.parseInt((String) imp_srcs[srcChannel].getProperty("WOI_HEIGHT"));
int woi_top = Integer.parseInt((String) imp_srcs[srcChannel].getProperty("WOI_TOP"));
int woi_left = Integer.parseInt((String) imp_srcs[srcChannel].getProperty("WOI_LEFT"));
int vign_width = eyesisCorrections.pixelMapping.sensors[srcChannel].pixelCorrectionWidth;
int vign_height = eyesisCorrections.pixelMapping.sensors[srcChannel].pixelCorrectionHeight;
if (pixels.length != woi_width * woi_height){
System.out.println("Vignetting data for channel "+srcChannel+" has "+vign_pixels.length+" pixels, < "+
sourceFiles[nFile]+" has "+pixels.length);
woi_width = width;
woi_height = height;
}
if (vign_width < (woi_left + woi_width)) {
System.out.println("Vignetting data for channel "+srcChannel+
" has width + left ("+(woi_left+woi_width)+") > vign_width ("+vign_width+")");
return null;
}
if (vign_height < (woi_top + woi_height)) {
System.out.println("Vignetting data for channel "+srcChannel+
" has height + top ("+(woi_top+woi_height)+") > vign_height ("+vign_width+")");
return null;
}
if (pixels.length != woi_width * woi_height){
System.out.println("Vignetting data for channel "+srcChannel+" has "+vign_pixels.length+" pixels, < "+
sourceFiles[nFile]+" has "+pixels.length);
return null;
}
vign_pixels = new float[woi_width * woi_height];
for (int row = 0; row < woi_height; row++) {
System.arraycopy(
eyesisCorrections.channelVignettingCorrection[srcChannel], // src
(woi_top + row) * vign_width + woi_left, // srcPos,
vign_pixels, // dest,
row * woi_width, // destPos,
woi_width); // length);
}
if (pixels.length!=eyesisCorrections.channelVignettingCorrection[srcChannel].length){
System.out.println("Vignetting data for channel "+srcChannel+" has "+eyesisCorrections.channelVignettingCorrection[srcChannel].length+" pixels, image "+sourceFiles[nFile]+" has "+pixels.length);
return null; // not used in lwir
}
// TODO: Move to do it once:
double min_non_zero = 0.0;
for (int i=0;i<pixels.length;i++){
double d = eyesisCorrections.channelVignettingCorrection[srcChannel][i];
double d = vign_pixels[i];
if ((d > 0.0) && ((min_non_zero == 0) || (min_non_zero > d))){
min_non_zero = d;
}
......@@ -3395,7 +3432,7 @@ public class QuadCLT {
System.out.println("Vignetting data: channel="+srcChannel+", min = "+min_non_zero);
for (int i=0;i<pixels.length;i++){
double d = eyesisCorrections.channelVignettingCorrection[srcChannel][i];
double d = vign_pixels[i];
if (d > max_vign_corr) d = max_vign_corr;
pixels[i]*=d;
}
......
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