Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
imagej-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
imagej-elphel
Commits
5bdb59ce
Commit
5bdb59ce
authored
Aug 27, 2021
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed old bug in 4 images (October, 6, 2020), propagating non-quad
configurations
parent
4e1e17b4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
182 additions
and
103 deletions
+182
-103
Eyesis_Correction.java
.../java/com/elphel/imagej/correction/Eyesis_Correction.java
+66
-1
CorrVector.java
...main/java/com/elphel/imagej/tileprocessor/CorrVector.java
+4
-4
ImageDttCPU.java
...ain/java/com/elphel/imagej/tileprocessor/ImageDttCPU.java
+107
-94
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+5
-4
No files found.
src/main/java/com/elphel/imagej/correction/Eyesis_Correction.java
View file @
5bdb59ce
...
@@ -63,8 +63,10 @@ import java.util.Arrays;
...
@@ -63,8 +63,10 @@ import java.util.Arrays;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.Comparator
;
import
java.util.EnumSet
;
import
java.util.EnumSet
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Properties
;
import
java.util.Properties
;
import
java.util.Set
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
javax.swing.JFileChooser
;
import
javax.swing.JFileChooser
;
...
@@ -775,6 +777,7 @@ private Panel panel1,
...
@@ -775,6 +777,7 @@ private Panel panel1,
addButton
(
"Reset Geometry"
,
panelLWIR16
,
color_stop
);
addButton
(
"Reset Geometry"
,
panelLWIR16
,
color_stop
);
addButton
(
"Reset AUX Geometry"
,
panelLWIR16
,
color_stop
);
addButton
(
"Reset AUX Geometry"
,
panelLWIR16
,
color_stop
);
addButton
(
"Generate Sym Vectors"
,
panelLWIR16
,
color_configure
);
addButton
(
"Generate Sym Vectors"
,
panelLWIR16
,
color_configure
);
addButton
(
"Image Properties"
,
panelLWIR16
,
color_conf_process
);
plugInFrame
.
add
(
panelLWIR16
);
plugInFrame
.
add
(
panelLWIR16
);
}
}
...
@@ -4338,7 +4341,7 @@ private Panel panel1,
...
@@ -4338,7 +4341,7 @@ private Panel panel1,
///========================================
///========================================
QUAD_CLT
.
processCLTQuads
(
QUAD_CLT
.
processCLTQuads
(
// uses quad
CLT_PARAMETERS
,
// EyesisCorrectionParameters.DCTParameters dct_parameters,
CLT_PARAMETERS
,
// EyesisCorrectionParameters.DCTParameters dct_parameters,
DEBAYER_PARAMETERS
,
//EyesisCorrectionParameters.DebayerParameters debayerParameters,
DEBAYER_PARAMETERS
,
//EyesisCorrectionParameters.DebayerParameters debayerParameters,
COLOR_PROC_PARAMETERS
,
//EyesisCorrectionParameters.ColorProcParameters colorProcParameters,
COLOR_PROC_PARAMETERS
,
//EyesisCorrectionParameters.ColorProcParameters colorProcParameters,
...
@@ -5355,6 +5358,68 @@ private Panel panel1,
...
@@ -5355,6 +5358,68 @@ private Panel panel1,
full_type1
,
// boolean full_type1, // false - all R or all T, true - mixed
full_type1
,
// boolean full_type1, // false - all R or all T, true - mixed
full_type2
,
// boolean full_type2) {// false - quarter 3 is negated quarter 1, true - independent
full_type2
,
// boolean full_type2) {// false - quarter 3 is negated quarter 1, true - independent
DEBUG_LEVEL
);
DEBUG_LEVEL
);
}
else
if
(
label
.
equals
(
"Image Properties"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
ImagePlus
imp_sel
=
WindowManager
.
getCurrentImage
();
if
(
imp_sel
==
null
){
IJ
.
showMessage
(
"Error"
,
"There are no images open\nProcess canceled"
);
return
;
}
(
new
JP46_Reader_camera
(
false
)).
decodeProperiesFromInfo
(
imp_sel
);
ArrayList
<
String
>
prop_kv
=
new
ArrayList
<
String
>();
Set
<
Object
>
jp4_set
;
Properties
jp4_prop
;
Iterator
<
Object
>
itr
;
String
str
;
jp4_prop
=
imp_sel
.
getProperties
();
if
(
jp4_prop
!=
null
)
{
jp4_set
=
jp4_prop
.
keySet
();
itr
=
jp4_set
.
iterator
();
while
(
itr
.
hasNext
())
{
str
=
(
String
)
itr
.
next
();
// if (!str.equals("Info")) info+="<"+str+">\""+jp4_prop.getProperty(str)+"\"</"+str+">";
if
(!
str
.
equals
(
"Info"
))
{
prop_kv
.
add
(
str
+
"|"
+
jp4_prop
.
getProperty
(
str
));
}
}
}
Collections
.
sort
(
prop_kv
);
prop_kv
.
add
(
"|"
);
// empty item to add new property
GenericDialog
gd
=
new
GenericDialog
(
"Edit properties"
);
gd
.
addMessage
(
"Use empty string to remove property, quoted empty - to set zero length, "
+
"name|value for value to set a new property"
);
String
[]
names
=
new
String
[
prop_kv
.
size
()];
for
(
int
ii
=
0
;
ii
<
prop_kv
.
size
();
ii
++)
{
String
s
=
(
String
)
prop_kv
.
get
(
ii
);
int
sep
=
s
.
indexOf
(
"|"
);
if
(
sep
<
0
)
{
sep
=
s
.
length
();
}
String
name
=
s
.
substring
(
0
,
sep
);
names
[
ii
]
=
name
;
String
val
=
(
sep
==
s
.
length
())
?
""
:
s
.
substring
(
sep
+
1
);
gd
.
addStringField
(
ii
+
": "
+
name
,
val
,
20
);
}
WindowTools
.
addScrollBars
(
gd
);
gd
.
showDialog
();
if
(
gd
.
wasCanceled
())
return
;
for
(
int
ii
=
0
;
ii
<
prop_kv
.
size
();
ii
++)
{
String
name
=
names
[
ii
];
String
val
=
gd
.
getNextString
();
int
sep
=
val
.
indexOf
(
"|"
);
if
(
sep
>
0
)
{
// ignore existing key, set a key/value pair
name
=
val
.
substring
(
0
,
sep
);
val
=
val
.
substring
(
sep
+
1
);
}
else
if
(
val
.
length
()
==
0
)
{
val
=
null
;
}
else
{
val
=
val
.
replaceAll
(
"^\"+|\"+$"
,
""
);
// remove leading/trailing "
}
if
(
name
.
length
()
>
0
)
{
imp_sel
.
setProperty
(
name
,
val
);
}
}
(
new
JP46_Reader_camera
(
false
)).
encodeProperiesToInfo
(
imp_sel
);
//JTabbedTest
//JTabbedTest
// End of buttons code
// End of buttons code
}
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/CorrVector.java
View file @
5bdb59ce
...
@@ -139,7 +139,7 @@ public class CorrVector{ // TODO: Update to non-quad (extract to a file first)?
...
@@ -139,7 +139,7 @@ public class CorrVector{ // TODO: Update to non-quad (extract to a file first)?
return
derivs
;
return
derivs
;
}
}
public
Matrix
[]
getRotMatricesDbg
()
{
public
Matrix
[]
getRotMatricesDbg
()
{
Matrix
[]
rots
=
new
Matrix
[
4
];
Matrix
[]
rots
=
new
Matrix
[
getNumSensors
()
];
double
[]
azimuths
=
getAzimuths
();
double
[]
azimuths
=
getAzimuths
();
double
[]
tilts
=
getTilts
();
double
[]
tilts
=
getTilts
();
double
[]
rolls
=
getFullRolls
();
double
[]
rolls
=
getFullRolls
();
...
@@ -183,7 +183,7 @@ public class CorrVector{ // TODO: Update to non-quad (extract to a file first)?
...
@@ -183,7 +183,7 @@ public class CorrVector{ // TODO: Update to non-quad (extract to a file first)?
public
Matrix
[][]
getRotDeriveMatricesDbg
()
// USED in lwir
public
Matrix
[][]
getRotDeriveMatricesDbg
()
// USED in lwir
{
{
Matrix
[][]
rot_derivs
=
new
Matrix
[
4
][
4
];
// channel, azimuth-tilt-roll-zoom
Matrix
[][]
rot_derivs
=
new
Matrix
[
getNumSensors
()
][
4
];
// channel, azimuth-tilt-roll-zoom
double
[]
azimuths
=
getAzimuths
();
double
[]
azimuths
=
getAzimuths
();
double
[]
tilts
=
getTilts
();
double
[]
tilts
=
getTilts
();
double
[]
rolls
=
getFullRolls
();
double
[]
rolls
=
getFullRolls
();
...
@@ -283,7 +283,7 @@ public class CorrVector{ // TODO: Update to non-quad (extract to a file first)?
...
@@ -283,7 +283,7 @@ public class CorrVector{ // TODO: Update to non-quad (extract to a file first)?
public
Matrix
[]
getRotMatrices
()
// USED in lwir TODO: Update to non-quad!
public
Matrix
[]
getRotMatrices
()
// USED in lwir TODO: Update to non-quad!
{
{
Matrix
[]
rots
=
new
Matrix
[
4
];
Matrix
[]
rots
=
new
Matrix
[
getNumSensors
()
];
double
[]
azimuths
=
getAzimuths
();
double
[]
azimuths
=
getAzimuths
();
double
[]
tilts
=
getTilts
();
double
[]
tilts
=
getTilts
();
double
[]
rolls
=
getFullRolls
();
double
[]
rolls
=
getFullRolls
();
...
@@ -323,7 +323,7 @@ public class CorrVector{ // TODO: Update to non-quad (extract to a file first)?
...
@@ -323,7 +323,7 @@ public class CorrVector{ // TODO: Update to non-quad (extract to a file first)?
//TODO: UPDATE to include scales
//TODO: UPDATE to include scales
public
Matrix
[][]
getRotDeriveMatrices
()
// USED in lwir
public
Matrix
[][]
getRotDeriveMatrices
()
// USED in lwir
{
{
Matrix
[][]
rot_derivs
=
new
Matrix
[
4
][
4
];
// channel, azimuth-tilt-roll-zoom
Matrix
[][]
rot_derivs
=
new
Matrix
[
getNumSensors
()
][
4
];
// channel, azimuth-tilt-roll-zoom
double
[]
azimuths
=
getAzimuths
();
double
[]
azimuths
=
getAzimuths
();
double
[]
tilts
=
getTilts
();
double
[]
tilts
=
getTilts
();
double
[]
rolls
=
getFullRolls
();
double
[]
rolls
=
getFullRolls
();
...
...
src/main/java/com/elphel/imagej/tileprocessor/ImageDttCPU.java
View file @
5bdb59ce
...
@@ -993,7 +993,7 @@ public class ImageDttCPU {
...
@@ -993,7 +993,7 @@ public class ImageDttCPU {
return
clt_data
;
return
clt_data
;
}
}
@Deprecated
public
double
[][][][][][]
clt_aberrations_quad
(
// not used in lwir
public
double
[][][][][][]
clt_aberrations_quad
(
// not used in lwir
final
double
disparity
,
final
double
disparity
,
final
double
[][][]
image_data
,
// first index - number of image in a quad
final
double
[][][]
image_data
,
// first index - number of image in a quad
...
@@ -1533,7 +1533,7 @@ public class ImageDttCPU {
...
@@ -1533,7 +1533,7 @@ public class ImageDttCPU {
}
}
// removing macro and FPGA modes
// removing macro and FPGA modes
public
double
[][]
cltMeasureLazyEye
(
// returns d,s lazy eye parameters
public
double
[][]
cltMeasureLazyEye
(
// returns d,s lazy eye parameters
final
ImageDttParameters
imgdtt_params
,
// Now just extra correlation parameters, later will include, most others
final
ImageDttParameters
imgdtt_params
,
// Now just extra correlation parameters, later will include, most others
final
int
[][]
tile_op
,
// [tilesY][tilesX] - what to do - 0 - nothing for this tile
final
int
[][]
tile_op
,
// [tilesY][tilesX] - what to do - 0 - nothing for this tile
final
double
[][]
disparity_array
,
// [tilesY][tilesX] - individual per-tile expected disparity
final
double
[][]
disparity_array
,
// [tilesY][tilesX] - individual per-tile expected disparity
...
@@ -1576,7 +1576,8 @@ public class ImageDttCPU {
...
@@ -1576,7 +1576,8 @@ public class ImageDttCPU {
debug_offsets
[
i
][
j
]
=
imgdtt_params
.
lma_dbg_offset
[
i
][
j
]*
imgdtt_params
.
lma_dbg_scale
;
debug_offsets
[
i
][
j
]
=
imgdtt_params
.
lma_dbg_offset
[
i
][
j
]*
imgdtt_params
.
lma_dbg_scale
;
}
}
final
int
quad
=
4
;
// number of subcameras
// final int quad = 4; // number of subcameras
final
int
nSens
=
geometryCorrection
.
getNumSensors
();
final
int
numcol
=
3
;
// number of colors // keep the same, just do not use [0] and [1], [2] - green
final
int
numcol
=
3
;
// number of colors // keep the same, just do not use [0] and [1], [2] - green
// final int numColors = image_data[0].length;
// final int numColors = image_data[0].length;
...
@@ -1596,11 +1597,11 @@ public class ImageDttCPU {
...
@@ -1596,11 +1597,11 @@ public class ImageDttCPU {
final
int
debug_clustY
=
debug_tileY
/
tileStep
;
final
int
debug_clustY
=
debug_tileY
/
tileStep
;
///tileStep
///tileStep
final
double
[][][][][][]
clt_data
=
new
double
[
quad
][
numcol
][
tilesY
][
tilesX
][][];
final
double
[][][][][][]
clt_data
=
new
double
[
nSens
][
numcol
][
tilesY
][
tilesX
][][];
final
Thread
[]
threads
=
newThreadArray
(
threadsMax
);
final
Thread
[]
threads
=
newThreadArray
(
threadsMax
);
final
AtomicInteger
ai
=
new
AtomicInteger
(
0
);
final
AtomicInteger
ai
=
new
AtomicInteger
(
0
);
final
double
[]
col_weights
=
new
double
[
numcol
];
// colors are RBG
final
double
[]
col_weights
=
new
double
[
numcol
];
// colors are RBG
final
double
[][]
dbg_distort
=
debug_distort
?
(
new
double
[
4
*
quad
][
tilesX
*
tilesY
])
:
null
;
final
double
[][]
dbg_distort
=
debug_distort
?
(
new
double
[
4
*
nSens
][
tilesX
*
tilesY
])
:
null
;
final
double
[][]
corr_wnd
=
Corr2dLMA
.
getCorrWnd
(
final
double
[][]
corr_wnd
=
Corr2dLMA
.
getCorrWnd
(
transform_size
,
transform_size
,
...
@@ -1736,7 +1737,7 @@ public class ImageDttCPU {
...
@@ -1736,7 +1737,7 @@ public class ImageDttCPU {
// showDoubleFloatArrays sdfa_instance = new showDoubleFloatArrays(); // just for debugging?
// showDoubleFloatArrays sdfa_instance = new showDoubleFloatArrays(); // just for debugging?
double
centerX
;
// center of aberration-corrected (common model) tile, X
double
centerX
;
// center of aberration-corrected (common model) tile, X
double
centerY
;
//
double
centerY
;
//
double
[][]
fract_shiftsXY
=
new
double
[
quad
][];
double
[][]
fract_shiftsXY
=
new
double
[
nSens
][];
Correlation2d
corr2d
=
new
Correlation2d
(
Correlation2d
corr2d
=
new
Correlation2d
(
imgdtt_params
,
// ImageDttParameters imgdtt_params,
imgdtt_params
,
// ImageDttParameters imgdtt_params,
transform_size
,
// int transform_size,
transform_size
,
// int transform_size,
...
@@ -1760,7 +1761,7 @@ public class ImageDttCPU {
...
@@ -1760,7 +1761,7 @@ public class ImageDttCPU {
clustY
=
nCluster
/
clustersX
;
clustY
=
nCluster
/
clustersX
;
clustX
=
nCluster
%
clustersX
;
clustX
=
nCluster
%
clustersX
;
double
[][][]
centersXY
=
new
double
[
clustSize
][][];
double
[][][]
centersXY
=
new
double
[
clustSize
][][];
double
[][][]
disp_dist
=
new
double
[
clustSize
][
quad
][];
// used to correct 3D correlations
double
[][][]
disp_dist
=
new
double
[
clustSize
][
nSens
][];
// used to correct 3D correlations
double
[][][]
corrs
=
new
double
[
clustSize
][][];
double
[][][]
corrs
=
new
double
[
clustSize
][][];
double
[][]
corr_stat
=
new
double
[
clustSize
][];
double
[][]
corr_stat
=
new
double
[
clustSize
][];
double
[]
strength
=
new
double
[
clustSize
];
double
[]
strength
=
new
double
[
clustSize
];
...
@@ -1832,7 +1833,7 @@ public class ImageDttCPU {
...
@@ -1832,7 +1833,7 @@ public class ImageDttCPU {
tIndex
=
tileY
*
tilesX
+
tileX
;
tIndex
=
tileY
*
tilesX
+
tileX
;
// int nTile = tileY * tilesX + tileX; // how is it different from tIndex?
// int nTile = tileY * tilesX + tileX; // how is it different from tIndex?
if
(
clt_mismatch
!=
null
)
{
if
(
clt_mismatch
!=
null
)
{
for
(
int
cam
=
0
;
cam
<
quad
;
cam
++)
{
for
(
int
cam
=
0
;
cam
<
nSens
;
cam
++)
{
clt_mismatch
[
3
*
cam
+
0
][
tIndex
]
=
Double
.
NaN
;
clt_mismatch
[
3
*
cam
+
0
][
tIndex
]
=
Double
.
NaN
;
clt_mismatch
[
3
*
cam
+
1
][
tIndex
]
=
Double
.
NaN
;
clt_mismatch
[
3
*
cam
+
1
][
tIndex
]
=
Double
.
NaN
;
}
}
...
@@ -1914,7 +1915,7 @@ public class ImageDttCPU {
...
@@ -1914,7 +1915,7 @@ public class ImageDttCPU {
pxpy
[
cTile
][
1
]
=
centerY
;
pxpy
[
cTile
][
1
]
=
centerY
;
if
(((
globalDebugLevel
>
0
)
||
debug_distort
)
||
(
debugTile
&&
(
globalDebugLevel
>
-
2
)))
{
if
(((
globalDebugLevel
>
0
)
||
debug_distort
)
||
(
debugTile
&&
(
globalDebugLevel
>
-
2
)))
{
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
System
.
out
.
println
(
"clt_aberrations_quad_corr(): tileX="
+
tileX
+
", tileY="
+
tileY
+
System
.
out
.
println
(
"clt_aberrations_quad_corr(): tileX="
+
tileX
+
", tileY="
+
tileY
+
" centerX="
+
centerX
+
" centerY="
+
centerY
+
" disparity="
+
disparity_array
[
tileY
][
tileX
]+
" centerX="
+
centerX
+
" centerY="
+
centerY
+
" disparity="
+
disparity_array
[
tileY
][
tileX
]+
" centersXY["
+
cTile
+
"]["
+
i
+
"][0]="
+
centersXY
[
cTile
][
i
][
0
]+
" centersXY["
+
cTile
+
"]["
+
i
+
"][1]="
+
centersXY
[
cTile
][
i
][
1
]);
" centersXY["
+
cTile
+
"]["
+
i
+
"][0]="
+
centersXY
[
cTile
][
i
][
0
]+
" centersXY["
+
cTile
+
"]["
+
i
+
"][1]="
+
centersXY
[
cTile
][
i
][
1
]);
...
@@ -1931,11 +1932,11 @@ public class ImageDttCPU {
...
@@ -1931,11 +1932,11 @@ public class ImageDttCPU {
centersXY
[
cTile
][
i
][
1
]
+=
debug_offsets_xy
[
i
][
1
];
centersXY
[
cTile
][
i
][
1
]
+=
debug_offsets_xy
[
i
][
1
];
}
}
if
((
debug_distort
&&
debugCluster
)
||
debugTile
)
{
if
((
debug_distort
&&
debugCluster
)
||
debugTile
)
{
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
System
.
out
.
println
(
String
.
format
(
"%d: {%8.3f, %8.3f}"
,
i
,
debug_offsets_xy
[
i
][
0
],
debug_offsets_xy
[
i
][
1
]));
System
.
out
.
println
(
String
.
format
(
"%d: {%8.3f, %8.3f}"
,
i
,
debug_offsets_xy
[
i
][
0
],
debug_offsets_xy
[
i
][
1
]));
}
}
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
System
.
out
.
println
(
"Corrected clt_aberrations_quad_corr(): tileX="
+
tileX
+
", tileY="
+
tileY
+
System
.
out
.
println
(
"Corrected clt_aberrations_quad_corr(): tileX="
+
tileX
+
", tileY="
+
tileY
+
" centerX="
+
centerX
+
" centerY="
+
centerY
+
" disparity="
+
disparity_array
[
tileY
][
tileX
]+
" centerX="
+
centerX
+
" centerY="
+
centerY
+
" disparity="
+
disparity_array
[
tileY
][
tileX
]+
" centersXY["
+
cTile
+
"]["
+
i
+
"][0]="
+
centersXY
[
cTile
][
i
][
0
]+
" centersXY["
+
cTile
+
"]["
+
i
+
"][1]="
+
centersXY
[
cTile
][
i
][
1
]);
" centersXY["
+
cTile
+
"]["
+
i
+
"][0]="
+
centersXY
[
cTile
][
i
][
0
]+
" centersXY["
+
cTile
+
"]["
+
i
+
"][1]="
+
centersXY
[
cTile
][
i
][
1
]);
...
@@ -1957,7 +1958,7 @@ public class ImageDttCPU {
...
@@ -1957,7 +1958,7 @@ public class ImageDttCPU {
}
}
// save disparity distortions for visualization:
// save disparity distortions for visualization:
if
(
dbg_distort
!=
null
)
{
if
(
dbg_distort
!=
null
)
{
for
(
int
cam
=
0
;
cam
<
quad
;
cam
++)
{
for
(
int
cam
=
0
;
cam
<
nSens
;
cam
++)
{
dbg_distort
[
cam
*
4
+
0
][
nTile
]
=
disp_dist
[
cTile
][
cam
][
0
];
dbg_distort
[
cam
*
4
+
0
][
nTile
]
=
disp_dist
[
cTile
][
cam
][
0
];
dbg_distort
[
cam
*
4
+
1
][
nTile
]
=
disp_dist
[
cTile
][
cam
][
1
];
dbg_distort
[
cam
*
4
+
1
][
nTile
]
=
disp_dist
[
cTile
][
cam
][
1
];
dbg_distort
[
cam
*
4
+
2
][
nTile
]
=
disp_dist
[
cTile
][
cam
][
2
];
dbg_distort
[
cam
*
4
+
2
][
nTile
]
=
disp_dist
[
cTile
][
cam
][
2
];
...
@@ -1977,7 +1978,7 @@ public class ImageDttCPU {
...
@@ -1977,7 +1978,7 @@ public class ImageDttCPU {
centersXY
[
cTile
][
3
][
0
]+
"\t"
+
centersXY
[
cTile
][
3
][
1
]+
"\t"
);
centersXY
[
cTile
][
3
][
0
]+
"\t"
+
centersXY
[
cTile
][
3
][
1
]+
"\t"
);
}
}
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
clt_data
[
i
][
ncol
][
tileY
][
tileX
]
=
new
double
[
4
][];
clt_data
[
i
][
ncol
][
tileY
][
tileX
]
=
new
double
[
4
][];
// Extract image tiles and kernels, correct aberrations, return (ut do not apply) fractional shifts
// Extract image tiles and kernels, correct aberrations, return (ut do not apply) fractional shifts
fract_shiftsXY
[
i
]
=
extract_correct_tile
(
// return a pair of residual offsets
fract_shiftsXY
[
i
]
=
extract_correct_tile
(
// return a pair of residual offsets
...
@@ -2010,14 +2011,14 @@ public class ImageDttCPU {
...
@@ -2010,14 +2011,14 @@ public class ImageDttCPU {
if
((
globalDebugLevel
>
0
)
&&
(
tileX
>=
debug_tileX
-
2
)
&&
(
tileX
<=
debug_tileX
+
2
)
&&
if
((
globalDebugLevel
>
0
)
&&
(
tileX
>=
debug_tileX
-
2
)
&&
(
tileX
<=
debug_tileX
+
2
)
&&
(
tileY
>=
debug_tileY
-
2
)
&&
(
tileY
<=
debug_tileY
+
2
))
{
(
tileY
>=
debug_tileY
-
2
)
&&
(
tileY
<=
debug_tileY
+
2
))
{
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
System
.
out
.
println
(
"clt_aberrations_quad(): color="
+
ncol
+
", tileX="
+
tileX
+
", tileY="
+
tileY
+
System
.
out
.
println
(
"clt_aberrations_quad(): color="
+
ncol
+
", tileX="
+
tileX
+
", tileY="
+
tileY
+
" fract_shiftsXY["
+
i
+
"][0]="
+
fract_shiftsXY
[
i
][
0
]+
" fract_shiftsXY["
+
i
+
"][1]="
+
fract_shiftsXY
[
i
][
1
]);
" fract_shiftsXY["
+
i
+
"][0]="
+
fract_shiftsXY
[
i
][
0
]+
" fract_shiftsXY["
+
i
+
"][1]="
+
fract_shiftsXY
[
i
][
1
]);
}
}
}
}
// apply residual shift
// apply residual shift
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
fract_shift
(
// fractional shift in transform domain. Currently uses sin/cos - change to tables with 2? rotations
fract_shift
(
// fractional shift in transform domain. Currently uses sin/cos - change to tables with 2? rotations
clt_data
[
i
][
ncol
][
tileY
][
tileX
],
// double [][] clt_tile,
clt_data
[
i
][
ncol
][
tileY
][
tileX
],
// double [][] clt_tile,
// transform_size,
// transform_size,
...
@@ -2038,7 +2039,7 @@ public class ImageDttCPU {
...
@@ -2038,7 +2039,7 @@ public class ImageDttCPU {
}
}
}
else
{
// if (!isMonochrome() || (chn == MONO_CHN) || macro_mode) { // in monochrome mode skip all non-mono (green) channels
}
else
{
// if (!isMonochrome() || (chn == MONO_CHN) || macro_mode) { // in monochrome mode skip all non-mono (green) channels
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
// used in lwir
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
// used in lwir
clt_data
[
i
][
ncol
]
=
null
;
// erase unused clt_data
clt_data
[
i
][
ncol
]
=
null
;
// erase unused clt_data
}
}
}
}
...
@@ -2251,7 +2252,7 @@ public class ImageDttCPU {
...
@@ -2251,7 +2252,7 @@ public class ImageDttCPU {
lazy_eye_data
[
nCluster
][
ExtrinsicAdjustment
.
INDX_DIFF
]
+=
lma_ds
[
cTile
][
0
]
*
w
;
lazy_eye_data
[
nCluster
][
ExtrinsicAdjustment
.
INDX_DIFF
]
+=
lma_ds
[
cTile
][
0
]
*
w
;
lazy_eye_data
[
nCluster
][
ExtrinsicAdjustment
.
INDX_PX
+
0
]
+=
pxpy
[
cTile
][
0
]
*
w
;
lazy_eye_data
[
nCluster
][
ExtrinsicAdjustment
.
INDX_PX
+
0
]
+=
pxpy
[
cTile
][
0
]
*
w
;
lazy_eye_data
[
nCluster
][
ExtrinsicAdjustment
.
INDX_PX
+
1
]
+=
pxpy
[
cTile
][
1
]
*
w
;
lazy_eye_data
[
nCluster
][
ExtrinsicAdjustment
.
INDX_PX
+
1
]
+=
pxpy
[
cTile
][
1
]
*
w
;
for
(
int
cam
=
0
;
cam
<
quad
;
cam
++)
{
for
(
int
cam
=
0
;
cam
<
nSens
;
cam
++)
{
lazy_eye_data
[
nCluster
][
ExtrinsicAdjustment
.
INDX_DYDDISP0
+
cam
]
+=
disp_dist
[
cTile
][
cam
][
2
]
*
w
;
lazy_eye_data
[
nCluster
][
ExtrinsicAdjustment
.
INDX_DYDDISP0
+
cam
]
+=
disp_dist
[
cTile
][
cam
][
2
]
*
w
;
lazy_eye_data
[
nCluster
][
ExtrinsicAdjustment
.
INDX_PYDIST
+
cam
]
+=
centersXY
[
cTile
][
cam
][
1
]
*
w
;
lazy_eye_data
[
nCluster
][
ExtrinsicAdjustment
.
INDX_PYDIST
+
cam
]
+=
centersXY
[
cTile
][
cam
][
1
]
*
w
;
}
}
...
@@ -2268,7 +2269,7 @@ public class ImageDttCPU {
...
@@ -2268,7 +2269,7 @@ public class ImageDttCPU {
lazy_eye_data
[
nCluster
][
ExtrinsicAdjustment
.
INDX_DIFF
]
/=
sum_w
;
lazy_eye_data
[
nCluster
][
ExtrinsicAdjustment
.
INDX_DIFF
]
/=
sum_w
;
lazy_eye_data
[
nCluster
][
ExtrinsicAdjustment
.
INDX_PX
+
0
]
/=
sum_w
;
lazy_eye_data
[
nCluster
][
ExtrinsicAdjustment
.
INDX_PX
+
0
]
/=
sum_w
;
lazy_eye_data
[
nCluster
][
ExtrinsicAdjustment
.
INDX_PX
+
1
]
/=
sum_w
;
lazy_eye_data
[
nCluster
][
ExtrinsicAdjustment
.
INDX_PX
+
1
]
/=
sum_w
;
for
(
int
cam
=
0
;
cam
<
quad
;
cam
++)
{
for
(
int
cam
=
0
;
cam
<
nSens
;
cam
++)
{
lazy_eye_data
[
nCluster
][
ExtrinsicAdjustment
.
INDX_DYDDISP0
+
cam
]
/=
sum_w
;
lazy_eye_data
[
nCluster
][
ExtrinsicAdjustment
.
INDX_DYDDISP0
+
cam
]
/=
sum_w
;
lazy_eye_data
[
nCluster
][
ExtrinsicAdjustment
.
INDX_PYDIST
+
cam
]
/=
sum_w
;
lazy_eye_data
[
nCluster
][
ExtrinsicAdjustment
.
INDX_PYDIST
+
cam
]
/=
sum_w
;
}
}
...
@@ -2465,7 +2466,8 @@ public class ImageDttCPU {
...
@@ -2465,7 +2466,8 @@ public class ImageDttCPU {
(
new
double
[]
{
imgdtt_params
.
pcorr_dbg_offsx
,
imgdtt_params
.
pcorr_dbg_offsy
}):
null
;
(
new
double
[]
{
imgdtt_params
.
pcorr_dbg_offsx
,
imgdtt_params
.
pcorr_dbg_offsy
}):
null
;
final
boolean
macro_mode
=
macro_scale
!=
1
;
// correlate tile data instead of the pixel data
final
boolean
macro_mode
=
macro_scale
!=
1
;
// correlate tile data instead of the pixel data
final
int
quad
=
4
;
// number of subcameras
// final int quad = 4; // number of subcameras
final
int
nSens
=
geometryCorrection
.
getNumSensors
();
final
int
numcol
=
3
;
// number of colors // keep the same, just do not use [0] and [1], [2] - green
final
int
numcol
=
3
;
// number of colors // keep the same, just do not use [0] and [1], [2] - green
// final int numColors = image_data[0].length;
// final int numColors = image_data[0].length;
...
@@ -2473,11 +2475,11 @@ public class ImageDttCPU {
...
@@ -2473,11 +2475,11 @@ public class ImageDttCPU {
final
int
tilesX
=
width
/
transform_size
;
final
int
tilesX
=
width
/
transform_size
;
final
int
tilesY
=
height
/
transform_size
;
final
int
tilesY
=
height
/
transform_size
;
final
int
nTilesInChn
=
tilesX
*
tilesY
;
final
int
nTilesInChn
=
tilesX
*
tilesY
;
final
double
[][][][][][]
clt_data
=
new
double
[
quad
][
numcol
][
tilesY
][
tilesX
][][];
final
double
[][][][][][]
clt_data
=
new
double
[
nSens
][
numcol
][
tilesY
][
tilesX
][][];
final
Thread
[]
threads
=
newThreadArray
(
threadsMax
);
final
Thread
[]
threads
=
newThreadArray
(
threadsMax
);
final
AtomicInteger
ai
=
new
AtomicInteger
(
0
);
final
AtomicInteger
ai
=
new
AtomicInteger
(
0
);
final
double
[]
col_weights
=
new
double
[
numcol
];
// colors are RBG
final
double
[]
col_weights
=
new
double
[
numcol
];
// colors are RBG
final
double
[][]
dbg_distort
=
debug_distort
?
(
new
double
[
4
*
quad
][
tilesX
*
tilesY
])
:
null
;
final
double
[][]
dbg_distort
=
debug_distort
?
(
new
double
[
4
*
nSens
][
tilesX
*
tilesY
])
:
null
;
final
double
[][]
corr_wnd
=
Corr2dLMA
.
getCorrWnd
(
final
double
[][]
corr_wnd
=
Corr2dLMA
.
getCorrWnd
(
transform_size
,
transform_size
,
imgdtt_params
.
lma_wnd
);
imgdtt_params
.
lma_wnd
);
...
@@ -2645,7 +2647,7 @@ public class ImageDttCPU {
...
@@ -2645,7 +2647,7 @@ public class ImageDttCPU {
// showDoubleFloatArrays sdfa_instance = new showDoubleFloatArrays(); // just for debugging?
// showDoubleFloatArrays sdfa_instance = new showDoubleFloatArrays(); // just for debugging?
double
centerX
;
// center of aberration-corrected (common model) tile, X
double
centerX
;
// center of aberration-corrected (common model) tile, X
double
centerY
;
//
double
centerY
;
//
double
[][]
fract_shiftsXY
=
new
double
[
quad
][];
double
[][]
fract_shiftsXY
=
new
double
[
nSens
][];
double
[][]
tcorr_combo
=
null
;
// [15*15] pixel space
double
[][]
tcorr_combo
=
null
;
// [15*15] pixel space
double
[][][]
tcorr_partial
=
null
;
// [quad][numcol+1][15*15]
double
[][][]
tcorr_partial
=
null
;
// [quad][numcol+1][15*15]
double
[][][][]
tcorr_tpartial
=
null
;
// [quad][numcol+1][4][8*8]
double
[][][][]
tcorr_tpartial
=
null
;
// [quad][numcol+1][4][8*8]
...
@@ -2691,7 +2693,7 @@ public class ImageDttCPU {
...
@@ -2691,7 +2693,7 @@ public class ImageDttCPU {
centerY
=
tileY
*
transform_size
+
transform_size
/
2
-
shiftY
;
centerY
=
tileY
*
transform_size
+
transform_size
/
2
-
shiftY
;
// TODO: move port coordinates out of color channel loop
// TODO: move port coordinates out of color channel loop
double
[][]
centersXY
;
double
[][]
centersXY
;
double
[][]
disp_dist
=
new
double
[
quad
][];
// used to correct 3D correlations
double
[][]
disp_dist
=
new
double
[
nSens
][];
// used to correct 3D correlations
if
((
disparity_array
==
null
)
||
(
disparity_array
[
tileY
]
==
null
)
||
(
Double
.
isNaN
(
disparity_array
[
tileY
][
tileX
])))
{
if
((
disparity_array
==
null
)
||
(
disparity_array
[
tileY
]
==
null
)
||
(
Double
.
isNaN
(
disparity_array
[
tileY
][
tileX
])))
{
System
.
out
.
println
(
"Bug with disparity_array !!!"
);
System
.
out
.
println
(
"Bug with disparity_array !!!"
);
...
@@ -2736,7 +2738,7 @@ public class ImageDttCPU {
...
@@ -2736,7 +2738,7 @@ public class ImageDttCPU {
}
}
if
(((
globalDebugLevel
>
0
)
||
debug_distort
)
&&
debugTile
)
{
if
(((
globalDebugLevel
>
0
)
||
debug_distort
)
&&
debugTile
)
{
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
System
.
out
.
println
(
"clt_aberrations_quad_corr(): tileX="
+
tileX
+
", tileY="
+
tileY
+
System
.
out
.
println
(
"clt_aberrations_quad_corr(): tileX="
+
tileX
+
", tileY="
+
tileY
+
" centerX="
+
centerX
+
" centerY="
+
centerY
+
" disparity="
+
disparity_array
[
tileY
][
tileX
]+
" centerX="
+
centerX
+
" centerY="
+
centerY
+
" disparity="
+
disparity_array
[
tileY
][
tileX
]+
" centersXY["
+
i
+
"][0]="
+
centersXY
[
i
][
0
]+
" centersXY["
+
i
+
"][1]="
+
centersXY
[
i
][
1
]);
" centersXY["
+
i
+
"][0]="
+
centersXY
[
i
][
0
]+
" centersXY["
+
i
+
"][1]="
+
centersXY
[
i
][
1
]);
...
@@ -2748,7 +2750,7 @@ public class ImageDttCPU {
...
@@ -2748,7 +2750,7 @@ public class ImageDttCPU {
debug_offsets_xy
[
i
][
0
]
=
disp_dist
[
i
][
0
]
*
debug_offsets
[
i
][
0
]
+
disp_dist
[
i
][
1
]
*
debug_offsets
[
i
][
1
];
debug_offsets_xy
[
i
][
0
]
=
disp_dist
[
i
][
0
]
*
debug_offsets
[
i
][
0
]
+
disp_dist
[
i
][
1
]
*
debug_offsets
[
i
][
1
];
debug_offsets_xy
[
i
][
1
]
=
disp_dist
[
i
][
2
]
*
debug_offsets
[
i
][
0
]
+
disp_dist
[
i
][
3
]
*
debug_offsets
[
i
][
1
];
debug_offsets_xy
[
i
][
1
]
=
disp_dist
[
i
][
2
]
*
debug_offsets
[
i
][
0
]
+
disp_dist
[
i
][
3
]
*
debug_offsets
[
i
][
1
];
}
}
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
System
.
out
.
println
(
String
.
format
(
"%d: {%8.3f, %8.3f}"
,
i
,
debug_offsets_xy
[
i
][
0
],
debug_offsets_xy
[
i
][
1
]));
System
.
out
.
println
(
String
.
format
(
"%d: {%8.3f, %8.3f}"
,
i
,
debug_offsets_xy
[
i
][
0
],
debug_offsets_xy
[
i
][
1
]));
}
}
...
@@ -2756,7 +2758,7 @@ public class ImageDttCPU {
...
@@ -2756,7 +2758,7 @@ public class ImageDttCPU {
centersXY
[
i
][
0
]
+=
debug_offsets_xy
[
i
][
0
];
centersXY
[
i
][
0
]
+=
debug_offsets_xy
[
i
][
0
];
centersXY
[
i
][
1
]
+=
debug_offsets_xy
[
i
][
1
];
centersXY
[
i
][
1
]
+=
debug_offsets_xy
[
i
][
1
];
}
}
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
System
.
out
.
println
(
"Corrected clt_aberrations_quad_corr(): tileX="
+
tileX
+
", tileY="
+
tileY
+
System
.
out
.
println
(
"Corrected clt_aberrations_quad_corr(): tileX="
+
tileX
+
", tileY="
+
tileY
+
" centerX="
+
centerX
+
" centerY="
+
centerY
+
" disparity="
+
disparity_array
[
tileY
][
tileX
]+
" centerX="
+
centerX
+
" centerY="
+
centerY
+
" disparity="
+
disparity_array
[
tileY
][
tileX
]+
" centersXY["
+
i
+
"][0]="
+
centersXY
[
i
][
0
]+
" centersXY["
+
i
+
"][1]="
+
centersXY
[
i
][
1
]);
" centersXY["
+
i
+
"][0]="
+
centersXY
[
i
][
0
]+
" centersXY["
+
i
+
"][1]="
+
centersXY
[
i
][
1
]);
...
@@ -2777,7 +2779,7 @@ public class ImageDttCPU {
...
@@ -2777,7 +2779,7 @@ public class ImageDttCPU {
}
}
// save disparity distortions for visualization:
// save disparity distortions for visualization:
if
(
dbg_distort
!=
null
)
{
if
(
dbg_distort
!=
null
)
{
for
(
int
cam
=
0
;
cam
<
quad
;
cam
++)
{
for
(
int
cam
=
0
;
cam
<
nSens
;
cam
++)
{
dbg_distort
[
cam
*
4
+
0
][
nTile
]
=
disp_dist
[
cam
][
0
];
dbg_distort
[
cam
*
4
+
0
][
nTile
]
=
disp_dist
[
cam
][
0
];
dbg_distort
[
cam
*
4
+
1
][
nTile
]
=
disp_dist
[
cam
][
1
];
dbg_distort
[
cam
*
4
+
1
][
nTile
]
=
disp_dist
[
cam
][
1
];
dbg_distort
[
cam
*
4
+
2
][
nTile
]
=
disp_dist
[
cam
][
2
];
dbg_distort
[
cam
*
4
+
2
][
nTile
]
=
disp_dist
[
cam
][
2
];
...
@@ -2842,7 +2844,7 @@ public class ImageDttCPU {
...
@@ -2842,7 +2844,7 @@ public class ImageDttCPU {
centersXY
[
3
][
0
]+
"\t"
+
centersXY
[
3
][
1
]+
"\t"
);
centersXY
[
3
][
0
]+
"\t"
+
centersXY
[
3
][
1
]+
"\t"
);
}
}
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
if
(
debug_for_fpga
&&
(
i
==
0
)){
// not used in lwir
if
(
debug_for_fpga
&&
(
i
==
0
)){
// not used in lwir
double
[][]
fpga_clt_data
=
new
double
[
4
][];
double
[][]
fpga_clt_data
=
new
double
[
4
][];
double
[]
fpga_fract_shiftsXY
;
double
[]
fpga_fract_shiftsXY
;
...
@@ -2965,7 +2967,7 @@ public class ImageDttCPU {
...
@@ -2965,7 +2967,7 @@ public class ImageDttCPU {
if
((
globalDebugLevel
>
0
)
&&
(
tileX
>=
debug_tileX
-
2
)
&&
(
tileX
<=
debug_tileX
+
2
)
&&
if
((
globalDebugLevel
>
0
)
&&
(
tileX
>=
debug_tileX
-
2
)
&&
(
tileX
<=
debug_tileX
+
2
)
&&
(
tileY
>=
debug_tileY
-
2
)
&&
(
tileY
<=
debug_tileY
+
2
))
{
(
tileY
>=
debug_tileY
-
2
)
&&
(
tileY
<=
debug_tileY
+
2
))
{
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
System
.
out
.
println
(
"clt_aberrations_quad(): color="
+
ncol
+
", tileX="
+
tileX
+
", tileY="
+
tileY
+
System
.
out
.
println
(
"clt_aberrations_quad(): color="
+
ncol
+
", tileX="
+
tileX
+
", tileY="
+
tileY
+
" fract_shiftsXY["
+
i
+
"][0]="
+
fract_shiftsXY
[
i
][
0
]+
" fract_shiftsXY["
+
i
+
"][1]="
+
fract_shiftsXY
[
i
][
1
]);
" fract_shiftsXY["
+
i
+
"][0]="
+
fract_shiftsXY
[
i
][
0
]+
" fract_shiftsXY["
+
i
+
"][1]="
+
fract_shiftsXY
[
i
][
1
]);
}
}
...
@@ -2973,7 +2975,7 @@ public class ImageDttCPU {
...
@@ -2973,7 +2975,7 @@ public class ImageDttCPU {
if
(!
no_fract_shift
)
{
// USED in lwir
if
(!
no_fract_shift
)
{
// USED in lwir
// apply residual shift
// apply residual shift
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
fract_shift
(
// fractional shift in transform domain. Currently uses sin/cos - change to tables with 2? rotations
fract_shift
(
// fractional shift in transform domain. Currently uses sin/cos - change to tables with 2? rotations
clt_data
[
i
][
ncol
][
tileY
][
tileX
],
// double [][] clt_tile,
clt_data
[
i
][
ncol
][
tileY
][
tileX
],
// double [][] clt_tile,
// transform_size,
// transform_size,
...
@@ -2997,7 +2999,7 @@ public class ImageDttCPU {
...
@@ -2997,7 +2999,7 @@ public class ImageDttCPU {
}
}
}
else
{
// if (!isMonochrome() || (chn == MONO_CHN) || macro_mode) { // in monochrome mode skip all non-mono (green) channels
}
else
{
// if (!isMonochrome() || (chn == MONO_CHN) || macro_mode) { // in monochrome mode skip all non-mono (green) channels
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
// used in lwir
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
// used in lwir
clt_data
[
i
][
ncol
]
=
null
;
// erase unused clt_data
clt_data
[
i
][
ncol
]
=
null
;
// erase unused clt_data
}
}
}
}
...
@@ -3200,7 +3202,7 @@ public class ImageDttCPU {
...
@@ -3200,7 +3202,7 @@ public class ImageDttCPU {
imgdtt_params
.
twice_diagonal
);
// boolean twice_diagonal)
imgdtt_params
.
twice_diagonal
);
// boolean twice_diagonal)
// re-using arrays that were made for color channels
// re-using arrays that were made for color channels
clt_corr_partial
[
tileY
][
tileX
]
=
new
double
[
quad
][
numcol
+
1
][];
clt_corr_partial
[
tileY
][
tileX
]
=
new
double
[
nSens
][
numcol
+
1
][];
clt_corr_partial
[
tileY
][
tileX
][
0
][
0
]
=
corrs
[
0
];
// 1
clt_corr_partial
[
tileY
][
tileX
][
0
][
0
]
=
corrs
[
0
];
// 1
clt_corr_partial
[
tileY
][
tileX
][
0
][
1
]
=
corrs
[
1
];
// 2
clt_corr_partial
[
tileY
][
tileX
][
0
][
1
]
=
corrs
[
1
];
// 2
clt_corr_partial
[
tileY
][
tileX
][
0
][
2
]
=
corrs
[
2
];
// 3
clt_corr_partial
[
tileY
][
tileX
][
0
][
2
]
=
corrs
[
2
];
// 3
...
@@ -3594,7 +3596,7 @@ public class ImageDttCPU {
...
@@ -3594,7 +3596,7 @@ public class ImageDttCPU {
// ****** FIXME tries to use color == 3, should be disabled!
// ****** FIXME tries to use color == 3, should be disabled!
if
((
clt_corr_combo
!=
null
)
&&
!
imgdtt_params
.
corr_mode_debug
){
// not null - calculate correlations // not used in lwir
if
((
clt_corr_combo
!=
null
)
&&
!
imgdtt_params
.
corr_mode_debug
){
// not null - calculate correlations // not used in lwir
tcorr_tpartial
=
new
double
[
CORR_PAIRS
.
length
][
numcol
+
1
][
4
][
transform_len
];
tcorr_tpartial
=
new
double
[
CORR_PAIRS
.
length
][
numcol
+
1
][
4
][
transform_len
];
tcorr_partial
=
new
double
[
quad
][
numcol
+
1
][];
tcorr_partial
=
new
double
[
nSens
][
numcol
+
1
][];
for
(
int
pair
=
0
;
pair
<
CORR_PAIRS
.
length
;
pair
++){
for
(
int
pair
=
0
;
pair
<
CORR_PAIRS
.
length
;
pair
++){
for
(
int
ncol
=
0
;
ncol
<
numcol
;
ncol
++)
if
(
clt_data
[
ncol
]
!=
null
){
for
(
int
ncol
=
0
;
ncol
<
numcol
;
ncol
++)
if
(
clt_data
[
ncol
]
!=
null
){
...
@@ -3804,7 +3806,7 @@ public class ImageDttCPU {
...
@@ -3804,7 +3806,7 @@ public class ImageDttCPU {
if
((
extra_disparity
!=
0
)
&&
!
getForcedDisparity
(
tile_op
[
tileY
][
tileX
])){
// 0 - adjust disparity, 1 - use provided
if
((
extra_disparity
!=
0
)
&&
!
getForcedDisparity
(
tile_op
[
tileY
][
tileX
])){
// 0 - adjust disparity, 1 - use provided
// shift images by 0.5 * extra disparity in the diagonal direction // not used in lwir
// shift images by 0.5 * extra disparity in the diagonal direction // not used in lwir
for
(
int
ncol
=
0
;
ncol
<
numcol
;
ncol
++)
{
// color
for
(
int
ncol
=
0
;
ncol
<
numcol
;
ncol
++)
{
// color
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
if
(
clt_data
[
i
][
ncol
]
!=
null
)
{
if
(
clt_data
[
i
][
ncol
]
!=
null
)
{
fract_shift
(
// fractional shift in transform domain. Currently uses sin/cos - change to tables with 2? rotations
fract_shift
(
// fractional shift in transform domain. Currently uses sin/cos - change to tables with 2? rotations
clt_data
[
i
][
ncol
][
tileY
][
tileX
],
// double [][] clt_tile,
clt_data
[
i
][
ncol
][
tileY
][
tileX
],
// double [][] clt_tile,
...
@@ -3820,10 +3822,10 @@ public class ImageDttCPU {
...
@@ -3820,10 +3822,10 @@ public class ImageDttCPU {
}
}
// lpf tiles (same as images before)
// lpf tiles (same as images before)
// iclt tiles
// iclt tiles
double
[][][]
iclt_tile
=
new
double
[
quad
][
numcol
][];
// in mono some may remain null
double
[][][]
iclt_tile
=
new
double
[
nSens
][
numcol
][];
// in mono some may remain null
double
[]
clt_tile
;
double
[]
clt_tile
;
double
scale
=
0.25
;
// matching iclt_2d
double
scale
=
0.25
;
// matching iclt_2d
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
// USED in lwir
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
// USED in lwir
for
(
int
ncol
=
0
;
ncol
<
numcol
;
ncol
++)
if
(
clt_data
[
i
][
ncol
]
!=
null
)
{
// color
for
(
int
ncol
=
0
;
ncol
<
numcol
;
ncol
++)
if
(
clt_data
[
i
][
ncol
]
!=
null
)
{
// color
// double [] clt_tile = new double [transform_size*transform_size];
// double [] clt_tile = new double [transform_size*transform_size];
for
(
int
dct_mode
=
0
;
dct_mode
<
4
;
dct_mode
++){
for
(
int
dct_mode
=
0
;
dct_mode
<
4
;
dct_mode
++){
...
@@ -3871,8 +3873,8 @@ public class ImageDttCPU {
...
@@ -3871,8 +3873,8 @@ public class ImageDttCPU {
if
((
globalDebugLevel
>
0
)
&&
debugTile
)
{
if
((
globalDebugLevel
>
0
)
&&
debugTile
)
{
ShowDoubleFloatArrays
sdfa_instance
=
new
ShowDoubleFloatArrays
();
// just for debugging?
ShowDoubleFloatArrays
sdfa_instance
=
new
ShowDoubleFloatArrays
();
// just for debugging?
String
[]
titles
=
{
"red0"
,
"blue0"
,
"green0"
,
"red1"
,
"blue1"
,
"green1"
,
"red2"
,
"blue2"
,
"green2"
,
"red3"
,
"blue3"
,
"green3"
};
String
[]
titles
=
{
"red0"
,
"blue0"
,
"green0"
,
"red1"
,
"blue1"
,
"green1"
,
"red2"
,
"blue2"
,
"green2"
,
"red3"
,
"blue3"
,
"green3"
};
double
[][]
dbg_tile
=
new
double
[
quad
*
numcol
][];
double
[][]
dbg_tile
=
new
double
[
nSens
*
numcol
][];
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
for
(
int
ncol
=
0
;
ncol
<
numcol
;
ncol
++)
if
(
iclt_tile
[
i
][
ncol
]
!=
null
)
{
// color
for
(
int
ncol
=
0
;
ncol
<
numcol
;
ncol
++)
if
(
iclt_tile
[
i
][
ncol
]
!=
null
)
{
// color
dbg_tile
[
i
*
numcol
+
ncol
]
=
iclt_tile
[
i
][
ncol
];
dbg_tile
[
i
*
numcol
+
ncol
]
=
iclt_tile
[
i
][
ncol
];
}
}
...
@@ -3882,8 +3884,8 @@ public class ImageDttCPU {
...
@@ -3882,8 +3884,8 @@ public class ImageDttCPU {
// "de-bayer" tiles for matching, use original data for output
// "de-bayer" tiles for matching, use original data for output
double
[][][]
tiles_debayered
=
new
double
[
quad
][
numcol
][];
double
[][][]
tiles_debayered
=
new
double
[
nSens
][
numcol
][];
for
(
int
i
=
0
;
i
<
quad
;
i
++){
for
(
int
i
=
0
;
i
<
nSens
;
i
++){
for
(
int
ncol
=
0
;
ncol
<
numcol
;
ncol
++)
if
(
iclt_tile
[
i
][
ncol
]
!=
null
)
{
for
(
int
ncol
=
0
;
ncol
<
numcol
;
ncol
++)
if
(
iclt_tile
[
i
][
ncol
]
!=
null
)
{
if
(
isMonochrome
())
{
// used in lwir
if
(
isMonochrome
())
{
// used in lwir
tiles_debayered
[
i
][
ncol
]
=
iclt_tile
[
i
][
ncol
];
tiles_debayered
[
i
][
ncol
]
=
iclt_tile
[
i
][
ncol
];
...
@@ -3904,8 +3906,8 @@ public class ImageDttCPU {
...
@@ -3904,8 +3906,8 @@ public class ImageDttCPU {
if
((
globalDebugLevel
>
0
)
&&
debugTile
)
{
if
((
globalDebugLevel
>
0
)
&&
debugTile
)
{
ShowDoubleFloatArrays
sdfa_instance
=
new
ShowDoubleFloatArrays
();
// just for debugging?
ShowDoubleFloatArrays
sdfa_instance
=
new
ShowDoubleFloatArrays
();
// just for debugging?
String
[]
titles
=
{
"red0"
,
"blue0"
,
"green0"
,
"red1"
,
"blue1"
,
"green1"
,
"red2"
,
"blue2"
,
"green2"
,
"red3"
,
"blue3"
,
"green3"
};
String
[]
titles
=
{
"red0"
,
"blue0"
,
"green0"
,
"red1"
,
"blue1"
,
"green1"
,
"red2"
,
"blue2"
,
"green2"
,
"red3"
,
"blue3"
,
"green3"
};
double
[][]
dbg_tile
=
new
double
[
quad
*
numcol
][];
double
[][]
dbg_tile
=
new
double
[
nSens
*
numcol
][];
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
dbg_tile
[
i
*
numcol
+
chn
]
=
tiles_debayered
[
i
][
chn
];
dbg_tile
[
i
*
numcol
+
chn
]
=
tiles_debayered
[
i
][
chn
];
}
}
...
@@ -3914,10 +3916,10 @@ public class ImageDttCPU {
...
@@ -3914,10 +3916,10 @@ public class ImageDttCPU {
}
}
// ... used in lwir
// ... used in lwir
double
[]
max_diff
=
null
;
double
[]
max_diff
=
null
;
if
((
disparity_map
!=
null
)
&&
(
disparity_map
.
length
>=
(
IMG_DIFF0_INDEX
+
quad
))){
if
((
disparity_map
!=
null
)
&&
(
disparity_map
.
length
>=
(
IMG_DIFF0_INDEX
+
nSens
))){
max_diff
=
new
double
[
quad
];
max_diff
=
new
double
[
nSens
];
}
}
int
ports_rgb_len
=
quad
*
numcol
;
// 12
int
ports_rgb_len
=
nSens
*
numcol
;
// 12
if
((
disparity_map
!=
null
)
&&
(
disparity_map
.
length
>=
(
IMG_TONE_RGB
+
ports_rgb_len
)))
{
if
((
disparity_map
!=
null
)
&&
(
disparity_map
.
length
>=
(
IMG_TONE_RGB
+
ports_rgb_len
)))
{
ports_rgb
=
new
double
[
ports_rgb_len
];
ports_rgb
=
new
double
[
ports_rgb_len
];
}
}
...
@@ -3942,18 +3944,18 @@ public class ImageDttCPU {
...
@@ -3942,18 +3944,18 @@ public class ImageDttCPU {
// mix RGB from iclt_tile, mix alpha with - what? correlation strength or 'don't care'? good correlation or all > min?
// mix RGB from iclt_tile, mix alpha with - what? correlation strength or 'don't care'? good correlation or all > min?
for
(
int
i
=
0
;
i
<
iclt_tile
[
0
][
first_color
].
length
;
i
++
)
{
for
(
int
i
=
0
;
i
<
iclt_tile
[
0
][
first_color
].
length
;
i
++
)
{
double
sw
=
0.0
;
double
sw
=
0.0
;
for
(
int
ip
=
0
;
ip
<
quad
;
ip
++)
{
for
(
int
ip
=
0
;
ip
<
nSens
;
ip
++)
{
sw
+=
texture_tiles
[
tileY
][
tileX
][
numcol
+
1
+
ip
][
i
];
sw
+=
texture_tiles
[
tileY
][
tileX
][
numcol
+
1
+
ip
][
i
];
}
}
if
(
sw
!=
0
)
sw
=
1.0
/
sw
;
if
(
sw
!=
0
)
sw
=
1.0
/
sw
;
for
(
int
ncol
=
0
;
ncol
<
numcol
;
ncol
++)
if
(
iclt_tile
[
0
][
ncol
]
!=
null
){
// color
for
(
int
ncol
=
0
;
ncol
<
numcol
;
ncol
++)
if
(
iclt_tile
[
0
][
ncol
]
!=
null
){
// color
texture_tiles
[
tileY
][
tileX
][
ncol
][
i
]
=
0.0
;
//iclt[tileY][tileX][chn]
texture_tiles
[
tileY
][
tileX
][
ncol
][
i
]
=
0.0
;
//iclt[tileY][tileX][chn]
for
(
int
ip
=
0
;
ip
<
quad
;
ip
++)
{
for
(
int
ip
=
0
;
ip
<
nSens
;
ip
++)
{
texture_tiles
[
tileY
][
tileX
][
ncol
][
i
]
+=
sw
*
texture_tiles
[
tileY
][
tileX
][
numcol
+
1
+
ip
][
i
]
*
iclt_tile
[
ip
][
ncol
][
i
];
texture_tiles
[
tileY
][
tileX
][
ncol
][
i
]
+=
sw
*
texture_tiles
[
tileY
][
tileX
][
numcol
+
1
+
ip
][
i
]
*
iclt_tile
[
ip
][
ncol
][
i
];
}
}
}
}
}
}
if
((
disparity_map
!=
null
)
&&
(
disparity_map
.
length
>=
(
IMG_DIFF0_INDEX
+
quad
))){
if
((
disparity_map
!=
null
)
&&
(
disparity_map
.
length
>=
(
IMG_DIFF0_INDEX
+
nSens
))){
for
(
int
i
=
0
;
i
<
max_diff
.
length
;
i
++){
for
(
int
i
=
0
;
i
<
max_diff
.
length
;
i
++){
disparity_map
[
IMG_DIFF0_INDEX
+
i
][
tIndex
]
=
max_diff
[
i
];
disparity_map
[
IMG_DIFF0_INDEX
+
i
][
tIndex
]
=
max_diff
[
i
];
}
}
...
@@ -6426,6 +6428,8 @@ public class ImageDttCPU {
...
@@ -6426,6 +6428,8 @@ public class ImageDttCPU {
return
corr
;
return
corr
;
}
}
//TODO: remove dependence on quad, remove @Deprecated annotation
@Deprecated
public
static
void
clt_process_pd_correlations
(
// process correlations already prepared in dcorr and/or dcorr_combo
public
static
void
clt_process_pd_correlations
(
// process correlations already prepared in dcorr and/or dcorr_combo
QuadCLT
quadCLT
,
QuadCLT
quadCLT
,
final
ImageDttParameters
imgdtt_params
,
// Now just extra correlation parameters, later will include, most others
final
ImageDttParameters
imgdtt_params
,
// Now just extra correlation parameters, later will include, most others
...
@@ -6614,6 +6618,8 @@ public class ImageDttCPU {
...
@@ -6614,6 +6618,8 @@ public class ImageDttCPU {
}
}
//TODO: remove dependence on quad, remove @Deprecated annotation
@Deprecated
public
static
void
corr_common
(
// remove corr_common_GPU in ImageDtt ?
public
static
void
corr_common
(
// remove corr_common_GPU in ImageDtt ?
final
ImageDttParameters
imgdtt_params
,
final
ImageDttParameters
imgdtt_params
,
...
@@ -8223,8 +8229,8 @@ public class ImageDttCPU {
...
@@ -8223,8 +8229,8 @@ public class ImageDttCPU {
DttRad2
dtt
)
DttRad2
dtt
)
{
{
if
(
dtt
==
null
)
dtt
=
new
DttRad2
(
dtt_size
);
if
(
dtt
==
null
)
dtt
=
new
DttRad2
(
dtt_size
);
for
(
int
quad
=
0
;
quad
<
4
;
quad
++){
for
(
int
quad
rant
=
0
;
quadrant
<
4
;
quadrant
++){
kernels
[
quad
]
=
dtt
.
dttt_iiie
(
kernels
[
quad
],
quad
,
dtt_size
);
kernels
[
quad
rant
]
=
dtt
.
dttt_iiie
(
kernels
[
quadrant
],
quadrant
,
dtt_size
);
}
}
}
}
/*
/*
...
@@ -8929,10 +8935,15 @@ public class ImageDttCPU {
...
@@ -8929,10 +8935,15 @@ public class ImageDttCPU {
for
(
int
n
=
0
;
n
<
4
;
n
++){
for
(
int
n
=
0
;
n
<
4
;
n
++){
rslt
[
n
][
i
]
=
0
;
rslt
[
n
][
i
]
=
0
;
for
(
int
k
=
0
;
k
<
4
;
k
++){
for
(
int
k
=
0
;
k
<
4
;
k
++){
if
(
ZI
[
n
][
k
]
<
0
)
// if (ZI[n][k] < 0)
rslt
[
n
][
i
]
-=
data
[-
ZI
[
n
][
k
]][
i
]
*
kernel
[
k
][
i
];
// rslt[n][i] -= data[-ZI[n][k]][i] * kernel[k][i];
else
// else
rslt
[
n
][
i
]
+=
data
[
ZI
[
n
][
k
]][
i
]
*
kernel
[
k
][
i
];
// rslt[n][i] += data[ ZI[n][k]][i] * kernel[k][i];
if
(
ZI
[
k
][
n
]
<
0
)
rslt
[
n
][
i
]
-=
data
[-
ZI
[
k
][
n
]][
i
]
*
kernel
[
k
][
i
];
// data[-ZI[n][k]][i] * kernel[k][i];
else
rslt
[
n
][
i
]
+=
data
[
ZI
[
k
][
n
]][
i
]
*
kernel
[
k
][
i
];
// data[ ZI[n][k]][i] * kernel[k][i];
}
}
}
}
}
}
...
@@ -9594,14 +9605,15 @@ public class ImageDttCPU {
...
@@ -9594,14 +9605,15 @@ public class ImageDttCPU {
// final boolean debug_ports_coordinates = (debug_tileX == -1234);
// final boolean debug_ports_coordinates = (debug_tileX == -1234);
final
double
poly_corr
=
imgdtt_params
.
poly_corr_scale
;
// maybe add per-tile task bits to select none/near/far
final
double
poly_corr
=
imgdtt_params
.
poly_corr_scale
;
// maybe add per-tile task bits to select none/near/far
final
boolean
macro_mode
=
macro_scale
!=
1
;
// correlate tile data instead of the pixel data
final
boolean
macro_mode
=
macro_scale
!=
1
;
// correlate tile data instead of the pixel data
final
int
quad
=
4
;
// number of subcameras
// final int quad = 4; // number of subcameras
final
int
nSens
=
geometryCorrection
.
getNumSensors
();
final
int
numcol
=
3
;
// number of colors
final
int
numcol
=
3
;
// number of colors
final
int
nChn
=
image_data
[
0
].
length
;
final
int
nChn
=
image_data
[
0
].
length
;
final
int
height
=
image_data
[
0
][
0
].
length
/
width
;
final
int
height
=
image_data
[
0
][
0
].
length
/
width
;
final
int
tilesX
=
width
/
transform_size
;
final
int
tilesX
=
width
/
transform_size
;
final
int
tilesY
=
height
/
transform_size
;
final
int
tilesY
=
height
/
transform_size
;
final
int
nTilesInChn
=
tilesX
*
tilesY
;
final
int
nTilesInChn
=
tilesX
*
tilesY
;
final
double
[][][][][][]
clt_data
=
new
double
[
quad
][
nChn
][
tilesY
][
tilesX
][][];
final
double
[][][][][][]
clt_data
=
new
double
[
nSens
][
nChn
][
tilesY
][
tilesX
][][];
final
Thread
[]
threads
=
newThreadArray
(
threadsMax
);
final
Thread
[]
threads
=
newThreadArray
(
threadsMax
);
final
AtomicInteger
ai
=
new
AtomicInteger
(
0
);
final
AtomicInteger
ai
=
new
AtomicInteger
(
0
);
final
double
[]
col_weights
=
new
double
[
numcol
];
// colors are RBG
final
double
[]
col_weights
=
new
double
[
numcol
];
// colors are RBG
...
@@ -9756,7 +9768,7 @@ public class ImageDttCPU {
...
@@ -9756,7 +9768,7 @@ public class ImageDttCPU {
// showDoubleFloatArrays sdfa_instance = new showDoubleFloatArrays(); // just for debugging?
// showDoubleFloatArrays sdfa_instance = new showDoubleFloatArrays(); // just for debugging?
double
centerX
;
// center of aberration-corrected (common model) tile, X
double
centerX
;
// center of aberration-corrected (common model) tile, X
double
centerY
;
//
double
centerY
;
//
double
[][]
fract_shiftsXY
=
new
double
[
quad
][];
double
[][]
fract_shiftsXY
=
new
double
[
nSens
][];
double
[][]
tcorr_combo
=
null
;
// [15*15] pixel space
double
[][]
tcorr_combo
=
null
;
// [15*15] pixel space
double
[][][]
tcorr_partial
=
null
;
// [quad][numcol+1][15*15]
double
[][][]
tcorr_partial
=
null
;
// [quad][numcol+1][15*15]
double
[][][][]
tcorr_tpartial
=
null
;
// [quad][numcol+1][4][8*8]
double
[][][][]
tcorr_tpartial
=
null
;
// [quad][numcol+1][4][8*8]
...
@@ -9822,7 +9834,7 @@ public class ImageDttCPU {
...
@@ -9822,7 +9834,7 @@ public class ImageDttCPU {
disparity_array
[
tileY
][
tileX
]
+
disparity_corr
);
disparity_array
[
tileY
][
tileX
]
+
disparity_corr
);
if
((
globalDebugLevel
>
0
)
&&
(
tileX
==
debug_tileX
)
&&
(
tileY
==
debug_tileY
))
{
if
((
globalDebugLevel
>
0
)
&&
(
tileX
==
debug_tileX
)
&&
(
tileY
==
debug_tileY
))
{
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
System
.
out
.
println
(
"clt_aberrations_quad_corr(): tileX="
+
tileX
+
", tileY="
+
tileY
+
System
.
out
.
println
(
"clt_aberrations_quad_corr(): tileX="
+
tileX
+
", tileY="
+
tileY
+
" centerX="
+
centerX
+
" centerY="
+
centerY
+
" disparity="
+
disparity_array
[
tileY
][
tileX
]+
" centerX="
+
centerX
+
" centerY="
+
centerY
+
" disparity="
+
disparity_array
[
tileY
][
tileX
]+
" centersXY["
+
i
+
"][0]="
+
centersXY
[
i
][
0
]+
" centersXY["
+
i
+
"][1]="
+
centersXY
[
i
][
1
]);
" centersXY["
+
i
+
"][0]="
+
centersXY
[
i
][
0
]+
" centersXY["
+
i
+
"][1]="
+
centersXY
[
i
][
1
]);
...
@@ -9898,7 +9910,7 @@ public class ImageDttCPU {
...
@@ -9898,7 +9910,7 @@ public class ImageDttCPU {
centersXY
[
3
][
0
]+
"\t"
+
centersXY
[
3
][
1
]+
"\t"
);
centersXY
[
3
][
0
]+
"\t"
+
centersXY
[
3
][
1
]+
"\t"
);
}
}
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
if
(
debug_for_fpga
&&
(
i
==
0
)){
if
(
debug_for_fpga
&&
(
i
==
0
)){
double
[][]
fpga_clt_data
=
new
double
[
4
][];
double
[][]
fpga_clt_data
=
new
double
[
4
][];
double
[]
fpga_fract_shiftsXY
;
double
[]
fpga_fract_shiftsXY
;
...
@@ -10026,7 +10038,7 @@ public class ImageDttCPU {
...
@@ -10026,7 +10038,7 @@ public class ImageDttCPU {
if
((
globalDebugLevel
>
0
)
&&
(
tileX
>=
debug_tileX
-
2
)
&&
(
tileX
<=
debug_tileX
+
2
)
&&
if
((
globalDebugLevel
>
0
)
&&
(
tileX
>=
debug_tileX
-
2
)
&&
(
tileX
<=
debug_tileX
+
2
)
&&
(
tileY
>=
debug_tileY
-
2
)
&&
(
tileY
<=
debug_tileY
+
2
))
{
(
tileY
>=
debug_tileY
-
2
)
&&
(
tileY
<=
debug_tileY
+
2
))
{
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
System
.
out
.
println
(
"clt_aberrations_quad(): color="
+
chn
+
", tileX="
+
tileX
+
", tileY="
+
tileY
+
System
.
out
.
println
(
"clt_aberrations_quad(): color="
+
chn
+
", tileX="
+
tileX
+
", tileY="
+
tileY
+
" fract_shiftsXY["
+
i
+
"][0]="
+
fract_shiftsXY
[
i
][
0
]+
" fract_shiftsXY["
+
i
+
"][1]="
+
fract_shiftsXY
[
i
][
1
]);
" fract_shiftsXY["
+
i
+
"][0]="
+
fract_shiftsXY
[
i
][
0
]+
" fract_shiftsXY["
+
i
+
"][1]="
+
fract_shiftsXY
[
i
][
1
]);
}
}
...
@@ -10035,7 +10047,7 @@ public class ImageDttCPU {
...
@@ -10035,7 +10047,7 @@ public class ImageDttCPU {
// if (!no_fract_shift && !FPGA_COMPARE_DATA) {
// if (!no_fract_shift && !FPGA_COMPARE_DATA) {
if
(!
no_fract_shift
)
{
if
(!
no_fract_shift
)
{
// apply residual shift
// apply residual shift
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
fract_shift
(
// fractional shift in transform domain. Currently uses sin/cos - change to tables with 2? rotations
fract_shift
(
// fractional shift in transform domain. Currently uses sin/cos - change to tables with 2? rotations
clt_data
[
i
][
chn
][
tileY
][
tileX
],
// double [][] clt_tile,
clt_data
[
i
][
chn
][
tileY
][
tileX
],
// double [][] clt_tile,
// transform_size,
// transform_size,
...
@@ -10069,7 +10081,7 @@ public class ImageDttCPU {
...
@@ -10069,7 +10081,7 @@ public class ImageDttCPU {
if
(
clt_corr_combo
!=
null
){
// not null - calculate correlations
if
(
clt_corr_combo
!=
null
){
// not null - calculate correlations
tcorr_tpartial
=
new
double
[
CORR_PAIRS
.
length
][
numcol
+
1
][
4
][
transform_len
];
tcorr_tpartial
=
new
double
[
CORR_PAIRS
.
length
][
numcol
+
1
][
4
][
transform_len
];
tcorr_partial
=
new
double
[
quad
][
numcol
+
1
][];
tcorr_partial
=
new
double
[
nSens
][
numcol
+
1
][];
for
(
int
pair
=
0
;
pair
<
CORR_PAIRS
.
length
;
pair
++){
for
(
int
pair
=
0
;
pair
<
CORR_PAIRS
.
length
;
pair
++){
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++){
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++){
...
@@ -10571,7 +10583,7 @@ public class ImageDttCPU {
...
@@ -10571,7 +10583,7 @@ public class ImageDttCPU {
if
((
extra_disparity
!=
0
)
&&
!
getForcedDisparity
(
tile_op
[
tileY
][
tileX
])){
// 0 - adjust disparity, 1 - use provided
if
((
extra_disparity
!=
0
)
&&
!
getForcedDisparity
(
tile_op
[
tileY
][
tileX
])){
// 0 - adjust disparity, 1 - use provided
// shift images by 0.5 * extra disparity in the diagonal direction
// shift images by 0.5 * extra disparity in the diagonal direction
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
fract_shift
(
// fractional shift in transform domain. Currently uses sin/cos - change to tables with 2? rotations
fract_shift
(
// fractional shift in transform domain. Currently uses sin/cos - change to tables with 2? rotations
clt_data
[
i
][
chn
][
tileY
][
tileX
],
// double [][] clt_tile,
clt_data
[
i
][
chn
][
tileY
][
tileX
],
// double [][] clt_tile,
// transform_size,
// transform_size,
...
@@ -10585,10 +10597,10 @@ public class ImageDttCPU {
...
@@ -10585,10 +10597,10 @@ public class ImageDttCPU {
}
}
// lpf tiles (same as images before)
// lpf tiles (same as images before)
// iclt tiles
// iclt tiles
double
[][][]
iclt_tile
=
new
double
[
quad
][
numcol
][];
double
[][][]
iclt_tile
=
new
double
[
nSens
][
numcol
][];
double
[]
clt_tile
;
double
[]
clt_tile
;
double
scale
=
0.25
;
// matching iclt_2d
double
scale
=
0.25
;
// matching iclt_2d
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
// double [] clt_tile = new double [transform_size*transform_size];
// double [] clt_tile = new double [transform_size*transform_size];
for
(
int
dct_mode
=
0
;
dct_mode
<
4
;
dct_mode
++){
for
(
int
dct_mode
=
0
;
dct_mode
<
4
;
dct_mode
++){
...
@@ -10616,8 +10628,8 @@ public class ImageDttCPU {
...
@@ -10616,8 +10628,8 @@ public class ImageDttCPU {
if
((
globalDebugLevel
>
0
)
&&
debugTile
)
{
if
((
globalDebugLevel
>
0
)
&&
debugTile
)
{
ShowDoubleFloatArrays
sdfa_instance
=
new
ShowDoubleFloatArrays
();
// just for debugging?
ShowDoubleFloatArrays
sdfa_instance
=
new
ShowDoubleFloatArrays
();
// just for debugging?
String
[]
titles
=
{
"red0"
,
"blue0"
,
"green0"
,
"red1"
,
"blue1"
,
"green1"
,
"red2"
,
"blue2"
,
"green2"
,
"red3"
,
"blue3"
,
"green3"
};
String
[]
titles
=
{
"red0"
,
"blue0"
,
"green0"
,
"red1"
,
"blue1"
,
"green1"
,
"red2"
,
"blue2"
,
"green2"
,
"red3"
,
"blue3"
,
"green3"
};
double
[][]
dbg_tile
=
new
double
[
quad
*
numcol
][];
double
[][]
dbg_tile
=
new
double
[
nSens
*
numcol
][];
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
dbg_tile
[
i
*
numcol
+
chn
]
=
iclt_tile
[
i
][
chn
];
dbg_tile
[
i
*
numcol
+
chn
]
=
iclt_tile
[
i
][
chn
];
}
}
...
@@ -10627,8 +10639,8 @@ public class ImageDttCPU {
...
@@ -10627,8 +10639,8 @@ public class ImageDttCPU {
// "de-bayer" tiles for matching, use original data for output
// "de-bayer" tiles for matching, use original data for output
double
[][][]
tiles_debayered
=
new
double
[
quad
][
numcol
][];
double
[][][]
tiles_debayered
=
new
double
[
nSens
][
numcol
][];
for
(
int
i
=
0
;
i
<
quad
;
i
++){
for
(
int
i
=
0
;
i
<
nSens
;
i
++){
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++){
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++){
// tiles_debayered[i][chn] = tile_debayer(
// tiles_debayered[i][chn] = tile_debayer(
// (chn != 2), // red or blue (false - green)
// (chn != 2), // red or blue (false - green)
...
@@ -10649,8 +10661,8 @@ public class ImageDttCPU {
...
@@ -10649,8 +10661,8 @@ public class ImageDttCPU {
if
((
globalDebugLevel
>
0
)
&&
debugTile
)
{
if
((
globalDebugLevel
>
0
)
&&
debugTile
)
{
ShowDoubleFloatArrays
sdfa_instance
=
new
ShowDoubleFloatArrays
();
// just for debugging?
ShowDoubleFloatArrays
sdfa_instance
=
new
ShowDoubleFloatArrays
();
// just for debugging?
String
[]
titles
=
{
"red0"
,
"blue0"
,
"green0"
,
"red1"
,
"blue1"
,
"green1"
,
"red2"
,
"blue2"
,
"green2"
,
"red3"
,
"blue3"
,
"green3"
};
String
[]
titles
=
{
"red0"
,
"blue0"
,
"green0"
,
"red1"
,
"blue1"
,
"green1"
,
"red2"
,
"blue2"
,
"green2"
,
"red3"
,
"blue3"
,
"green3"
};
double
[][]
dbg_tile
=
new
double
[
quad
*
numcol
][];
double
[][]
dbg_tile
=
new
double
[
nSens
*
numcol
][];
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
dbg_tile
[
i
*
numcol
+
chn
]
=
tiles_debayered
[
i
][
chn
];
dbg_tile
[
i
*
numcol
+
chn
]
=
tiles_debayered
[
i
][
chn
];
}
}
...
@@ -10659,8 +10671,8 @@ public class ImageDttCPU {
...
@@ -10659,8 +10671,8 @@ public class ImageDttCPU {
}
}
double
[]
max_diff
=
null
;
double
[]
max_diff
=
null
;
if
((
disparity_map
!=
null
)
&&
(
disparity_map
.
length
>=
(
IMG_DIFF0_INDEX
+
quad
))){
if
((
disparity_map
!=
null
)
&&
(
disparity_map
.
length
>=
(
IMG_DIFF0_INDEX
+
nSens
))){
max_diff
=
new
double
[
quad
];
max_diff
=
new
double
[
nSens
];
}
}
texture_tiles
[
tileY
][
tileX
]
=
tile_combine_rgba
(
texture_tiles
[
tileY
][
tileX
]
=
tile_combine_rgba
(
tiles_debayered
,
// iclt_tile, // [port][numcol][256]
tiles_debayered
,
// iclt_tile, // [port][numcol][256]
...
@@ -10684,18 +10696,18 @@ public class ImageDttCPU {
...
@@ -10684,18 +10696,18 @@ public class ImageDttCPU {
// mix RGB from iclt_tile, mix alpha with - what? correlation strength or 'don't care'? good correlation or all > min?
// mix RGB from iclt_tile, mix alpha with - what? correlation strength or 'don't care'? good correlation or all > min?
for
(
int
i
=
0
;
i
<
iclt_tile
[
0
][
0
].
length
;
i
++
)
{
for
(
int
i
=
0
;
i
<
iclt_tile
[
0
][
0
].
length
;
i
++
)
{
double
sw
=
0.0
;
double
sw
=
0.0
;
for
(
int
ip
=
0
;
ip
<
quad
;
ip
++)
{
for
(
int
ip
=
0
;
ip
<
nSens
;
ip
++)
{
sw
+=
texture_tiles
[
tileY
][
tileX
][
numcol
+
1
+
ip
][
i
];
sw
+=
texture_tiles
[
tileY
][
tileX
][
numcol
+
1
+
ip
][
i
];
}
}
if
(
sw
!=
0
)
sw
=
1.0
/
sw
;
if
(
sw
!=
0
)
sw
=
1.0
/
sw
;
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
texture_tiles
[
tileY
][
tileX
][
chn
][
i
]
=
0.0
;
//iclt[tileY][tileX][chn]
texture_tiles
[
tileY
][
tileX
][
chn
][
i
]
=
0.0
;
//iclt[tileY][tileX][chn]
for
(
int
ip
=
0
;
ip
<
quad
;
ip
++)
{
for
(
int
ip
=
0
;
ip
<
nSens
;
ip
++)
{
texture_tiles
[
tileY
][
tileX
][
chn
][
i
]
+=
sw
*
texture_tiles
[
tileY
][
tileX
][
numcol
+
1
+
ip
][
i
]
*
iclt_tile
[
ip
][
chn
][
i
];
texture_tiles
[
tileY
][
tileX
][
chn
][
i
]
+=
sw
*
texture_tiles
[
tileY
][
tileX
][
numcol
+
1
+
ip
][
i
]
*
iclt_tile
[
ip
][
chn
][
i
];
}
}
}
}
}
}
if
((
disparity_map
!=
null
)
&&
(
disparity_map
.
length
>=
(
IMG_DIFF0_INDEX
+
quad
))){
if
((
disparity_map
!=
null
)
&&
(
disparity_map
.
length
>=
(
IMG_DIFF0_INDEX
+
nSens
))){
for
(
int
i
=
0
;
i
<
max_diff
.
length
;
i
++){
for
(
int
i
=
0
;
i
<
max_diff
.
length
;
i
++){
disparity_map
[
IMG_DIFF0_INDEX
+
i
][
tIndex
]
=
max_diff
[
i
];
disparity_map
[
IMG_DIFF0_INDEX
+
i
][
tIndex
]
=
max_diff
[
i
];
}
}
...
@@ -11196,7 +11208,7 @@ public class ImageDttCPU {
...
@@ -11196,7 +11208,7 @@ public class ImageDttCPU {
public
void
generateTextureTiles
(
// not used in lwir
public
void
generateTextureTiles
(
// not used in lwir
final
CLTParameters
clt_parameters
,
final
CLTParameters
clt_parameters
,
final
double
extra_disparity
,
final
double
extra_disparity
,
final
int
quad
,
// number of subcameras
final
int
nSens
,
// number of subcameras
final
int
numcol
,
// number of colors
final
int
numcol
,
// number of colors
int
img_mask
,
int
img_mask
,
final
int
[][]
tile_op
,
// [tilesY][tilesX] - what to do - 0 - nothing for this tile
final
int
[][]
tile_op
,
// [tilesY][tilesX] - what to do - 0 - nothing for this tile
...
@@ -11222,7 +11234,7 @@ public class ImageDttCPU {
...
@@ -11222,7 +11234,7 @@ public class ImageDttCPU {
null
,
// final double [] max_diff, // maximal (weighted) deviation of each channel from the average
null
,
// final double [] max_diff, // maximal (weighted) deviation of each channel from the average
clt_parameters
,
clt_parameters
,
extra_disparity
,
extra_disparity
,
quad
,
// number of subcameras
nSens
,
// number of subcameras
numcol
,
// number of colors
numcol
,
// number of colors
img_mask
,
img_mask
,
tile_op
,
// [tilesY][tilesX] - what to do - 0 - nothing for this tile
tile_op
,
// [tilesY][tilesX] - what to do - 0 - nothing for this tile
...
@@ -11244,7 +11256,7 @@ public class ImageDttCPU {
...
@@ -11244,7 +11256,7 @@ public class ImageDttCPU {
final
double
[]
max_diff
,
// maximal (weighted) deviation of each channel from the average
final
double
[]
max_diff
,
// maximal (weighted) deviation of each channel from the average
final
CLTParameters
clt_parameters
,
final
CLTParameters
clt_parameters
,
final
double
extra_disparity
,
final
double
extra_disparity
,
final
int
quad
,
// number of subcameras
final
int
nSens
,
// number of subcameras
final
int
numcol
,
// number of colors
final
int
numcol
,
// number of colors
int
img_mask
,
int
img_mask
,
final
int
[][]
tile_op
,
// [tilesY][tilesX] - what to do - 0 - nothing for this tile
final
int
[][]
tile_op
,
// [tilesY][tilesX] - what to do - 0 - nothing for this tile
...
@@ -11266,7 +11278,7 @@ public class ImageDttCPU {
...
@@ -11266,7 +11278,7 @@ public class ImageDttCPU {
if
((
extra_disparity
!=
0
)
&&
!
getForcedDisparity
(
tile_op
[
tileY
][
tileX
])){
// 0 - adjust disparity, 1 - use provided (now do not adjust!)
if
((
extra_disparity
!=
0
)
&&
!
getForcedDisparity
(
tile_op
[
tileY
][
tileX
])){
// 0 - adjust disparity, 1 - use provided (now do not adjust!)
// shift images by 0.5 * extra disparity in the diagonal direction
// shift images by 0.5 * extra disparity in the diagonal direction
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
fract_shift
(
// fractional shift in transform domain. Currently uses sin/cos - change to tables with 2? rotations
fract_shift
(
// fractional shift in transform domain. Currently uses sin/cos - change to tables with 2? rotations
clt_data
[
i
][
chn
],
// [tileY][tileX], // double [][] clt_tile,
clt_data
[
i
][
chn
],
// [tileY][tileX], // double [][] clt_tile,
// transform_size,
// transform_size,
...
@@ -11281,7 +11293,7 @@ public class ImageDttCPU {
...
@@ -11281,7 +11293,7 @@ public class ImageDttCPU {
if
(
debug_gpu
)
{
if
(
debug_gpu
)
{
// just one camera, all colors
// just one camera, all colors
for
(
int
cam
=
0
;
cam
<
1
;
cam
++)
{
//
quad
; i++) {
for
(
int
cam
=
0
;
cam
<
1
;
cam
++)
{
//
nSens
; i++) {
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
for
(
int
dct_mode
=
0
;
dct_mode
<
4
;
dct_mode
++){
for
(
int
dct_mode
=
0
;
dct_mode
<
4
;
dct_mode
++){
System
.
out
.
println
(
"=== CLT camera="
+
cam
+
", color="
+
chn
+
" mode="
+
dct_mode
+
" ==="
);
System
.
out
.
println
(
"=== CLT camera="
+
cam
+
", color="
+
chn
+
" mode="
+
dct_mode
+
" ==="
);
...
@@ -11298,10 +11310,10 @@ public class ImageDttCPU {
...
@@ -11298,10 +11310,10 @@ public class ImageDttCPU {
double
[][][]
iclt_tile
=
new
double
[
quad
][
numcol
][];
double
[][][]
iclt_tile
=
new
double
[
nSens
][
numcol
][];
double
[]
clt_tile
;
double
[]
clt_tile
;
double
scale
=
0.25
;
// matching iclt_2d ???
double
scale
=
0.25
;
// matching iclt_2d ???
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
// double [] clt_tile = new double [transform_size*transform_size];
// double [] clt_tile = new double [transform_size*transform_size];
for
(
int
dct_mode
=
0
;
dct_mode
<
4
;
dct_mode
++){
for
(
int
dct_mode
=
0
;
dct_mode
<
4
;
dct_mode
++){
...
@@ -11368,7 +11380,7 @@ public class ImageDttCPU {
...
@@ -11368,7 +11380,7 @@ public class ImageDttCPU {
if
(
debug_gpu
)
{
if
(
debug_gpu
)
{
System
.
out
.
println
(
"=============== IMCLT done ==============="
);
System
.
out
.
println
(
"=============== IMCLT done ==============="
);
// just one camera, all colors
// just one camera, all colors
for
(
int
cam
=
0
;
cam
<
quad
;
cam
++)
{
// quad
; i++) {
for
(
int
cam
=
0
;
cam
<
nSens
;
cam
++)
{
// nSens
; i++) {
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
System
.
out
.
println
(
"=== IMCLT camera="
+
cam
+
", color="
+
chn
+
" ==="
);
System
.
out
.
println
(
"=== IMCLT camera="
+
cam
+
", color="
+
chn
+
" ==="
);
for
(
int
i
=
0
;
i
<
2
*
transform_size
;
i
++)
{
for
(
int
i
=
0
;
i
<
2
*
transform_size
;
i
++)
{
...
@@ -11383,8 +11395,8 @@ public class ImageDttCPU {
...
@@ -11383,8 +11395,8 @@ public class ImageDttCPU {
if
((
debugLevel
>
0
)
||
debug_gpu
)
{
if
((
debugLevel
>
0
)
||
debug_gpu
)
{
ShowDoubleFloatArrays
sdfa_instance
=
new
ShowDoubleFloatArrays
();
// just for debugging?
ShowDoubleFloatArrays
sdfa_instance
=
new
ShowDoubleFloatArrays
();
// just for debugging?
String
[]
titles
=
{
"red0"
,
"blue0"
,
"green0"
,
"red1"
,
"blue1"
,
"green1"
,
"red2"
,
"blue2"
,
"green2"
,
"red3"
,
"blue3"
,
"green3"
};
String
[]
titles
=
{
"red0"
,
"blue0"
,
"green0"
,
"red1"
,
"blue1"
,
"green1"
,
"red2"
,
"blue2"
,
"green2"
,
"red3"
,
"blue3"
,
"green3"
};
double
[][]
dbg_tile
=
new
double
[
quad
*
numcol
][];
double
[][]
dbg_tile
=
new
double
[
nSens
*
numcol
][];
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
dbg_tile
[
i
*
numcol
+
chn
]
=
iclt_tile
[
i
][
chn
];
dbg_tile
[
i
*
numcol
+
chn
]
=
iclt_tile
[
i
][
chn
];
}
}
...
@@ -11394,8 +11406,8 @@ public class ImageDttCPU {
...
@@ -11394,8 +11406,8 @@ public class ImageDttCPU {
// "de-bayer" tiles for matching, use original data for output
// "de-bayer" tiles for matching, use original data for output
double
[][][]
tiles_debayered
=
new
double
[
quad
][
numcol
][];
double
[][][]
tiles_debayered
=
new
double
[
nSens
][
numcol
][];
for
(
int
i
=
0
;
i
<
quad
;
i
++){
for
(
int
i
=
0
;
i
<
nSens
;
i
++){
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++){
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++){
tiles_debayered
[
i
][
chn
]
=
tile_debayer_shot_corr
(
tiles_debayered
[
i
][
chn
]
=
tile_debayer_shot_corr
(
(
chn
!=
2
),
// red or blue (false - green)
(
chn
!=
2
),
// red or blue (false - green)
...
@@ -11411,8 +11423,8 @@ public class ImageDttCPU {
...
@@ -11411,8 +11423,8 @@ public class ImageDttCPU {
if
((
debugLevel
>
0
)
||
debug_gpu
)
{
if
((
debugLevel
>
0
)
||
debug_gpu
)
{
ShowDoubleFloatArrays
sdfa_instance
=
new
ShowDoubleFloatArrays
();
// just for debugging?
ShowDoubleFloatArrays
sdfa_instance
=
new
ShowDoubleFloatArrays
();
// just for debugging?
String
[]
titles
=
{
"red0"
,
"blue0"
,
"green0"
,
"red1"
,
"blue1"
,
"green1"
,
"red2"
,
"blue2"
,
"green2"
,
"red3"
,
"blue3"
,
"green3"
};
String
[]
titles
=
{
"red0"
,
"blue0"
,
"green0"
,
"red1"
,
"blue1"
,
"green1"
,
"red2"
,
"blue2"
,
"green2"
,
"red3"
,
"blue3"
,
"green3"
};
double
[][]
dbg_tile
=
new
double
[
quad
*
numcol
][];
double
[][]
dbg_tile
=
new
double
[
nSens
*
numcol
][];
for
(
int
i
=
0
;
i
<
quad
;
i
++)
{
for
(
int
i
=
0
;
i
<
nSens
;
i
++)
{
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
dbg_tile
[
i
*
numcol
+
chn
]
=
tiles_debayered
[
i
][
chn
];
dbg_tile
[
i
*
numcol
+
chn
]
=
tiles_debayered
[
i
][
chn
];
}
}
...
@@ -11421,7 +11433,7 @@ public class ImageDttCPU {
...
@@ -11421,7 +11433,7 @@ public class ImageDttCPU {
}
}
if
(
debug_gpu
)
{
if
(
debug_gpu
)
{
System
.
out
.
println
(
"\n=== BEFORE tile_combine_rgba ==="
);
System
.
out
.
println
(
"\n=== BEFORE tile_combine_rgba ==="
);
for
(
int
ccam
=
0
;
ccam
<
quad
;
ccam
++)
{
for
(
int
ccam
=
0
;
ccam
<
nSens
;
ccam
++)
{
for
(
int
nncol
=
0
;
nncol
<
numcol
;
nncol
++)
{
for
(
int
nncol
=
0
;
nncol
<
numcol
;
nncol
++)
{
System
.
out
.
println
(
String
.
format
(
"--- before tile_combine_rgba cam = %d, color=%d ---"
,
ccam
,
nncol
));
System
.
out
.
println
(
String
.
format
(
"--- before tile_combine_rgba cam = %d, color=%d ---"
,
ccam
,
nncol
));
for
(
int
i
=
0
;
i
<
2
*
transform_size
;
i
++)
{
for
(
int
i
=
0
;
i
<
2
*
transform_size
;
i
++)
{
...
@@ -11473,13 +11485,13 @@ public class ImageDttCPU {
...
@@ -11473,13 +11485,13 @@ public class ImageDttCPU {
if
(
lpf_rgb
!=
null
)
{
if
(
lpf_rgb
!=
null
)
{
for
(
int
i
=
0
;
i
<
iclt_tile
[
0
][
0
].
length
;
i
++
)
{
for
(
int
i
=
0
;
i
<
iclt_tile
[
0
][
0
].
length
;
i
++
)
{
double
sw
=
0.0
;
double
sw
=
0.0
;
for
(
int
ip
=
0
;
ip
<
quad
;
ip
++)
{
for
(
int
ip
=
0
;
ip
<
nSens
;
ip
++)
{
sw
+=
texture_tiles
[
tileY
][
tileX
][
numcol
+
1
+
ip
][
i
];
sw
+=
texture_tiles
[
tileY
][
tileX
][
numcol
+
1
+
ip
][
i
];
}
}
if
(
sw
!=
0
)
sw
=
1.0
/
sw
;
if
(
sw
!=
0
)
sw
=
1.0
/
sw
;
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
for
(
int
chn
=
0
;
chn
<
numcol
;
chn
++)
{
// color
texture_tiles
[
tileY
][
tileX
][
chn
][
i
]
=
0.0
;
//iclt[tileY][tileX][chn]
texture_tiles
[
tileY
][
tileX
][
chn
][
i
]
=
0.0
;
//iclt[tileY][tileX][chn]
for
(
int
ip
=
0
;
ip
<
quad
;
ip
++)
{
for
(
int
ip
=
0
;
ip
<
nSens
;
ip
++)
{
texture_tiles
[
tileY
][
tileX
][
chn
][
i
]
+=
sw
*
texture_tiles
[
tileY
][
tileX
][
numcol
+
1
+
ip
][
i
]
*
iclt_tile
[
ip
][
chn
][
i
];
texture_tiles
[
tileY
][
tileX
][
chn
][
i
]
+=
sw
*
texture_tiles
[
tileY
][
tileX
][
numcol
+
1
+
ip
][
i
]
*
iclt_tile
[
ip
][
chn
][
i
];
}
}
}
}
...
@@ -11683,7 +11695,8 @@ public class ImageDttCPU {
...
@@ -11683,7 +11695,8 @@ public class ImageDttCPU {
return
corrs2d
;
return
corrs2d
;
}
}
// Used quad
@Deprecated
public
double
[][][][][][][]
clt_bi_quad_dbg
(
// not used in lwir
public
double
[][][][][][][]
clt_bi_quad_dbg
(
// not used in lwir
final
CLTParameters
clt_parameters
,
final
CLTParameters
clt_parameters
,
final
double
fatzero
,
// May use correlation fat zero from 2 different parameters - fat_zero and rig.ml_fatzero
final
double
fatzero
,
// May use correlation fat zero from 2 different parameters - fat_zero and rig.ml_fatzero
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
View file @
5bdb59ce
...
@@ -3061,8 +3061,8 @@ public class QuadCLTCPU {
...
@@ -3061,8 +3061,8 @@ public class QuadCLTCPU {
return
result
;
return
result
;
}
}
@Deprecated
public
void
processCLTQuads
(
// not used in lwir
public
void
processCLTQuads
(
// not used in lwir
uses quad
CLTParameters
clt_parameters
,
CLTParameters
clt_parameters
,
EyesisCorrectionParameters
.
DebayerParameters
debayerParameters
,
EyesisCorrectionParameters
.
DebayerParameters
debayerParameters
,
ColorProcParameters
colorProcParameters
,
ColorProcParameters
colorProcParameters
,
...
@@ -3290,8 +3290,9 @@ public class QuadCLTCPU {
...
@@ -3290,8 +3290,9 @@ public class QuadCLTCPU {
System
.
out
.
println
(
"processCLTQuads(): processing "
+
fileIndices
.
length
+
" files finished at "
+
System
.
out
.
println
(
"processCLTQuads(): processing "
+
fileIndices
.
length
+
" files finished at "
+
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
this
.
startTime
),
3
)+
" sec, --- Free memory="
+
Runtime
.
getRuntime
().
freeMemory
()+
" (of "
+
Runtime
.
getRuntime
().
totalMemory
()+
")"
);
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
this
.
startTime
),
3
)+
" sec, --- Free memory="
+
Runtime
.
getRuntime
().
freeMemory
()+
" (of "
+
Runtime
.
getRuntime
().
totalMemory
()+
")"
);
}
}
public
ImagePlus
[]
processCLTQuad
(
// not used in lwir
@Deprecated
public
ImagePlus
[]
processCLTQuad
(
// not used in lwir uses quad
ImagePlus
[]
imp_quad
,
// should have properties "name"(base for saving results), "channel","path"
ImagePlus
[]
imp_quad
,
// should have properties "name"(base for saving results), "channel","path"
CLTParameters
clt_parameters
,
CLTParameters
clt_parameters
,
EyesisCorrectionParameters
.
DebayerParameters
debayerParameters
,
EyesisCorrectionParameters
.
DebayerParameters
debayerParameters
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment