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
7c10a29b
Commit
7c10a29b
authored
Nov 25, 2021
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Editing for GPU debug export
parent
643febaa
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
893 additions
and
400 deletions
+893
-400
Eyesis_Correction.java
.../java/com/elphel/imagej/correction/Eyesis_Correction.java
+5
-3
ExportForGPUDevelopment.java
...n/java/com/elphel/imagej/gpu/ExportForGPUDevelopment.java
+263
-0
GPUTileProcessor.java
src/main/java/com/elphel/imagej/gpu/GPUTileProcessor.java
+1
-1
GpuQuad.java
src/main/java/com/elphel/imagej/gpu/GpuQuad.java
+4
-0
CorrVector.java
...main/java/com/elphel/imagej/tileprocessor/CorrVector.java
+20
-0
GeometryCorrection.java
...a/com/elphel/imagej/tileprocessor/GeometryCorrection.java
+48
-40
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+31
-21
TwoQuadCLT.java
...main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
+521
-335
No files found.
src/main/java/com/elphel/imagej/correction/Eyesis_Correction.java
View file @
7c10a29b
...
...
@@ -805,6 +805,8 @@ private Panel panel1,
addButton
(
"Reset AUX Geometry"
,
panelLWIR16
,
color_stop
);
addButton
(
"Generate Sym Vectors"
,
panelLWIR16
,
color_configure
);
addButton
(
"Image Properties"
,
panelLWIR16
,
color_conf_process
);
addButton
(
"GPU simulate"
,
panelClt_GPU
,
color_conf_process
);
plugInFrame
.
add
(
panelLWIR16
);
}
...
...
@@ -6095,12 +6097,12 @@ private Panel panel1,
QUAD_CLT
,
// QuadCLT quadCLT_main,
QUAD_CLT_AUX
,
// QuadCLT quadCLT_aux,
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_AUX
,
//EyesisCorrectionParameters.ColorProcParameters colorProcParameters_aux,
RGB_PARAMETERS
,
//EyesisCorrectionParameters.RGBParameters rgbParameters,
//
RGB_PARAMETERS, //EyesisCorrectionParameters.RGBParameters rgbParameters,
THREADS_MAX
,
//final int threadsMax, // maximal number of threads to launch
UPDATE_STATUS
,
//final boolean updateStatus,
//
UPDATE_STATUS, //final boolean updateStatus,
DEBUG_LEVEL
);
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
...
...
src/main/java/com/elphel/imagej/gpu/ExportForGPUDevelopment.java
0 → 100644
View file @
7c10a29b
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/gpu/GPUTileProcessor.java
View file @
7c10a29b
...
...
@@ -91,7 +91,7 @@ public class GPUTileProcessor {
public
static
int
DTT_SIZE_LOG2
=
3
;
public
static
int
DTT_SIZE
=
(
1
<<
DTT_SIZE_LOG2
);
static
int
THREADSX
=
DTT_SIZE
;
public
static
int
NUM_CAMS
=
4
;
public
static
int
NUM_CAMS
=
16
;
// 4; Now - maximal number of sensors
public
static
int
NUM_PAIRS
=
6
;
// top hor, bottom hor, left vert, right vert, main diagonal, other diagonal
public
static
int
NUM_COLORS
=
3
;
// public static int IMG_WIDTH = 2592;
...
...
src/main/java/com/elphel/imagej/gpu/GpuQuad.java
View file @
7c10a29b
...
...
@@ -374,6 +374,7 @@ public class GpuQuad{ // quad camera description
}
}
// Use NUM_CAMS = 16 gc.expandSensors(NUM_CAMS) here
public
void
setGeometryCorrection
(
GeometryCorrection
gc
,
boolean
use_java_rByRDist
)
{
// false - use newer GPU execCalcReverseDistortions
float
[]
fgc
=
gc
.
toFloatArray
();
...
...
@@ -1306,6 +1307,8 @@ public class GpuQuad{ // quad camera description
IJ
.
showMessage
(
"Error"
,
"No GPU kernel: GPU_IMCLT_ALL_kernel"
);
return
;
}
//cuFuncSetAttribute(this.gpuTileProcessor.GPU_IMCLT_ALL_kernel, CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES, 65536)
int
apply_lpf
=
1
;
int
tilesX
=
img_width
/
GPUTileProcessor
.
DTT_SIZE
;
int
tilesY
=
img_height
/
GPUTileProcessor
.
DTT_SIZE
;
...
...
@@ -1321,6 +1324,7 @@ public class GpuQuad{ // quad camera description
Pointer
.
to
(
new
int
[]
{
imclt_stride
})
// const size_t dstride); // in floats (pixels)
);
cuCtxSynchronize
();
// Call the kernel function
cuLaunchKernel
(
this
.
gpuTileProcessor
.
GPU_IMCLT_ALL_kernel
,
GridFullWarps
[
0
],
GridFullWarps
[
1
],
GridFullWarps
[
2
],
// Grid dimension
...
...
src/main/java/com/elphel/imagej/tileprocessor/CorrVector.java
View file @
7c10a29b
...
...
@@ -417,6 +417,26 @@ public class CorrVector{ // TODO: Update to non-quad (extract to a file first)?
this
.
geometryCorrection
=
geometryCorrection
;
}
public
CorrVector
(
GeometryCorrection
geometryCorrection
,
GeometryCorrection
sourceGeometryCorrection
)
{
int
num_sensors
=
geometryCorrection
.
getNumSensors
();
this
.
symmVectorsSet
=
SymmVector
.
getSymmVectorsSet
(
num_sensors
);
this
.
geometryCorrection
=
geometryCorrection
;
this
.
vector
=
new
double
[
getLength
(
num_sensors
)];
CorrVector
scv
=
sourceGeometryCorrection
.
getCorrVector
();
int
num_sens
=
geometryCorrection
.
getNumSensors
();
int
snum_sens
=
sourceGeometryCorrection
.
getNumSensors
();
int
min_num_sens
=
(
snum_sens
<
num_sens
)
?
snum_sens
:
num_sens
;
System
.
arraycopy
(
scv
.
vector
,
scv
.
getTiltIndex
(),
vector
,
getTiltIndex
(),
min_num_sens
-
1
);
System
.
arraycopy
(
scv
.
vector
,
scv
.
getAzimuthIndex
(),
vector
,
getAzimuthIndex
(),
min_num_sens
-
1
);
System
.
arraycopy
(
scv
.
vector
,
scv
.
getRollIndex
(),
vector
,
getRollIndex
(),
min_num_sens
);
System
.
arraycopy
(
scv
.
vector
,
scv
.
getZoomIndex
(),
vector
,
getZoomIndex
(),
min_num_sens
-
1
);
System
.
arraycopy
(
scv
.
vector
,
scv
.
getIMUIndex
(),
vector
,
getIMUIndex
(),
CORR_IMU
.
length
);
}
public
CorrVector
getCorrVector
(
GeometryCorrection
geometryCorrection
,
double
[]
vector
){
// not used in lwir
...
...
src/main/java/com/elphel/imagej/tileprocessor/GeometryCorrection.java
View file @
7c10a29b
...
...
@@ -237,9 +237,9 @@ public class GeometryCorrection {
right
,
// [0], right[1], right[2], right[3], // [NUM_CAMS];
height
,
// [0], height[1], height[2], height[3], // [NUM_CAMS];
roll
,
// [0], roll[1], roll[2], roll[3], // [NUM_CAMS]; // degrees, CW (to target) - positive
// [NUM_CAMS][2]
pXY0
,
// [0][0], pXY0[0][1], pXY0[1][0], pXY0[1][1],
// [2][0], pXY0[2][1], pXY0[3][0], pXY0[3][1],
common_right
,
// mm right, camera center
common_forward
,
// mm forward (to target), camera center
common_height
,
// mm up, camera center
...
...
@@ -284,47 +284,55 @@ public class GeometryCorrection {
doubles
[
i
]
=
double_list
.
get
(
i
);
}
return
doubles
;
/*
return new double[] {
pixelCorrectionWidth, // =2592; // virtual camera center is at (pixelCorrectionWidth/2, pixelCorrectionHeight/2)
pixelCorrectionHeight, // =1936;
line_time, // duration of one scan line readout (for ERS)
focalLength, // =FOCAL_LENGTH;
pixelSize, // = PIXEL_SIZE; //um
distortionRadius, // = DISTORTION_RADIUS; // mm - half width of the sensor
distortionC, // r^2
distortionB, // r^3
distortionA, // r^4 (normalized to focal length or to sensor half width?)
distortionA5, // r^5 (normalized to focal length or to sensor half width?)
distortionA6, // r^6 (normalized to focal length or to sensor half width?)
distortionA7, // r^7 (normalized to focal length or to sensor half width?)
distortionA8, // r^8 (normalized to focal length or to sensor half width?)
elevation, // degrees, up - positive;
heading, // degrees, CW (from top) - positive
forward[0], forward[1], forward[2], forward[3], // [NUM_CAMS];
right[0], right[1], right[2], right[3], // [NUM_CAMS];
height[0], height[1], height[2], height[3], // [NUM_CAMS];
roll[0], roll[1], roll[2], roll[3], // [NUM_CAMS]; // degrees, CW (to target) - positive
pXY0[0][0], pXY0[0][1], pXY0[1][0], pXY0[1][1],
pXY0[2][0], pXY0[2][1], pXY0[3][0], pXY0[3][1],
common_right, // mm right, camera center
common_forward, // mm forward (to target), camera center
common_height, // mm up, camera center
common_roll, // degrees CW (to target) camera as a whole
rXY[0][0], rXY[0][1], // [NUM_CAMS][2]; // XY pairs of the in a normal plane, relative to disparityRadius
rXY[1][0], rXY[1][1],
rXY[2][0], rXY[2][1],
rXY[3][0], rXY[3][1],
cameraRadius, // average distance from the "mass center" of the sensors to the sensors
disparityRadius, //=150.0; // distance between cameras to normalize disparity units to. sqrt(2)*disparityRadius for quad
woi_tops[0],woi_tops[1],woi_tops[2],woi_tops[3]
// TODO: ADD camera_heights[0], camera_heights[1], camera_heights[2], camera_heights[3],
};
*/
}
public
GeometryCorrection
expandSensors
(
int
num_cams
)
{
GeometryCorrection
egc
=
new
GeometryCorrection
(
num_cams
);
// single
int
min_nc
=
(
numSensors
<
num_cams
)
?
numSensors
:
num_cams
;
egc
.
pixelCorrectionWidth
=
pixelCorrectionWidth
;
// =2592; // virtual camera center is at (pixelCorrectionWidth/2, pixelCorrectionHeight/2)
egc
.
pixelCorrectionHeight
=
pixelCorrectionHeight
;
// =1936;
egc
.
line_time
=
line_time
;
// duration of one scan line readout (for ERS)
egc
.
focalLength
=
focalLength
;
// , // =FOCAL_LENGTH;
egc
.
pixelSize
=
pixelSize
;
// = PIXEL_SIZE; //um
egc
.
distortionRadius
=
distortionRadius
;
// = DISTORTION_RADIUS; // mm - half width of the sensor
egc
.
distortionC
=
distortionC
;
// r^2
egc
.
distortionB
=
distortionB
;
// r^3
egc
.
distortionA
=
distortionA
;
// r^4 (normalized to focal length or to sensor half width?)
egc
.
distortionA5
=
distortionA5
;
// r^5 (normalized to focal length or to sensor half width?)
egc
.
distortionA6
=
distortionA6
;
// r^6 (normalized to focal length or to sensor half width?)
egc
.
distortionA7
=
distortionA7
;
// r^7 (normalized to focal length or to sensor half width?)
egc
.
distortionA8
=
distortionA8
;
// r^8 (normalized to focal length or to sensor half width?)
egc
.
elevation
=
elevation
;
// degrees, up - positive;
egc
.
heading
=
heading
;
// degrees, CW (from top) - positive
egc
.
common_right
=
common_right
;
// mm right, camera center
egc
.
common_forward
=
common_forward
;
// mm forward (to target), camera center
egc
.
common_height
=
common_height
;
// mm up, camera center
egc
.
common_roll
=
common_roll
;
// degrees CW (to target) camera as a whole
egc
.
cameraRadius
=
cameraRadius
;
// average distance from the "mass center" of the sensors to the sensors
egc
.
disparityRadius
=
disparityRadius
;
//=150.0; // distance between cameras to normalize disparity units to. sqrt(2)*disparityRadius for quad
System
.
arraycopy
(
forward
,
0
,
egc
.
forward
,
0
,
min_nc
);
System
.
arraycopy
(
right
,
0
,
egc
.
right
,
0
,
min_nc
);
System
.
arraycopy
(
height
,
0
,
egc
.
height
,
0
,
min_nc
);
System
.
arraycopy
(
roll
,
0
,
egc
.
roll
,
0
,
min_nc
);
System
.
arraycopy
(
woi_tops
,
0
,
egc
.
woi_tops
,
0
,
min_nc
);
for
(
int
n
=
0
;
n
<
min_nc
;
n
++)
{
egc
.
pXY0
[
n
]
=
pXY0
[
n
].
clone
();
}
CorrVector
cv
=
new
CorrVector
(
egc
,
// GeometryCorrection geometryCorrection,
this
);
// GeometryCorrection sourceGeometryCorrection)
egc
.
setCorrVector
(
cv
);
egc
.
rByRDist
=
rByRDist
.
clone
();
return
egc
;
}
public
int
[]
getWOITops
()
{
// not used in lwir
return
woi_tops
;
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
View file @
7c10a29b
...
...
@@ -1469,7 +1469,9 @@ public class QuadCLTCPU {
geometryCorrection
.
setCorrVector
(
this
.
extrinsic_vect
);
// geometryCorrection = new GeometryCorrection(this.extrinsic_vect);
}
//
if
(
is_aux
)
{
geometryCorrection
.
setRigOffsetFromProperies
(
prefix
,
properties
);
}
...
...
@@ -1631,7 +1633,13 @@ public class QuadCLTCPU {
System
.
out
.
println
(
"=== Extrinsic corrections ==="
);
System
.
out
.
println
(
geometryCorrection
.
getCorrVector
().
toString
());
}
double
[]
dbg_objects
=
geometryCorrection
.
toDoubleArray
();
// double [] dbg_objects = geometryCorrection.toDoubleArray();
double
[]
dbg_double
=
geometryCorrection
.
toDoubleArray
();
float
[]
dbg_float
=
geometryCorrection
.
toFloatArray
();
System
.
out
.
println
(
"toFloatArray().length="
+
geometryCorrection
.
toFloatArray
().
length
);
System
.
out
.
println
();
//listGeometryCorrection
return
true
;
}
...
...
@@ -14166,18 +14174,18 @@ public class QuadCLTCPU {
)
{
boolean
need_diffs
=
false
;
double
[][]
src_data
=
{
this
.
dsi
[
is_aux
?
TwoQuadCLT
.
DSI_DISPARITY_AUX
:
TwoQuadCLT
.
DSI_DISPARITY_MAIN
],
this
.
dsi
[
is_aux
?
TwoQuadCLT
.
DSI_STRENGTH_AUX
:
TwoQuadCLT
.
DSI_STRENGTH_MAIN
],
this
.
dsi
[
is_aux
?
TwoQuadCLT
.
DSI_DISPARITY_AUX_LMA
:
TwoQuadCLT
.
DSI_DISPARITY_MAIN_LMA
],
this
.
dsi
[
is_aux
?
TwoQuadCLT
.
DSI_DISPARITY_AUX
:
TwoQuadCLT
.
DSI_DISPARITY_MAIN
],
this
.
dsi
[
is_aux
?
TwoQuadCLT
.
DSI_STRENGTH_AUX
:
TwoQuadCLT
.
DSI_STRENGTH_MAIN
],
this
.
dsi
[
is_aux
?
TwoQuadCLT
.
DSI_DISPARITY_AUX_LMA
:
TwoQuadCLT
.
DSI_DISPARITY_MAIN_LMA
],
};
CLTPass3d
pass
=
new
CLTPass3d
(
this
.
tp
,
0
);
boolean
[]
selection
=
new
boolean
[
src_data
[
0
].
length
];
boolean
[]
selection_all
=
new
boolean
[
src_data
[
0
].
length
];
for
(
int
i
=
0
;
i
<
selection
.
length
;
i
++)
{
selection
[
i
]
=
(
src_data
[
1
][
i
]
>
0
)
&&
(
Double
.
isNaN
(
src_data
[
2
][
i
]));
// that do not have LMA
selection_all
[
i
]
=
(
src_data
[
1
][
i
]
>
0
);
}
for
(
int
clust_radius
=
00
;
clust_radius
<
5
;
clust_radius
++)
{
pass
.
setTileOpDisparity
(
...
...
@@ -14194,22 +14202,24 @@ public class QuadCLTCPU {
100
,
// final int threadsMax, // maximal number of threads to launch
true
,
// final boolean updateStatus,
0
);
// final int debugLevel)
tp
.
showScan
(
pass
,
// CLTPass3d scan,
getImageName
()+
"-MAP-FZ"
+(
clt_parameters
.
getGpuFatZero
(
isMonochrome
()))+
"-CLUST"
+
clust_radius
);
tp
.
showLmaCmStrength
(
pass
,
// CLTPass3d scan,
64
,
// int bins,
"Strength_lma_vs_cm_cr"
+
clust_radius
+
"-FZ"
+(
clt_parameters
.
getGpuFatZero
(
isMonochrome
())));
// String title)
if
(
clust_radius
==
0
)
{
tp
.
adjustLmaStrength
(
clt_parameters
.
img_dtt
,
// ImageDttParameters imgdtt_params,
pass
,
// CLTPass3d scan,
1
);
// int debugLevel)
}
tp
.
showScan
(
pass
,
// CLTPass3d scan,
getImageName
()+
"-MAP-FZ"
+(
clt_parameters
.
getGpuFatZero
(
isMonochrome
()))+
"-CLUST"
+
clust_radius
);
tp
.
showLmaCmStrength
(
pass
,
// CLTPass3d scan,
64
,
// int bins,
"Strength_lma_vs_cm_cr"
+
clust_radius
+
"-FZ"
+(
clt_parameters
.
getGpuFatZero
(
isMonochrome
())));
// String title)
if
(
clust_radius
==
0
)
{
tp
.
adjustLmaStrength
(
clt_parameters
.
img_dtt
,
// ImageDttParameters imgdtt_params,
pass
,
// CLTPass3d scan,
1
);
// int debugLevel)
}
}
return
;
}
// Generate files for testing GPU
}
src/main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
View file @
7c10a29b
This diff is collapsed.
Click to expand it.
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