Commit 86e73701 authored by Andrey Filippov's avatar Andrey Filippov

Trying row/col FPN correction

parent c3f2181a
This diff is collapsed.
...@@ -54,6 +54,7 @@ import com.elphel.imagej.common.DoubleGaussianBlur; ...@@ -54,6 +54,7 @@ import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.PolynomialApproximation; import com.elphel.imagej.common.PolynomialApproximation;
import com.elphel.imagej.common.ShowDoubleFloatArrays; import com.elphel.imagej.common.ShowDoubleFloatArrays;
import com.elphel.imagej.correction.CorrectionColorProc; import com.elphel.imagej.correction.CorrectionColorProc;
import com.elphel.imagej.cuas.CorrectionFPN;
import com.elphel.imagej.cuas.Cuas; import com.elphel.imagej.cuas.Cuas;
import com.elphel.imagej.cuas.CuasCenterLma; import com.elphel.imagej.cuas.CuasCenterLma;
import com.elphel.imagej.gpu.GPUTileProcessor; import com.elphel.imagej.gpu.GPUTileProcessor;
...@@ -5184,7 +5185,7 @@ public class OpticalFlow { ...@@ -5184,7 +5185,7 @@ public class OpticalFlow {
} }
} }
double [][][] fpn = center_CLT.readImageFPN ( -1); // int sens_mask); double [][][] fpn = center_CLT.getCorrectionFPN().readImageFPN ( -1); // int sens_mask);
if ((fpn == null) || cuas_calc_fpn) { if ((fpn == null) || cuas_calc_fpn) {
if (debugLevel >-3) { if (debugLevel >-3) {
System.out.println("Calculating FPN."); System.out.println("Calculating FPN.");
...@@ -5193,7 +5194,7 @@ public class OpticalFlow { ...@@ -5193,7 +5194,7 @@ public class OpticalFlow {
int rot_periods = (int) Math.floor(num_scenes/cuas_rot_period); int rot_periods = (int) Math.floor(num_scenes/cuas_rot_period);
int rot_scenes = (int) Math.floor(rot_periods *cuas_rot_period); int rot_scenes = (int) Math.floor(rot_periods *cuas_rot_period);
int [] rot_range = {0, rot_scenes-1}; int [] rot_range = {0, rot_scenes-1};
fpn = QuadCLT.calculateFPN( fpn = CorrectionFPN.calculateFPN(
quadCLTs, // final QuadCLT [] quadCLTs, quadCLTs, // final QuadCLT [] quadCLTs,
rot_range, // final int [] range, // required rot_range, // final int [] range, // required
-1, // final int sensor_mask, -1, // final int sensor_mask,
...@@ -5201,11 +5202,13 @@ public class OpticalFlow { ...@@ -5201,11 +5202,13 @@ public class OpticalFlow {
int dbg_sens = 12; int dbg_sens = 12;
if (cuas_debug && (dbg_sens >= 0)) { if (cuas_debug && (dbg_sens >= 0)) {
center_CLT.debugFPN( double um_sigma_fpn = 10.0;
center_CLT.getCorrectionFPN().debugFPN(
quadCLTs, // QuadCLT [] quadCLTs, quadCLTs, // QuadCLT [] quadCLTs,
fpn, // double [][][] fpn, fpn, // double [][][] fpn,
rot_range, // int [] range, rot_range, // int [] range,
dbg_sens, // int nsens, dbg_sens, // int nsens,
um_sigma_fpn, // double um_sigma = 10.0;
show_fpn); // boolean show) { show_fpn); // boolean show) {
} }
...@@ -5215,12 +5218,12 @@ public class OpticalFlow { ...@@ -5215,12 +5218,12 @@ public class OpticalFlow {
} }
} }
// center_CLT.setImageData(fpn); // included in center_CLT.setApplyFPN(). // setting FPN images to the virtual (center) scene // center_CLT.setImageData(fpn); // included in center_CLT.setApplyFPN(). // setting FPN images to the virtual (center) scene
center_CLT.saveShowFPN( center_CLT.getCorrectionFPN().saveShowFPN(
fpn,// double [][][] fpn, fpn,// double [][][] fpn,
fpn_width, // int width, fpn_width, // int width,
true, // boolean save, true, // boolean save,
show_fpn); // boolean show) { show_fpn); // boolean show) {
center_CLT.setApplyFPN( center_CLT.getCorrectionFPN().setApplyFPN(
quadCLTs, // QuadCLT [] quadCLTs, quadCLTs, // QuadCLT [] quadCLTs,
fpn);// double [][][] fpn) fpn);// double [][][] fpn)
} else { } else {
...@@ -5228,7 +5231,7 @@ public class OpticalFlow { ...@@ -5228,7 +5231,7 @@ public class OpticalFlow {
System.out.println("Skipping FPN."); System.out.println("Skipping FPN.");
} }
// center_CLT.setImageData(null); // center_CLT.setImageData(null);
center_CLT.setApplyFPN( center_CLT.getCorrectionFPN().setApplyFPN(
quadCLTs, // QuadCLT [] quadCLTs, quadCLTs, // QuadCLT [] quadCLTs,
null);// double [][][] fpn) null);// double [][][] fpn)
} }
...@@ -8621,8 +8624,27 @@ public class OpticalFlow { ...@@ -8621,8 +8624,27 @@ public class OpticalFlow {
imp_scenes.getProcessor().resetMinAndMax(); imp_scenes.getProcessor().resetMinAndMax();
return imp_scenes; return imp_scenes;
} }
public static void applyUMDouble(
final double [] data,
final int width,
final double um_sigma,
final double um_weight) {
double [] blurred = data.clone();
(new DoubleGaussianBlur()).blurDouble(
blurred, // double[] pixels,
width, // int width,
blurred.length/width, // int height,
um_sigma, // double sigmaX,
um_sigma, // double sigmaY,
0.01); // double accuracy)
for (int i = 0; i<data.length; i++) {
data[i] -= blurred[i]*um_weight;
}
}
public static double [][] getSceneSZXY( public static double [][] getSceneSZXY(
QuadCLT scene, QuadCLT scene,
......
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