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
54c5427a
Commit
54c5427a
authored
Aug 12, 2023
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added rendering flat field - did not help
parent
7180569b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
11 deletions
+67
-11
GpuQuad.java
src/main/java/com/elphel/imagej/gpu/GpuQuad.java
+33
-3
ImageDtt.java
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
+6
-4
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+15
-0
QuadCLT.java
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
+10
-2
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+3
-2
No files found.
src/main/java/com/elphel/imagej/gpu/GpuQuad.java
View file @
54c5427a
...
...
@@ -844,6 +844,29 @@ public class GpuQuad{ // quad camera description
true
);
}
/**
* Set uniform data instead of the source images (for texture correction)
* Prepares array, if used a lot, may reuse the same array for all scenes, all sensors
* @param value - valuer to use for each pixel
*/
public
void
setUniformImages
(
double
value
)
{
double
[][][]
bayer_data
=
quadCLT
.
getImageData
();
// resets hasNewImageData()
double
[][][]
const_data
=
new
double
[
bayer_data
.
length
]
[][];
for
(
int
nsens
=
0
;
nsens
<
bayer_data
.
length
;
nsens
++)
if
(
bayer_data
[
nsens
]
!=
null
){
const_data
[
nsens
]
=
new
double
[
bayer_data
[
nsens
].
length
][];
for
(
int
nchn
=
0
;
nchn
<
bayer_data
[
nsens
].
length
;
nchn
++)
{
const_data
[
nsens
][
nchn
]
=
new
double
[
bayer_data
[
nsens
][
nchn
].
length
];
Arrays
.
fill
(
const_data
[
nsens
][
nchn
],
value
);
}
}
setBayerImages
(
const_data
,
true
);
quadCLT
.
setNewDataState
(
true
);
// next time will read actual data
}
/**
* Copy a set of Bayer images to the GPU
* @param bayer_data per camera a set of split-color images [4][3][w*h], may be [4][1][w*h]
...
...
@@ -1435,7 +1458,8 @@ public class GpuQuad{ // quad camera description
execConvertDirect
(
false
,
null
,
erase_clt
);
erase_clt
,
Double
.
NaN
);
// double fill_value) {
}
/**
* Convert and save TD representation in either normal or reference scene. Reference scene TD representation
...
...
@@ -1444,11 +1468,13 @@ public class GpuQuad{ // quad camera description
* @param wh window width, height (or null)
* @param erase_clt erase CLT data. Only needed before execImcltRbgAll() if not all the
* tiles are converted. <0 - do not erase, 0 - erase to 0, 1 - erase to NaN
* @param fill_value Double.NaN - normal, otherwise use this value for every pixel
*/
public
void
execConvertDirect
(
boolean
ref_scene
,
int
[]
wh
,
int
erase_clt
)
{
int
erase_clt
,
double
fill_value
)
{
if
(
this
.
gpuTileProcessor
.
GPU_CONVERT_DIRECT_kernel
==
null
)
{
IJ
.
showMessage
(
"Error"
,
"No GPU kernel: GPU_CONVERT_DIRECT_kernel"
);
...
...
@@ -1465,7 +1491,11 @@ public class GpuQuad{ // quad camera description
wh
=
new
int
[]
{
img_width
,
img_height
};
}
setConvolutionKernels
(
false
);
// set kernels if they are not set already
setBayerImages
(
false
);
// set Bayer images if this.quadCLT instance has new ones
if
(!
Double
.
isNaN
(
fill_value
))
{
setUniformImages
(
fill_value
);
}
else
{
setBayerImages
(
false
);
// set Bayer images if this.quadCLT instance has new ones
}
// kernel parameters: pointer to pointers
int
tilesX
=
wh
[
0
]
/
GPUTileProcessor
.
DTT_SIZE
;
int
tilesY
=
wh
[
1
]
/
GPUTileProcessor
.
DTT_SIZE
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
View file @
54c5427a
...
...
@@ -1237,6 +1237,7 @@ public class ImageDtt extends ImageDttCPU {
* @param gpu_sigma_b
* @param gpu_sigma_g
* @param gpu_sigma_m
* @param fill_value normally - Double.NaN. If not - use constant pixel value
* @param threadsMax
* @param globalDebugLevel
*/
...
...
@@ -1250,7 +1251,8 @@ public class ImageDtt extends ImageDttCPU {
final
double
gpu_sigma_b
,
// 0.9, 1.1
final
double
gpu_sigma_g
,
// 0.6, 0.7
final
double
gpu_sigma_m
,
// = 0.4; // 0.7;
final
int
threadsMax
,
// maximal number of threads to launch
final
double
fill_value
,
// normally - Double.NaN. If not - use constant pixel value
final
int
threadsMax
,
// maximal number of threads to launch
final
int
globalDebugLevel
)
{
final
float
[][]
lpf_rgb
=
new
float
[][]
{
...
...
@@ -1272,7 +1274,7 @@ public class ImageDtt extends ImageDttCPU {
gpuQuad
.
updateTasks
(
tp_tasks
,
false
);
// boolean use_aux // while is it in class member? - just to be able to free
gpuQuad
.
execConvertDirect
(
use_reference_buffer
,
wh
,
erase_clt
);
// put results into a "reference" buffer
gpuQuad
.
execConvertDirect
(
use_reference_buffer
,
wh
,
erase_clt
,
fill_value
);
// put results into a "reference" buffer
}
public
void
setReferenceTDMotionBlur
(
...
...
@@ -1307,7 +1309,7 @@ public class ImageDtt extends ImageDttCPU {
gpuQuad
.
updateTasks
(
tp_tasks
[
0
],
false
);
// boolean use_aux // while is it in class member? - just to be able to free
gpuQuad
.
execConvertDirect
(
use_reference_buffer
,
wh
,
erase_clt
);
// put results into a "reference" buffer
gpuQuad
.
execConvertDirect
(
use_reference_buffer
,
wh
,
erase_clt
,
Double
.
NaN
);
// put results into a "reference" buffer
// second tasks (subtracting MB)
gpuQuad
.
setTasks
(
// copy tp_tasks to the GPU memory
...
...
@@ -1320,7 +1322,7 @@ public class ImageDtt extends ImageDttCPU {
gpuQuad
.
updateTasks
(
tp_tasks
[
1
],
false
);
// boolean use_aux // while is it in class member? - just to be able to free
gpuQuad
.
execConvertDirect
(
use_reference_buffer
,
wh
,
-
1
);
// erase_clt); // put results into a "reference" buffer
gpuQuad
.
execConvertDirect
(
use_reference_buffer
,
wh
,
-
1
,
Double
.
NaN
);
// erase_clt); // put results into a "reference" buffer
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
54c5427a
...
...
@@ -5844,6 +5844,7 @@ public class OpticalFlow {
true
,
// toRGB, // final boolean toRGB,
clt_parameters
.
imp
.
show_color_nan
,
// boolean show_nan
"GPU-SHIFTED-D"
+
clt_parameters
.
disparity
,
// String suffix,
Double
.
NaN
,
// double fill_value,// - use instead of image
threadsMax
,
// int threadsMax,
debugLevel
);
// int debugLevel)
quadCLTs
[
ref_index
].
saveImagePlusInModelDirectory
(
...
...
@@ -5862,6 +5863,7 @@ public class OpticalFlow {
false
,
// toRGB, // final boolean toRGB,
clt_parameters
.
imp
.
show_mono_nan
,
// boolean show_nan
"GPU-SHIFTED-D"
+
clt_parameters
.
disparity
,
// String suffix,
Double
.
NaN
,
// double fill_value,// - use instead of image
threadsMax
,
// int threadsMax,
debugLevel
);
// int debugLevel)
quadCLTs
[
ref_index
].
saveImagePlusInModelDirectory
(
...
...
@@ -5942,6 +5944,7 @@ public class OpticalFlow {
true
,
// toRGB, // final boolean toRGB,
clt_parameters
.
imp
.
show_color_nan
,
scenes_suffix
+
"GPU-SHIFTED-FOREGROUND"
,
// String suffix,
Double
.
NaN
,
// double fill_value,// - use instead of image
threadsMax
,
// int threadsMax,
debugLevel
);
// int debugLevel)
quadCLTs
[
ref_index
].
saveImagePlusInModelDirectory
(
...
...
@@ -5960,6 +5963,7 @@ public class OpticalFlow {
false
,
// toRGB, // final boolean toRGB,
clt_parameters
.
imp
.
show_mono_nan
,
scenes_suffix
+
"GPU-SHIFTED-FOREGROUND"
,
// String suffix,
Double
.
NaN
,
// double fill_value,// - use instead of image
threadsMax
,
// int threadsMax,
debugLevel
);
// int debugLevel)
quadCLTs
[
ref_index
].
saveImagePlusInModelDirectory
(
...
...
@@ -5987,6 +5991,7 @@ public class OpticalFlow {
true
,
// final boolean toRGB,
clt_parameters
.
imp
.
show_color_nan
,
"GPU-SHIFTED-BACKGROUND"
,
// String suffix,
Double
.
NaN
,
// double fill_value,// - use instead of image
threadsMax
,
// int threadsMax,
debugLevel
);
// int debugLevel)
quadCLTs
[
ref_index
].
saveImagePlusInModelDirectory
(
...
...
@@ -6005,6 +6010,7 @@ public class OpticalFlow {
false
,
// final boolean toRGB,
clt_parameters
.
imp
.
show_mono_nan
,
"GPU-SHIFTED-BACKGROUND"
,
// String suffix,
Double
.
NaN
,
// double fill_value,// - use instead of image
threadsMax
,
// int threadsMax,
debugLevel
);
// int debugLevel)
quadCLTs
[
ref_index
].
saveImagePlusInModelDirectory
(
...
...
@@ -6593,6 +6599,7 @@ public class OpticalFlow {
clt_parameters
.
imp
.
show_color_nan
,
""
,
// String suffix, no suffix here
Double
.
NaN
,
// double fill_value,// - use instead of image
THREADS_MAX
,
// int threadsMax,
debugLevel
);
// int debugLevel)
if
(
stack_scenes_color
==
null
)
{
...
...
@@ -6616,6 +6623,7 @@ public class OpticalFlow {
false
,
// final boolean toRGB,
clt_parameters
.
imp
.
show_mono_nan
,
""
,
// String suffix, no suffix here
Double
.
NaN
,
// double fill_value,// - use instead of image
THREADS_MAX
,
// int threadsMax,
debugLevel
);
// int debugLevel)
if
(
stack_scenes_mono
==
null
)
{
...
...
@@ -6736,6 +6744,7 @@ public class OpticalFlow {
true
,
// final boolean toRGB,
clt_parameters
.
imp
.
show_color_nan
,
""
,
// String suffix, no suffix here
Double
.
NaN
,
// double fill_value,// - use instead of image
THREADS_MAX
,
// int threadsMax,
debugLevel
);
// int debugLevel)
if
(
stack_adjusted_color
==
null
)
{
...
...
@@ -6759,6 +6768,7 @@ public class OpticalFlow {
false
,
// final boolean toRGB,
clt_parameters
.
imp
.
show_mono_nan
,
""
,
// String suffix, no suffix here
Double
.
NaN
,
// double fill_value,// - use instead of image
THREADS_MAX
,
// int threadsMax,
debugLevel
);
// int debugLevel)
if
(
stack_adjusted_mono
==
null
)
{
...
...
@@ -6973,6 +6983,7 @@ public class OpticalFlow {
toRGB
,
// final boolean toRGB,
(
toRGB
?
clt_parameters
.
imp
.
show_color_nan
:
clt_parameters
.
imp
.
show_mono_nan
),
""
,
// String suffix, no suffix here
Double
.
NaN
,
// double fill_value, - use instead of image
QuadCLT
.
THREADS_MAX
,
// int threadsMax,
debugLevel
);
// int debugLevel)
...
...
@@ -6992,6 +7003,7 @@ public class OpticalFlow {
toRGB
,
// final boolean toRGB,
(
toRGB
?
clt_parameters
.
imp
.
show_color_nan
:
clt_parameters
.
imp
.
show_mono_nan
),
""
,
// String suffix, no suffix here
Double
.
NaN
,
// double fill_value,// - use instead of image
QuadCLT
.
THREADS_MAX
,
// int threadsMax,
debugLevel
);
// int debugLevel)
}
...
...
@@ -12592,6 +12604,7 @@ public class OpticalFlow {
clt_parameters
.
gpu_sigma_b
,
// final double gpu_sigma_b, // 0.9, 1.1
clt_parameters
.
gpu_sigma_g
,
// final double gpu_sigma_g, // 0.6, 0.7
clt_parameters
.
gpu_sigma_m
,
// final double gpu_sigma_m, // = 0.4; // 0.7;
Double
.
NaN
,
// final double fill_value, // normally - Double.NaN. If not - use constant pixel value
QuadCLT
.
THREADS_MAX
,
// final int threadsMax, // maximal number of threads to launch
debug_level
);
// final int globalDebugLevel);
}
...
...
@@ -14373,6 +14386,7 @@ public class OpticalFlow {
false
,
// toRGB, // final boolean toRGB,
clt_parameters
.
imp
.
show_color_nan
,
quadCLTs
[
nscene
].
getImageName
()+
"-MOTION_BLUR_CORRECTED"
,
// String suffix,
Double
.
NaN
,
// double fill_value, - use instead of image
THREADS_MAX
,
// int threadsMax,
debugLevel
);
// int debugLevel)
imp_mbc
.
show
();
...
...
@@ -14394,6 +14408,7 @@ public class OpticalFlow {
false
,
// toRGB, // final boolean toRGB,
clt_parameters
.
imp
.
show_color_nan
,
quadCLTs
[
nscene
].
getImageName
()+
"-MOTION_BLUR_CORRECTED-MERGED"
,
// String suffix,
Double
.
NaN
,
// double fill_value, - use instead of image
THREADS_MAX
,
// int threadsMax,
debugLevel
);
// int debugLevel)
imp_mbc_merged
.
show
();
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
View file @
54c5427a
...
...
@@ -880,6 +880,7 @@ public class QuadCLT extends QuadCLTCPU {
false
,
// final boolean toRGB,
true
,
// final boolean show_nan,
"PHOTOMETRIC"
,
// String suffix,
Double
.
NaN
,
// double fill_value,// - use instead of image
threadsMax
,
// int threadsMax,
-
2
);
// final int debugLevel);
if
(
debug
)
{
...
...
@@ -1258,6 +1259,7 @@ public class QuadCLT extends QuadCLTCPU {
final
boolean
toRGB
,
final
boolean
show_nan
,
String
suffix
,
double
fill_value
,
// - use instead of image
int
threadsMax
,
final
int
debugLevel
){
return
renderGPUFromDSI
(
...
...
@@ -1278,6 +1280,7 @@ public class QuadCLT extends QuadCLTCPU {
toRGB
,
show_nan
,
suffix
,
Double
.
NaN
,
// double fill_value, - use instead of image
threadsMax
,
debugLevel
);
}
...
...
@@ -1299,6 +1302,7 @@ public class QuadCLT extends QuadCLTCPU {
* @param toRGB
* @param show_nan
* @param suffix
* @param fill_value. Noramlly NaN, if not - fill image pixels with constant value
* @param threadsMax
* @param debugLevel
* @return
...
...
@@ -1322,6 +1326,7 @@ public class QuadCLT extends QuadCLTCPU {
final
boolean
toRGB
,
final
boolean
show_nan
,
String
suffix
,
double
fill_value
,
int
threadsMax
,
final
int
debugLevel
){
double
[][]
pXpYD
;
...
...
@@ -1382,7 +1387,7 @@ public class QuadCLT extends QuadCLTCPU {
dbg_titles
);
}
TpTask
[][]
tp_tasks
;
if
(
mb_vectors
!=
null
)
{
if
(
(
mb_vectors
!=
null
)
&&
Double
.
isNaN
(
fill_value
))
{
tp_tasks
=
GpuQuad
.
setInterTasksMotionBlur
(
// "true" reference, with stereo actual reference will be offset
scene
.
getNumSensors
(),
rendered_width
,
// should match output size, pXpYD.length
...
...
@@ -1428,7 +1433,7 @@ public class QuadCLT extends QuadCLTCPU {
full_woi_in
.
height
*
GPUTileProcessor
.
DTT_SIZE
};
int
erase_clt
=
show_nan
?
1
:
0
;
// boolean test1 = true;
if
(
mb_vectors
!=
null
)
{
// && test1) {
if
(
(
mb_vectors
!=
null
)
&&
Double
.
isNaN
(
fill_value
)
)
{
// && test1) {
image_dtt
.
setReferenceTDMotionBlur
(
// change to main?
erase_clt
,
//final int erase_clt,
wh
,
// null, // final int [] wh, // null (use sensor dimensions) or pair {width, height} in pixels
...
...
@@ -1452,6 +1457,7 @@ public class QuadCLT extends QuadCLTCPU {
clt_parameters
.
gpu_sigma_b
,
// final double gpu_sigma_b, // 0.9, 1.1
clt_parameters
.
gpu_sigma_g
,
// final double gpu_sigma_g, // 0.6, 0.7
clt_parameters
.
gpu_sigma_m
,
// final double gpu_sigma_m, // = 0.4; // 0.7;
fill_value
,
// final double fill_value, // normally - Double.NaN. If not - use constant pixel value
threadsMax
,
// final int threadsMax, // maximal number of threads to launch
debugLevel
);
// final int globalDebugLevel);
}
...
...
@@ -1651,6 +1657,7 @@ public class QuadCLT extends QuadCLTCPU {
clt_parameters
.
gpu_sigma_b
,
// final double gpu_sigma_b, // 0.9, 1.1
clt_parameters
.
gpu_sigma_g
,
// final double gpu_sigma_g, // 0.6, 0.7
clt_parameters
.
gpu_sigma_m
,
// final double gpu_sigma_m, // = 0.4; // 0.7;
Double
.
NaN
,
// final double fill_value, // normally - Double.NaN. If not - use constant pixel value
OpticalFlow
.
THREADS_MAX
,
// final int threadsMax, // maximal number of threads to launch
debugLevel
);
// final int globalDebugLevel);
}
...
...
@@ -1942,6 +1949,7 @@ public class QuadCLT extends QuadCLTCPU {
clt_parameters
.
gpu_sigma_b
,
// final double gpu_sigma_b, // 0.9, 1.1
clt_parameters
.
gpu_sigma_g
,
// final double gpu_sigma_g, // 0.6, 0.7
clt_parameters
.
gpu_sigma_m
,
// final double gpu_sigma_m, // = 0.4; // 0.7;
Double
.
NaN
,
// final double fill_value, // normally - Double.NaN. If not - use constant pixel value
OpticalFlow
.
THREADS_MAX
,
// final int threadsMax, // maximal number of threads to launch
debugLevel
);
// final int globalDebugLevel);
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
View file @
54c5427a
...
...
@@ -2411,9 +2411,10 @@ public class QuadCLTCPU {
ShowDoubleFloatArrays
.
showArrays
(
dsi_main
,
tp
.
getTilesX
(),
tp
.
getTilesY
(),
true
,
title
,
titles
);
}
public
void
setNewDataState
(
boolean
state
)
{
new_image_data
=
state
;
}
public
boolean
hasNewImageData
()
{
return
new_image_data
;
}
...
...
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