@@ -76,6 +77,7 @@ public class CalibrationHardwareInterface {
...
@@ -76,6 +77,7 @@ public class CalibrationHardwareInterface {
// JP46_Reader_camera JP4_INSTANCE= new JP46_Reader_camera(false);
// JP46_Reader_camera JP4_INSTANCE= new JP46_Reader_camera(false);
publicLaserPointerslaserPointers=null;
publicLaserPointerslaserPointers=null;
privateintmasterSubCamera=0;// "master" camera index of IP in the list
privateintmasterSubCamera=0;// "master" camera index of IP in the list
privateintmasterPort=0;// "master" camera port (0..3) to apply trigger to
privateJP46_Reader_camera[]jp4_Instances=null;
privateJP46_Reader_camera[]jp4_Instances=null;
privateString[]resetURLs=null;
privateString[]resetURLs=null;
privateString[]imageURLs=null;
privateString[]imageURLs=null;
...
@@ -87,7 +89,8 @@ public class CalibrationHardwareInterface {
...
@@ -87,7 +89,8 @@ public class CalibrationHardwareInterface {
// TODO: when saving/restoring save cameraSubnet, iBaseIP, cameraIPs, so any IPs are OK through config, generate - sequential
// TODO: when saving/restoring save cameraSubnet, iBaseIP, cameraIPs, so any IPs are OK through config, generate - sequential
privateStringcameraSubnet="192.168.0.";
privateStringcameraSubnet="192.168.0.";
privateintiBaseIP=236;
privateintiBaseIP=236;
privateString[]cameraIPs=null;
privateString[]cameraIPs=null;// since nc393 port is a part of cameraIPs[]
privateint[]channelIPPort=null;// index in camareIPs (each IP/port combination) for each individual sensor
privateintimgsrvPort=8081;
privateintimgsrvPort=8081;
privateStringresetURLcmd="towp/save/pointers";// advance buffer, next time will wait for the next frame acquired
privateStringresetURLcmd="towp/save/pointers";// advance buffer, next time will wait for the next frame acquired
// will return XML, just "trig" - 1x1 GIF
// will return XML, just "trig" - 1x1 GIF
...
@@ -99,6 +102,7 @@ public class CalibrationHardwareInterface {
...
@@ -99,6 +102,7 @@ public class CalibrationHardwareInterface {
privatedoublelastTemperature=Double.NaN;
privatedoublelastTemperature=Double.NaN;
privateintcolorMode=5;// JP4
privateintcolorMode=5;// JP4
privatebooleannoWait=true;// when false, IRQ_SMART=3 and the frame is available only 1 frame later, when true IRQ_SMART=6, frame is available after compression end
privatebooleannoWait=true;// when false, IRQ_SMART=3 and the frame is available only 1 frame later, when true IRQ_SMART=6, frame is available after compression end
privatebooleannc393=false;
privateintdebugSensorNumber=-1;// increase debug level for this particular sensor
privateintdebugSensorNumber=-1;// increase debug level for this particular sensor
privateintJPEGquality=99;// JPEG quality
privateintJPEGquality=99;// JPEG quality
privatebooleancameraAutoExposure=false;
privatebooleancameraAutoExposure=false;
...
@@ -115,7 +119,7 @@ public class CalibrationHardwareInterface {
...
@@ -115,7 +119,7 @@ public class CalibrationHardwareInterface {
@@ -610,7 +721,12 @@ public class CalibrationHardwareInterface {
...
@@ -610,7 +721,12 @@ public class CalibrationHardwareInterface {
printTiming("=== setupCameraAcquisition()");
printTiming("=== setupCameraAcquisition()");
}
}
if(!this.sensorPresent[chn][0]&&!this.sensorPresent[chn][1]&&!this.sensorPresent[chn][2])EEPROM_chn=0;// no 10359 - null pointer while "lens center" if first
if(!this.sensorPresent[chn][0]&&!this.sensorPresent[chn][1]&&!this.sensorPresent[chn][2])EEPROM_chn=0;// no 10359 - null pointer while "lens center" if first
// for (int sensorNum=0;sensorNum<lasers.length;sensorNum++) if (lasers[sensorNum] && (this.images[sensorNum]!=null)){ // lasers - here sensors to use lasers for
// for (int sensorNum=0;sensorNum<lasers.length;sensorNum++) if (lasers[sensorNum] && (this.images[sensorNum]!=null)){ // lasers - here sensors to use lasers for
intiIP=channelMap[sensorNum][0];
// int iIP=channelMap[sensorNum][0];
intiIP=channelIPPort[sensorNum];// index in composite images (per ip/port)
tile[chn],// will be filled, should have correct size before call
tile[chn],// will be filled, should have correct size before call
...
@@ -149,8 +175,8 @@ public class DebayerScissors {
...
@@ -149,8 +175,8 @@ public class DebayerScissors {
debayerParameters.debayerThreshold,// no high frequencies - use default uniform filter
debayerParameters.debayerThreshold,// no high frequencies - use default uniform filter
debayerParameters.debayerGamma,// power function applied to the amplitudes before generating spectral masks
debayerParameters.debayerGamma,// power function applied to the amplitudes before generating spectral masks
debayerParameters.debayerBonus,// scale far pixels as (1.0+bonus*r/rmax)
debayerParameters.debayerBonus,// scale far pixels as (1.0+bonus*r/rmax)
debayerParameters.mainToAlias,// relative main/alias amplitudes to enable lixels (i.e. 0.5 means that if alias is >0.5*main, the pixel will be masked out)
debayerParameters.mainToAlias,// relative main/alias amplitudes to enable pixels (i.e. 0.5 means that if alias is >0.5*main, the pixel will be masked out)
debayerParameters.debayerMaskBlur,// for both masks sigma for gaussian blur of the binary masks (<0 -do not use "scissors")
debayerParameters.debayerMaskBlur,// for both masks sigma for Gaussian blur of the binary masks (<0 -do not use "scissors")
debayerParameters.debayerUseScissors,// use "scissors", if false - just apply "diamond" ands "square" with DEBAYER_PARAMETERS.debayerRelativeWidthGreen and DEBAYER_PARAMETERS.debayerRelativeWidthRedblue
debayerParameters.debayerUseScissors,// use "scissors", if false - just apply "diamond" ands "square" with DEBAYER_PARAMETERS.debayerRelativeWidthGreen and DEBAYER_PARAMETERS.debayerRelativeWidthRedblue
@@ -166,11 +192,13 @@ public class DebayerScissors {
...
@@ -166,11 +192,13 @@ public class DebayerScissors {
fht_instance.inverseTransform(tile[chn]);
fht_instance.inverseTransform(tile[chn]);
fht_instance.swapQuadrants(tile[chn]);
fht_instance.swapQuadrants(tile[chn]);
/* accumulate result */
/* accumulate result */
/*This is synchronized method. It is possible to make threads to write to non-overlapping regions of the outPixles, but as the accumulation
/*This is (now was) a synchronized method. It is possible to make threads to write to non-overlapping regions of the outPixles, but as the accumulation
* takes just small fraction of severtal FHTs, it should be OK - reasonable number of threads will spread and not "stay in line"
* takes just small fraction of several FHTs, it should be OK - reasonable number of threads will spread and not "stay in line"
*/
*/
accumulateSquareTile(outPixles[chn],// float pixels array to accumulate tile
//accumulateSquareTile(
nonSyncAccumulateSquareTile(
outPixles[chn],// float pixels array to accumulate tile
tile[chn],// data to accumulate to the pixels array
tile[chn],// data to accumulate to the pixels array
imgWidth,// width of pixels array
imgWidth,// width of pixels array
tileX*step,// left corner X
tileX*step,// left corner X
...
@@ -178,22 +206,34 @@ public class DebayerScissors {
...
@@ -178,22 +206,34 @@ public class DebayerScissors {
finalinttilesY=imgHeight/step-1;// vertical number of overlapping tiles in the source image (should be expanded from the registerd one by "step" in each direction)
finalinttilesY=imgHeight/step-1;// vertical number of overlapping tiles in the source image (should be expanded from the registerd one by "step" in each direction)
finalintkernelWidth=kernelStack.getWidth();
finalintkernelWidth=kernelStack.getWidth();
finalintkernelNumHor=kernelWidth/(size/2);
finalintkernelNumHor=kernelWidth/(size/2);
finalintnChn=imageStack.getSize();
finalintnChn=imageStack.getSize();
finalfloat[][]outPixels=newfloat[nChn][length];// GLOBAL same as input
finalfloat[][]outPixels=newfloat[nChn][length];// GLOBAL same as input
// float [][] outPixels=new float[nChn][length]; // same as input
// float [][] outPixels=new float[nChn][length]; // same as input
// System.out.println("----- physical camera #"+cam_port_arr[i].x+", sensor_port="+cam_port_arr[i].y);
// }
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);
mainToAlias,// relative main/alias amplitudes to enable lixels (i.e. 0.5 means that if alias is >0.5*main, the pixel will be masked out)
mainToAlias,// relative main/alias amplitudes to enable pixels (i.e. 0.5 means that if alias is >0.5*main, the pixel will be masked out)
debayer_bonus,// scale far pixels as (1.0+bonus*r/rmax)
debayer_bonus,// scale far pixels as (1.0+bonus*r/rmax)
this_debug);// relative main/alias amplitudes to enable lixels (i.e. 0.5 means that if alias is >0.5*main, the pixel will be masked out)
this_debug);// relative main/alias amplitudes to enable pixels (i.e. 0.5 means that if alias is >0.5*main, the pixel will be masked out)
/* add double mainToAlias){// relative main/alias amplitudes to enable pixels (i.e. 0.5 means that if alias is >0.5*main, the pixel will be masked out) */
/* add double mainToAlias){// relative main/alias amplitudes to enable pixels (i.e. 0.5 means that if alias is >0.5*main, the pixel will be masked out) */
privateint[][]polar2CartesianIndices;// for each polar angle/radius (angle*iRadiusPlus1+radius) - 4 interpolation corners (0:0, dx:0, 0:dy, dx:dy), the first (0:0) being the closest to the polar point
privateint[][]polar2CartesianIndices;// for each polar angle/radius (angle*iRadiusPlus1+radius) - 4 interpolation corners (0:0, dx:0, 0:dy, dx:dy), the first (0:0) being the closest to the polar point
privatedouble[][]polar2CartesianFractions;// a pair of dx, dy for interpolations (used with ) polar2CartesianIndices[][]]
privatedouble[][]polar2CartesianFractions;// a pair of dx, dy for interpolations (used with ) polar2CartesianIndices[][]]
privateint[][]cartesian2PolarIndices;// each per-pixel array is a list of indices in polar array pointing to this cell (may be empty)
privateint[][]cartesian2PolarIndices;// each per-pixel array is a list of indices in polar array pointing to this cell (may be empty)
publicdouble[]genPolarRedBlueMask(double[]polarAmps,// polar array of amplitude values, <0 - stop
publicdouble[]genPolarRedBlueMask(
intmode){// result mode - 0: output mask as 0/1, 1 -output proportional, positive - pass, negative - rejected
double[]polarAmps,// polar array of amplitude values, <0 - stop
returngenPolarMask(polarAmps,1,mode);
intmode)
{// result mode - 0: output mask as 0/1, 1 -output proportional, positive - pass, negative - rejected
returngenPolarMask(polarAmps,1,mode);
}
}
// **** Seems to be most time-critical ****
publicdouble[]genPolarMask(double[]polarAmps,// polar array of amplitude values, <0 - stop
publicdouble[]genPolarMask(double[]polarAmps,// polar array of amplitude values, <0 - stop
inttype,// 0 - green, 1 red/blue
inttype,// 0 - green, 1 red/blue
intmode){// result mode - 0: output mask as 0/1, 1 -output proportional, positive - pass, negative - rejected
intmode){// result mode - 0: output mask as 0/1, 1 -output proportional, positive - pass, negative - rejected
...
@@ -529,11 +611,14 @@ import java.util.HashSet;
...
@@ -529,11 +611,14 @@ import java.util.HashSet;
step++;
step++;
/* add polar point index */
/* add polar point index */
newVal=good?step:-step;
newVal=good?step:-step;
// index=iMax*iRadiusPlus1+rayLength[iMax]; // rayLength[iMax] should point to a new cell (with intMap[]==0) may ommit - set in the end of the loop and before the loop?