Commit f19a4557 authored by Andrey Filippov's avatar Andrey Filippov

Adding support for a dual-quad camera for CNN ground truth

parent 6db01aca
......@@ -521,6 +521,7 @@ G= Y +Pr*(- 2*Kr*(1-Kr))/Kg + Pb*(-2*Kb*(1-Kb))/Kg
public static class ColorGainsParameters {
public static final String AUX_PREFIX = "AUX-";
public double[] gain={
1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,
1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,
......@@ -548,7 +549,7 @@ G= Y +Pr*(- 2*Kr*(1-Kr))/Kg + Pb*(-2*Kb*(1-Kb))/Kg
properties.setProperty(prefix+"balanceBlue_"+i,this.balanceBlue[i]+"");
}
}
public void getProperties(String prefix,Properties properties){
public boolean getProperties(String prefix,Properties properties){
if (properties.getProperty(prefix+"channels")!=null) {
int numChannels=Integer.parseInt(properties.getProperty(prefix+"channels"));
this.gain= new double[numChannels];
......@@ -559,7 +560,9 @@ G= Y +Pr*(- 2*Kr*(1-Kr))/Kg + Pb*(-2*Kb*(1-Kb))/Kg
this.balanceRed[i]= Double.parseDouble(properties.getProperty(prefix+"balanceRed_"+i));
this.balanceBlue[i]=Double.parseDouble(properties.getProperty(prefix+"balanceBlue_"+i));
}
return true;
}
return false;
}
public void modifyNumChannels(int numChannels){
......@@ -599,6 +602,43 @@ G= Y +Pr*(- 2*Kr*(1-Kr))/Kg + Pb*(-2*Kb*(1-Kb))/Kg
return true;
}
public boolean showDialog(ColorGainsParameters aux) {
GenericJTabbedDialog gd = new GenericJTabbedDialog("Individual channels colors/gains", 600,1000);
if (aux != null) gd.addTab("Main camera");
for (int i =0; i<this.gain.length;i++){
gd.addMessage(String.format("=== CHANNEL %02d ===",i));
gd.addNumericField(String.format("%02d: Gain (brightness)",i), this.gain[i], 3);
gd.addNumericField(String.format("%02d: Balance Red/Green",i), this.balanceRed[i], 3);
gd.addNumericField(String.format("%02d: Balance Blue/Green",i), this.balanceBlue[i], 3);
}
if (aux != null) {
gd.addTab("Auxiliary camera");
for (int i =0; i<this.gain.length;i++){
gd.addMessage(String.format("=== CHANNEL %02d ===",i));
gd.addNumericField(String.format("%02d: Gain (brightness)",i), aux.gain[i], 3);
gd.addNumericField(String.format("%02d: Balance Red/Green",i), aux.balanceRed[i], 3);
gd.addNumericField(String.format("%02d: Balance Blue/Green",i), aux.balanceBlue[i], 3);
}
}
gd.showDialog();
if (gd.wasCanceled()) return false;
for (int i =0; i<this.gain.length;i++){
this.gain[i]= gd.getNextNumber();
this.balanceRed[i]= gd.getNextNumber();
this.balanceBlue[i]=gd.getNextNumber();
}
if (aux != null) {
for (int i =0; i<this.gain.length;i++){
aux.gain[i]= gd.getNextNumber();
aux.balanceRed[i]= gd.getNextNumber();
aux.balanceBlue[i]=gd.getNextNumber();
}
}
return true;
}
}
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -154,6 +154,9 @@ public class PixelMapping {
// as stored in "subcamera" field of the calibration file and "sensor_port". sensor_port may start from non-0, so we need to count all combinations
//removeUnusedSensorData xshould be off!
public int [] channelsForSubCamera(int subCamera){
if (subCamera < 0) {
return null;
}
System.out.println("channelsForSubCamera("+subCamera+"),this.sensors.length="+this.sensors.length);
// ArrayList<ArrayList<ArrayList<Integer>>> camera_IPs = new ArrayList<ArrayList<ArrayList<Integer>>>();
ArrayList<Point> cam_port = new ArrayList<Point>();
......@@ -172,11 +175,11 @@ public class PixelMapping {
}
});
// debugging:
System.out.println("----- This filename subcamera "+subCamera+": physical camera "+cam_port_arr[subCamera].x+", sensor_port "+cam_port_arr[subCamera].y);
if (subCamera >= cam_port_arr.length) {
System.out.println("Error: Subcamera "+subCamera+" > that total namera of sensor ports in the system = "+cam_port_arr.length);
System.out.println("Error: Subcamera "+subCamera+" > that total number of sensor ports in the system = "+cam_port_arr.length);
return null;
}
System.out.println("----- This filename subcamera "+subCamera+": physical camera "+cam_port_arr[subCamera].x+", sensor_port "+cam_port_arr[subCamera].y);
if (this.sensors == null) return null;
int numChannels=0;
for (int i=0;i<this.sensors.length;i++) if (this.sensors[i]!=null) {
......
This diff is collapsed.
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