Commit 4648e870 authored by Andrey Filippov's avatar Andrey Filippov

working with color

parent 56b7ed16
...@@ -100,7 +100,7 @@ public class CorrectionColorProc { ...@@ -100,7 +100,7 @@ public class CorrectionColorProc {
} }
//public void showArrays(double[][] pixels, int width, int height, boolean asStack, String title) { //public void showArrays(double[][] pixels, int width, int height, boolean asStack, String title) {
...@@ -138,7 +138,7 @@ public class CorrectionColorProc { ...@@ -138,7 +138,7 @@ public class CorrectionColorProc {
/* Convert to YPbPr */ /* Convert to YPbPr */
double Y,Pb,Pr; double Y,Pb,Pr;
// double Kg=1.0-colorProcParameters.kr-colorProcParameters.kb; // double Kg=1.0-colorProcParameters.kr-colorProcParameters.kb;
double Sb=0.5/(1.0-colorProcParameters.kb)*colorProcParameters.saturationBlue; double Sb=0.5/(1.0-colorProcParameters.kb)*colorProcParameters.saturationBlue;
double Sr=0.5/(1.0-colorProcParameters.kr)*colorProcParameters.saturationRed; double Sr=0.5/(1.0-colorProcParameters.kr)*colorProcParameters.saturationRed;
double Yr,Yg,Yb,Wr,Wg,Wb,S; double Yr,Yg,Yb,Wr,Wg,Wb,S;
...@@ -271,7 +271,7 @@ public class CorrectionColorProc { ...@@ -271,7 +271,7 @@ public class CorrectionColorProc {
stack.addSlice("Pr", fpixels_pr); stack.addSlice("Pr", fpixels_pr);
stack.addSlice("Pb", fpixels_pb); stack.addSlice("Pb", fpixels_pb);
stack.addSlice("Y", fpixels_y); stack.addSlice("Y", fpixels_y);
stack.addSlice("Y0", fpixels_y0); // not filtered by low-pass, preliminary (for comaprison only) stack.addSlice("Y0", fpixels_y0); // not filtered by low-pass, preliminary (for comparison only)
if (debugLevel>2) { if (debugLevel>2) {
stack.addSlice("Yr",fpixels_yR); stack.addSlice("Yr",fpixels_yR);
stack.addSlice("Yg",fpixels_yG); stack.addSlice("Yg",fpixels_yG);
......
...@@ -1802,7 +1802,13 @@ public class EyesisCorrectionParameters { ...@@ -1802,7 +1802,13 @@ public class EyesisCorrectionParameters {
public boolean convolve_direct = false; // do not apply symmetrical correction public boolean convolve_direct = false; // do not apply symmetrical correction
public double vignetting_max = 0.4; // value in vignetting data to correspond to 1x in the kernel public double vignetting_max = 0.4; // value in vignetting data to correspond to 1x in the kernel
public double vignetting_range = 3.0; // do not try to correct vignetting less than vignetting_max/vignetting_range public double vignetting_range = 5.0; // do not try to correct vignetting less than vignetting_max/vignetting_range
public boolean color_DCT = true; // false - use old color processing mode
public double sigma_rb = 0.5; // additional (to G) blur for R and B
public double sigma_y = 0.5; // blur for G contribution to Y
public double sigma_color = 1.0; // blur for Pb and Pr in addition to that of Y
public double line_thershold = 1.0; // line detection amplitude to apply line enhancement
public DCTParameters( public DCTParameters(
int dct_size, int dct_size,
...@@ -1858,6 +1864,12 @@ public class EyesisCorrectionParameters { ...@@ -1858,6 +1864,12 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"vignetting_max", this.vignetting_max+""); properties.setProperty(prefix+"vignetting_max", this.vignetting_max+"");
properties.setProperty(prefix+"vignetting_range", this.vignetting_range+""); properties.setProperty(prefix+"vignetting_range", this.vignetting_range+"");
properties.setProperty(prefix+"color_DCT", this.color_DCT+"");
properties.setProperty(prefix+"sigma_rb", this.sigma_rb+"");
properties.setProperty(prefix+"sigma_y", this.sigma_y+"");
properties.setProperty(prefix+"sigma_color", this.sigma_color+"");
properties.setProperty(prefix+"line_thershold", this.line_thershold+"");
} }
public void getProperties(String prefix,Properties properties){ public void getProperties(String prefix,Properties properties){
if (properties.getProperty(prefix+"dct_size")!=null) this.dct_size=Integer.parseInt(properties.getProperty(prefix+"dct_size")); if (properties.getProperty(prefix+"dct_size")!=null) this.dct_size=Integer.parseInt(properties.getProperty(prefix+"dct_size"));
...@@ -1894,6 +1906,11 @@ public class EyesisCorrectionParameters { ...@@ -1894,6 +1906,11 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"convolve_direct")!=null) this.convolve_direct=Boolean.parseBoolean(properties.getProperty(prefix+"convolve_direct")); if (properties.getProperty(prefix+"convolve_direct")!=null) this.convolve_direct=Boolean.parseBoolean(properties.getProperty(prefix+"convolve_direct"));
if (properties.getProperty(prefix+"vignetting_max")!=null) this.vignetting_max=Double.parseDouble(properties.getProperty(prefix+"vignetting_max")); if (properties.getProperty(prefix+"vignetting_max")!=null) this.vignetting_max=Double.parseDouble(properties.getProperty(prefix+"vignetting_max"));
if (properties.getProperty(prefix+"vignetting_range")!=null) this.vignetting_range=Double.parseDouble(properties.getProperty(prefix+"vignetting_range")); if (properties.getProperty(prefix+"vignetting_range")!=null) this.vignetting_range=Double.parseDouble(properties.getProperty(prefix+"vignetting_range"));
if (properties.getProperty(prefix+"color_DCT")!=null) this.color_DCT=Boolean.parseBoolean(properties.getProperty(prefix+"color_DCT"));
if (properties.getProperty(prefix+"sigma_rb")!=null) this.sigma_rb=Double.parseDouble(properties.getProperty(prefix+"sigma_rb"));
if (properties.getProperty(prefix+"sigma_y")!=null) this.sigma_y=Double.parseDouble(properties.getProperty(prefix+"sigma_y"));
if (properties.getProperty(prefix+"sigma_color")!=null) this.sigma_color=Double.parseDouble(properties.getProperty(prefix+"sigma_color"));
if (properties.getProperty(prefix+"line_thershold")!=null) this.line_thershold=Double.parseDouble(properties.getProperty(prefix+"line_thershold"));
} }
public boolean showDialog() { public boolean showDialog() {
...@@ -1933,6 +1950,12 @@ public class EyesisCorrectionParameters { ...@@ -1933,6 +1950,12 @@ public class EyesisCorrectionParameters {
gd.addNumericField("Value (max) in vignetting data to correspond to 1x in the kernel",this.vignetting_max, 3); gd.addNumericField("Value (max) in vignetting data to correspond to 1x in the kernel",this.vignetting_max, 3);
gd.addNumericField("Do not try to correct vignetting smaller than this fraction of max",this.vignetting_range, 3); gd.addNumericField("Do not try to correct vignetting smaller than this fraction of max",this.vignetting_range, 3);
gd.addCheckbox ("Use DCT-base color conversion", this.color_DCT );
gd.addNumericField("Gaussian sigma to apply to R and B (in addition to G), pix", this.sigma_rb, 3);
gd.addNumericField("Gaussian sigma to apply to Y in the MDCT domain, pix", this.sigma_y, 3);
gd.addNumericField("Gaussian sigma to apply to Pr and Pb in the MDCT domain, pix", this.sigma_color, 3);
gd.addNumericField("Threshold for line detection", this.line_thershold, 3);
WindowTools.addScrollBars(gd); WindowTools.addScrollBars(gd);
gd.showDialog(); gd.showDialog();
...@@ -1971,6 +1994,13 @@ public class EyesisCorrectionParameters { ...@@ -1971,6 +1994,13 @@ public class EyesisCorrectionParameters {
this.convolve_direct= gd.getNextBoolean(); this.convolve_direct= gd.getNextBoolean();
this.vignetting_max= gd.getNextNumber(); this.vignetting_max= gd.getNextNumber();
this.vignetting_range= gd.getNextNumber(); this.vignetting_range= gd.getNextNumber();
this.color_DCT= gd.getNextBoolean();
this.sigma_rb= gd.getNextNumber();
this.sigma_y= gd.getNextNumber();
this.sigma_color= gd.getNextNumber();
this.line_thershold= gd.getNextNumber();
// MASTER_DEBUG_LEVEL= (int) gd.getNextNumber(); // MASTER_DEBUG_LEVEL= (int) gd.getNextNumber();
return true; return true;
} }
......
...@@ -1390,7 +1390,8 @@ public class EyesisCorrections { ...@@ -1390,7 +1390,8 @@ public class EyesisCorrections {
/* ======================================================================== */ /* ======================================================================== */
private boolean fixSliceSequence ( // private boolean fixSliceSequence (
public boolean fixSliceSequence ( // for EyesisDCT
ImageStack stack, ImageStack stack,
int debugLevel){ int debugLevel){
int i,j; int i,j;
...@@ -2254,7 +2255,7 @@ public class EyesisCorrections { ...@@ -2254,7 +2255,7 @@ public class EyesisCorrections {
correctionsParameters.JPEG_quality); correctionsParameters.JPEG_quality);
} }
private void saveAndShow( void saveAndShow(
// public void saveAndShow( // public void saveAndShow(
ImagePlus imp, ImagePlus imp,
EyesisCorrectionParameters.CorrectionParameters correctionsParameters, EyesisCorrectionParameters.CorrectionParameters correctionsParameters,
...@@ -2263,7 +2264,7 @@ public class EyesisCorrections { ...@@ -2263,7 +2264,7 @@ public class EyesisCorrections {
saveAndShow(imp, correctionsParameters, save, show, -1); saveAndShow(imp, correctionsParameters, save, show, -1);
} }
private void saveAndShow( void saveAndShow(
ImagePlus imp, ImagePlus imp,
EyesisCorrectionParameters.CorrectionParameters correctionsParameters, EyesisCorrectionParameters.CorrectionParameters correctionsParameters,
boolean save, boolean save,
......
This diff is collapsed.
...@@ -2758,6 +2758,7 @@ private Panel panel1,panel2,panel3,panel4,panel5,panel5a, panel6,panel7,panelPos ...@@ -2758,6 +2758,7 @@ private Panel panel1,panel2,panel3,panel4,panel5,panel5a, panel6,panel7,panelPos
DEBUG_LEVEL); DEBUG_LEVEL);
} }
// System.out.println("dct_dc.length="+dct_dc.length+" dct_ac.length="+dct_ac.length); // System.out.println("dct_dc.length="+dct_dc.length+" dct_ac.length="+dct_ac.length);
if (DEBUG_LEVEL > 0){
SDFA_INSTANCE.showArrays(dct_ac, SDFA_INSTANCE.showArrays(dct_ac,
tilesX*DCT_PARAMETERS.dct_size, tilesX*DCT_PARAMETERS.dct_size,
tilesY*DCT_PARAMETERS.dct_size, tilesY*DCT_PARAMETERS.dct_size,
...@@ -2768,6 +2769,7 @@ private Panel panel1,panel2,panel3,panel4,panel5,panel5a, panel6,panel7,panelPos ...@@ -2768,6 +2769,7 @@ private Panel panel1,panel2,panel3,panel4,panel5,panel5a, panel6,panel7,panelPos
tilesY, tilesY,
true, true,
DBG_IMP.getTitle()+"-DCT_DC"); DBG_IMP.getTitle()+"-DCT_DC");
}
double [][] idct_data = new double [dctdc_data.length][]; double [][] idct_data = new double [dctdc_data.length][];
for (int chn=0; chn<idct_data.length;chn++){ for (int chn=0; chn<idct_data.length;chn++){
idct_data[chn] = image_dtt.lapped_idctdc( idct_data[chn] = image_dtt.lapped_idctdc(
......
This diff is collapsed.
...@@ -175,7 +175,28 @@ import ij.process.*; ...@@ -175,7 +175,28 @@ import ij.process.*;
} }
} }
} }
public ImageStack makeStack(double[][] pixels, int width, int height) {
return makeStack(pixels, width,height, null);
}
public ImageStack makeStack(double[][] pixels, int width, int height, String [] titles) {
float [] fpixels;
ImageStack array_stack=new ImageStack(width,height);
for (int i=0;i<pixels.length;i++) if (pixels[i]!=null) {
if (pixels[i].length!=(width*height)){
System.out.println("showArrays(): pixels["+i+"].length="+pixels[i].length+" != width (+"+width+") * height("+height+")="+(width*height));
return null;
}
fpixels=new float[pixels[i].length];
for (int j=0;j<fpixels.length;j++) fpixels[j]=(float)pixels[i][j];
if (titles!=null){
array_stack.addSlice(titles[i], fpixels);
} else {
array_stack.addSlice("chn-"+i, fpixels);
}
}
return array_stack;
}
public ImagePlus [] makeArrays(double[][] pixels, int width, int height, String title) { public ImagePlus [] makeArrays(double[][] pixels, int width, int height, String title) {
int i,j; int i,j;
......
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