Commit ea60a595 authored by Andrey Filippov's avatar Andrey Filippov

splitting LPF sigma for Bayer/mono

parent 3ddc661d
......@@ -30,7 +30,8 @@ public class CLTParameters {
public int ishift_x = 0; // debug feature - shift source image by this pixels left
public int ishift_y = 0; // debug feature - shift source image by this pixels down
public double fat_zero = 0.0; // modify phase correlation to prevent division by very small numbers
public double corr_sigma = 0.8; // LPF correlation sigma
private double corr_sigma = 0.8; // LPF correlation sigma
private double corr_sigma_mono = 0.1; // LPF correlation sigma for monochrome images
public boolean norm_kern = true; // normalize kernels
public boolean gain_equalize = false;// equalize green channel gain (bug fix for wrong exposure in Exif ?)
public boolean colors_equalize = true; // equalize R/G, B/G of the individual channels
......@@ -766,7 +767,9 @@ public class CLTParameters {
public boolean batch_run = false; // turned on only while running in batch mode
public double getCorrSigma(boolean monochrome) {
return monochrome ? corr_sigma_mono : corr_sigma;
}
public CLTParameters(){}
public void setProperties(String prefix,Properties properties){
......@@ -782,6 +785,7 @@ public class CLTParameters {
properties.setProperty(prefix+"ishift_y", this.ishift_y+"");
properties.setProperty(prefix+"fat_zero", this.fat_zero+"");
properties.setProperty(prefix+"corr_sigma", this.corr_sigma+"");
properties.setProperty(prefix+"corr_sigma_mono", this.corr_sigma_mono+"");
properties.setProperty(prefix+"norm_kern", this.norm_kern+"");
properties.setProperty(prefix+"gain_equalize", this.gain_equalize+"");
properties.setProperty(prefix+"colors_equalize", this.colors_equalize+"");
......@@ -1476,6 +1480,7 @@ public class CLTParameters {
if (properties.getProperty(prefix+"ishift_y")!=null) this.ishift_y=Integer.parseInt(properties.getProperty(prefix+"ishift_y"));
if (properties.getProperty(prefix+"fat_zero")!=null) this.fat_zero=Double.parseDouble(properties.getProperty(prefix+"fat_zero"));
if (properties.getProperty(prefix+"corr_sigma")!=null) this.corr_sigma=Double.parseDouble(properties.getProperty(prefix+"corr_sigma"));
if (properties.getProperty(prefix+"corr_sigma_mono")!=null)this.corr_sigma_mono=Double.parseDouble(properties.getProperty(prefix+"corr_sigma_mono"));
if (properties.getProperty(prefix+"norm_kern")!=null) this.norm_kern=Boolean.parseBoolean(properties.getProperty(prefix+"norm_kern"));
if (properties.getProperty(prefix+"gain_equalize")!=null) this.gain_equalize=Boolean.parseBoolean(properties.getProperty(prefix+"gain_equalize"));
if (properties.getProperty(prefix+"colors_equalize")!=null)this.colors_equalize=Boolean.parseBoolean(properties.getProperty(prefix+"colors_equalize"));
......@@ -2185,8 +2190,9 @@ public class CLTParameters {
gd.addNumericField("ishift_x: shift source image by this pixels left", this.ishift_x, 0);
gd.addNumericField("ishift_y: shift source image by this pixels down", this.ishift_y, 0);
gd.addNumericField("Modify phase correlation to prevent division by very small numbers", this.fat_zero, 4);
gd.addNumericField("LPF correlarion sigma ", this.corr_sigma, 3);
gd.addCheckbox ("Normalize kernels ", this.norm_kern);
gd.addNumericField("LPF correlarion sigma for Bayer color images", this.corr_sigma, 3);
gd.addNumericField("LPF correlarion sigma for monochrome images", this.corr_sigma_mono, 3);
gd.addCheckbox ("Normalize kernels", this.norm_kern);
gd.addCheckbox ("Equalize green channel gain of the individual cnannels (bug fix for exposure)", this.gain_equalize);
gd.addCheckbox ("Equalize R/G, B/G balance of the individual channels", this.colors_equalize);
gd.addCheckbox ("Skip saturated when adjusting gains", this.nosat_equalize);
......@@ -3010,6 +3016,7 @@ public class CLTParameters {
this.ishift_y= (int) gd.getNextNumber();
this.fat_zero = gd.getNextNumber();
this.corr_sigma = gd.getNextNumber();
this.corr_sigma_mono = gd.getNextNumber();
this.norm_kern= gd.getNextBoolean();
this.gain_equalize= gd.getNextBoolean();
this.colors_equalize= gd.getNextBoolean();
......
......@@ -65,6 +65,10 @@ public class ColorProcParameters {
public boolean use8; // use 8 neighbors (false - only 4)
public boolean isMonochrome() {
return lwir_islwir; // for now it is the only reason to be monochrome
}
private ColorProcParameters() {}
public ColorProcParameters(
boolean lwir_islwir, // false;
......
......@@ -6967,7 +6967,7 @@ private Panel panel1,
}
String suffix = "-dx_"+(CLT_PARAMETERS.ishift_x+CLT_PARAMETERS.shift_x)+"_dy_"+(CLT_PARAMETERS.ishift_y+CLT_PARAMETERS.shift_y);
ImageDtt image_dtt = new ImageDtt(false); // Bayer, not monochrome
ImageDtt image_dtt = new ImageDtt(COLOR_PROC_PARAMETERS.isMonochrome()); // Bayer, not monochrome
String [] titles = {
"redCC", "redSC", "redCS", "redSS",
"blueCC", "blueSC", "blueCS", "blueSS",
......@@ -7081,10 +7081,10 @@ private Panel panel1,
DBG_IMP.getTitle()+"-CORR+"+suffix, titles);
}
if (CLT_PARAMETERS.corr_sigma > 0.0){
if (CLT_PARAMETERS.getCorrSigma(image_dtt.isMonochrome()) > 0.0){
for (int chn = 0; chn < clt_data.length; chn++) {
image_dtt.clt_lpf( // filter in-place
CLT_PARAMETERS.corr_sigma, // final double sigma,
CLT_PARAMETERS.getCorrSigma(image_dtt.isMonochrome()), // final double sigma,
clt_corr[chn], // final double [][][][] clt_data,
CLT_PARAMETERS.transform_size,
THREADS_MAX, // maximal number of threads to launch
......
......@@ -8063,13 +8063,13 @@ public class ImageDtt {
final double [] filter_direct= new double[transform_len];
if (clt_parameters.corr_sigma == 0) {
if (clt_parameters.getCorrSigma(isMonochrome()) == 0) {
filter_direct[0] = 1.0;
for (int i= 1; i<filter_direct.length;i++) filter_direct[i] =0;
} else {
for (int i = 0; i < clt_parameters.transform_size; i++){
for (int j = 0; j < clt_parameters.transform_size; j++){
filter_direct[i * clt_parameters.transform_size+j] = Math.exp(-(i*i+j*j)/(2*clt_parameters.corr_sigma)); // FIXME: should be sigma*sigma !
filter_direct[i * clt_parameters.transform_size+j] = Math.exp(-(i*i+j*j)/(2*clt_parameters.getCorrSigma(isMonochrome()))); // FIXME: should be sigma*sigma !
}
}
}
......@@ -8864,13 +8864,13 @@ public class ImageDtt {
final double [] filter_direct= new double[transform_len];
if (clt_parameters.corr_sigma == 0) {
if (clt_parameters.getCorrSigma(isMonochrome()) == 0) {
filter_direct[0] = 1.0;
for (int i= 1; i<filter_direct.length;i++) filter_direct[i] =0;
} else {
for (int i = 0; i < clt_parameters.transform_size; i++){
for (int j = 0; j < clt_parameters.transform_size; j++){
filter_direct[i * clt_parameters.transform_size+j] = Math.exp(-(i*i+j*j)/(2*clt_parameters.corr_sigma)); // FIXME: should be sigma*sigma !
filter_direct[i * clt_parameters.transform_size+j] = Math.exp(-(i*i+j*j)/(2*clt_parameters.getCorrSigma(isMonochrome()))); // FIXME: should be sigma*sigma !
}
}
}
......@@ -9594,13 +9594,13 @@ public class ImageDtt {
final double [] filter_direct= new double[transform_len];
if (clt_parameters.corr_sigma == 0) {
if (clt_parameters.getCorrSigma(isMonochrome()) == 0) {
filter_direct[0] = 1.0;
for (int i= 1; i<filter_direct.length;i++) filter_direct[i] =0;
} else {
for (int i = 0; i < clt_parameters.transform_size; i++){
for (int j = 0; j < clt_parameters.transform_size; j++){
filter_direct[i * clt_parameters.transform_size+j] = Math.exp(-(i*i+j*j)/(2*clt_parameters.corr_sigma)); // FIXME: should be sigma*sigma !
filter_direct[i * clt_parameters.transform_size+j] = Math.exp(-(i*i+j*j)/(2*clt_parameters.getCorrSigma(isMonochrome()))); // FIXME: should be sigma*sigma !
}
}
}
......
......@@ -326,7 +326,7 @@ public class MacroCorrelation {
clt_parameters.corr_offset,
clt_parameters.corr_red,
clt_parameters.corr_blue,
clt_parameters.corr_sigma,
clt_parameters.getCorrSigma(image_dtt.isMonochrome()),
clt_parameters.corr_normalize, // normalize correlation results by rms
min_corr_selected, // 0.0001; // minimal correlation value to consider valid
clt_parameters.max_corr_sigma,// 1.5; // weights of points around global max to find fractional
......
......@@ -1686,10 +1686,10 @@ public class QuadCLT {
debugLevel);
} else { // just LPF RGB
*/
if (clt_parameters.corr_sigma > 0){ // no filter at all
if (clt_parameters.getCorrSigma(image_dtt.isMonochrome()) > 0){ // no filter at all
for (int chn = 0; chn < clt_data.length; chn++) {
image_dtt.clt_lpf(
clt_parameters.corr_sigma,
clt_parameters.getCorrSigma(image_dtt.isMonochrome()),
clt_data[chn],
clt_parameters.transform_size,
threadsMax,
......@@ -2287,10 +2287,10 @@ public class QuadCLT {
debugLevel);
} else { // just LPF RGB
*/
if (clt_parameters.corr_sigma > 0){ // no filter at all
if (clt_parameters.getCorrSigma(image_dtt.isMonochrome()) > 0){ // no filter at all
for (int chn = 0; chn < clt_data.length; chn++) {
image_dtt.clt_lpf(
clt_parameters.corr_sigma,
clt_parameters.getCorrSigma(image_dtt.isMonochrome()),
clt_data[chn],
clt_parameters.transform_size,
threadsMax,
......@@ -2848,10 +2848,10 @@ public class QuadCLT {
String title=name+"-"+String.format("%02d", iQuad);
String titleFull=title+"-SPLIT";
if (clt_parameters.corr_sigma > 0){ // no filter at all
if (clt_parameters.getCorrSigma(image_dtt.isMonochrome()) > 0){ // no filter at all
for (int chn = 0; chn < clt_data[iQuad].length; chn++) {
image_dtt.clt_lpf(
clt_parameters.corr_sigma,
clt_parameters.getCorrSigma(image_dtt.isMonochrome()),
clt_data[iQuad][chn],
clt_parameters.transform_size,
threadsMax,
......@@ -3941,7 +3941,7 @@ public class QuadCLT {
clt_parameters.corr_offset,
clt_parameters.corr_red,
clt_parameters.corr_blue,
clt_parameters.corr_sigma,
clt_parameters.getCorrSigma(image_dtt.isMonochrome()),
// clt_parameters.corr_mask,
clt_parameters.corr_normalize, // normalize correlation results by rms
min_corr_selected, // 0.0001; // minimal correlation value to consider valid
......@@ -4263,10 +4263,10 @@ public class QuadCLT {
String title=name+"-"+String.format("%02d", iQuad);
// String titleFull=title+"-SPLIT-D"+clt_parameters.disparity;
if (clt_parameters.corr_sigma > 0){ // no filter at all
if (clt_parameters.getCorrSigma(image_dtt.isMonochrome()) > 0){ // no filter at all
for (int chn = 0; chn < clt_data[iQuad].length; chn++) if (clt_data[iQuad][chn] != null){
image_dtt.clt_lpf(
clt_parameters.corr_sigma,
clt_parameters.getCorrSigma(image_dtt.isMonochrome()),
clt_data[iQuad][chn],
clt_parameters.transform_size,
threadsMax,
......@@ -5204,7 +5204,7 @@ public class QuadCLT {
clt_parameters.corr_offset,
clt_parameters.corr_red,
clt_parameters.corr_blue,
clt_parameters.corr_sigma,
clt_parameters.getCorrSigma(image_dtt.isMonochrome()),
clt_parameters.corr_normalize, // normalize correlation results by rms
min_corr_selected, // 0.0001; // minimal correlation value to consider valid
clt_parameters.max_corr_sigma,// 1.5; // weights of points around global max to find fractional
......@@ -8393,7 +8393,7 @@ public class QuadCLT {
clt_parameters.corr_offset,
clt_parameters.corr_red,
clt_parameters.corr_blue,
clt_parameters.corr_sigma,
clt_parameters.getCorrSigma(image_dtt.isMonochrome()),
clt_parameters.corr_normalize, // normalize correlation results by rms
min_corr_selected, // 0.0001; // minimal correlation value to consider valid
clt_parameters.max_corr_sigma,// 1.5; // weights of points around global max to find fractional
......@@ -8608,7 +8608,7 @@ public class QuadCLT {
clt_parameters.corr_offset,
clt_parameters.corr_red,
clt_parameters.corr_blue,
clt_parameters.corr_sigma,
clt_parameters.getCorrSigma(image_dtt.isMonochrome()),
clt_parameters.corr_normalize, // normalize correlation results by rms
min_corr_selected, // 0.0001; // minimal correlation value to consider valid
clt_parameters.max_corr_sigma,// 1.5; // weights of points around global max to find fractional
......@@ -8741,7 +8741,7 @@ public class QuadCLT {
clt_parameters.corr_offset,
clt_parameters.corr_red,
clt_parameters.corr_blue,
clt_parameters.corr_sigma,
clt_parameters.getCorrSigma(image_dtt.isMonochrome()),
clt_parameters.corr_normalize, // normalize correlation results by rms
min_corr_selected, // 0.0001; // minimal correlation value to consider valid
clt_parameters.max_corr_sigma,// 1.5; // weights of points around global max to find fractional
......
......@@ -894,10 +894,10 @@ public class TwoQuadCLT {
// String title=name+"-"+String.format("%s%02d", ((iAux>0)?"A":"M"),iSubCam);
String title=name+"-"+String.format("%02d", iQuadComb);
if (clt_parameters.corr_sigma > 0){ // no filter at all
if (clt_parameters.getCorrSigma(image_dtt.isMonochrome()) > 0){ // no filter at all
for (int chn = 0; chn < clt_bidata[iAux][iSubCam].length; chn++) {
image_dtt.clt_lpf(
clt_parameters.corr_sigma,
clt_parameters.getCorrSigma(image_dtt.isMonochrome()),
clt_bidata[iAux][iSubCam][chn],
clt_parameters.transform_size,
threadsMax,
......@@ -1670,11 +1670,11 @@ public class TwoQuadCLT {
// Uncomment to have master/aux names
// String title=name+"-"+String.format("%s%02d", ((iAux>0)?"A":"M"),iSubCam);
String title=name+"-"+String.format("%02d", iQuadComb);
if (clt_parameters.corr_sigma > 0){ // no filter at all
if (clt_parameters.getCorrSigma(image_dtt.isMonochrome()) > 0){ // no filter at all
for (int chn = 0; chn < clt_bidata[iAux][iSubCam].length; chn++) {
int debug_lpf = ((iQuadComb ==0) && (chn==0))?3: debugLevel;
image_dtt.clt_lpf(
clt_parameters.corr_sigma,
clt_parameters.getCorrSigma(image_dtt.isMonochrome()),
clt_bidata[iAux][iSubCam][chn],
clt_parameters.transform_size,
threadsMax,
......
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