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
f6006466
Commit
f6006466
authored
Nov 14, 2022
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding channels to overlapped textures
parent
7780b796
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
170 additions
and
51 deletions
+170
-51
CLTParameters.java
src/main/java/com/elphel/imagej/cameras/CLTParameters.java
+6
-1
GpuQuad.java
src/main/java/com/elphel/imagej/gpu/GpuQuad.java
+32
-14
ImageDtt.java
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
+12
-6
QuadCLT.java
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
+54
-12
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+2
-1
TileProcessor.cuh
src/main/resources/kernels/TileProcessor.cuh
+63
-17
TileProcessor.h
src/main/resources/kernels/TileProcessor.h
+1
-0
No files found.
src/main/java/com/elphel/imagej/cameras/CLTParameters.java
View file @
f6006466
...
@@ -135,10 +135,11 @@ public class CLTParameters {
...
@@ -135,10 +135,11 @@ public class CLTParameters {
public
double
diff_threshold
=
1.5
;
// RMS difference from average to discard channel (~ 1.0 - 1/255 full scale image)
public
double
diff_threshold
=
1.5
;
// RMS difference from average to discard channel (~ 1.0 - 1/255 full scale image)
public
boolean
diff_gauss
=
true
;
// when averaging images, use Gaussian around average as weight (false - sharp all/nothing)
public
boolean
diff_gauss
=
true
;
// when averaging images, use Gaussian around average as weight (false - sharp all/nothing)
public
double
min_agree
=
3.0
;
// minimal number of channels to agree on a point (real number to work with fuzzy averages)
public
double
min_agree
=
3.0
;
// minimal number of channels to agree on a point (real number to work with fuzzy averages)
public
boolean
dust_remove
=
true
;
// Do not reduce average weight when only one image differ
e
s much from the average
public
boolean
dust_remove
=
true
;
// Do not reduce average weight when only one image differs much from the average
public
boolean
black_back
=
true
;
// use Black for backdrop outside of the FOV
public
boolean
black_back
=
true
;
// use Black for backdrop outside of the FOV
public
boolean
keep_weights
=
true
;
// add port weights to RGBA stack (debug feature)
public
boolean
keep_weights
=
true
;
// add port weights to RGBA stack (debug feature)
public
boolean
replace_weights
=
false
;
//replace port weights with ports textures (16x16)
public
boolean
sharp_alpha
=
false
;
// combining mode for alpha channel: false - treat as RGB, true - apply center 8x8 only
public
boolean
sharp_alpha
=
false
;
// combining mode for alpha channel: false - treat as RGB, true - apply center 8x8 only
public
double
alpha0
=
0.6
;
// > .525 Alpha channel 0.0 threshold (lower - transparent) (watch for far objects)
public
double
alpha0
=
0.6
;
// > .525 Alpha channel 0.0 threshold (lower - transparent) (watch for far objects)
public
double
alpha1
=
0.8
;
// Alpha channel 1.0 threshold (higher - opaque) (watch for window dust)
public
double
alpha1
=
0.8
;
// Alpha channel 1.0 threshold (higher - opaque) (watch for window dust)
...
@@ -1195,6 +1196,7 @@ public class CLTParameters {
...
@@ -1195,6 +1196,7 @@ public class CLTParameters {
properties
.
setProperty
(
prefix
+
"dust_remove"
,
this
.
dust_remove
+
""
);
properties
.
setProperty
(
prefix
+
"dust_remove"
,
this
.
dust_remove
+
""
);
properties
.
setProperty
(
prefix
+
"black_back"
,
this
.
black_back
+
""
);
properties
.
setProperty
(
prefix
+
"black_back"
,
this
.
black_back
+
""
);
properties
.
setProperty
(
prefix
+
"keep_weights"
,
this
.
keep_weights
+
""
);
properties
.
setProperty
(
prefix
+
"keep_weights"
,
this
.
keep_weights
+
""
);
properties
.
setProperty
(
prefix
+
"replace_weights"
,
this
.
replace_weights
+
""
);
properties
.
setProperty
(
prefix
+
"sharp_alpha"
,
this
.
sharp_alpha
+
""
);
properties
.
setProperty
(
prefix
+
"sharp_alpha"
,
this
.
sharp_alpha
+
""
);
properties
.
setProperty
(
prefix
+
"alpha0"
,
this
.
alpha0
+
""
);
properties
.
setProperty
(
prefix
+
"alpha0"
,
this
.
alpha0
+
""
);
...
@@ -2095,6 +2097,7 @@ public class CLTParameters {
...
@@ -2095,6 +2097,7 @@ public class CLTParameters {
if
(
properties
.
getProperty
(
prefix
+
"dust_remove"
)!=
null
)
this
.
dust_remove
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"dust_remove"
));
if
(
properties
.
getProperty
(
prefix
+
"dust_remove"
)!=
null
)
this
.
dust_remove
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"dust_remove"
));
if
(
properties
.
getProperty
(
prefix
+
"black_back"
)!=
null
)
this
.
black_back
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"black_back"
));
if
(
properties
.
getProperty
(
prefix
+
"black_back"
)!=
null
)
this
.
black_back
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"black_back"
));
if
(
properties
.
getProperty
(
prefix
+
"keep_weights"
)!=
null
)
this
.
keep_weights
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"keep_weights"
));
if
(
properties
.
getProperty
(
prefix
+
"keep_weights"
)!=
null
)
this
.
keep_weights
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"keep_weights"
));
if
(
properties
.
getProperty
(
prefix
+
"replace_weights"
)!=
null
)
this
.
replace_weights
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"replace_weights"
));
if
(
properties
.
getProperty
(
prefix
+
"sharp_alpha"
)!=
null
)
this
.
sharp_alpha
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"sharp_alpha"
));
if
(
properties
.
getProperty
(
prefix
+
"sharp_alpha"
)!=
null
)
this
.
sharp_alpha
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"sharp_alpha"
));
if
(
properties
.
getProperty
(
prefix
+
"alpha0"
)!=
null
)
this
.
alpha0
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"alpha0"
));
if
(
properties
.
getProperty
(
prefix
+
"alpha0"
)!=
null
)
this
.
alpha0
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"alpha0"
));
if
(
properties
.
getProperty
(
prefix
+
"alpha1"
)!=
null
)
this
.
alpha1
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"alpha1"
));
if
(
properties
.
getProperty
(
prefix
+
"alpha1"
)!=
null
)
this
.
alpha1
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"alpha1"
));
...
@@ -3033,6 +3036,7 @@ public class CLTParameters {
...
@@ -3033,6 +3036,7 @@ public class CLTParameters {
gd
.
addCheckbox
(
"Do not reduce average weight when only one image differes much from the average"
,
this
.
dust_remove
);
gd
.
addCheckbox
(
"Do not reduce average weight when only one image differes much from the average"
,
this
.
dust_remove
);
gd
.
addCheckbox
(
"Use black for backdrop outside of the FOV"
,
this
.
black_back
);
gd
.
addCheckbox
(
"Use black for backdrop outside of the FOV"
,
this
.
black_back
);
gd
.
addCheckbox
(
"Add port weights to RGBA stack (debug feature)"
,
this
.
keep_weights
);
gd
.
addCheckbox
(
"Add port weights to RGBA stack (debug feature)"
,
this
.
keep_weights
);
gd
.
addCheckbox
(
"Replace port weights with per-channel MIDCT (16x16) - were relevant"
,
this
.
replace_weights
);
gd
.
addCheckbox
(
"Alpha channel: use center 8x8 (unchecked - treat same as RGB)"
,
this
.
sharp_alpha
);
gd
.
addCheckbox
(
"Alpha channel: use center 8x8 (unchecked - treat same as RGB)"
,
this
.
sharp_alpha
);
gd
.
addNumericField
(
"Alpha channel 0.0 thereshold (lower - transparent)"
,
this
.
alpha0
,
3
);
gd
.
addNumericField
(
"Alpha channel 0.0 thereshold (lower - transparent)"
,
this
.
alpha0
,
3
);
gd
.
addNumericField
(
"Alpha channel 1.0 threshold (higher - opaque)"
,
this
.
alpha1
,
3
);
gd
.
addNumericField
(
"Alpha channel 1.0 threshold (higher - opaque)"
,
this
.
alpha1
,
3
);
...
@@ -4238,6 +4242,7 @@ public class CLTParameters {
...
@@ -4238,6 +4242,7 @@ public class CLTParameters {
this
.
dust_remove
=
gd
.
getNextBoolean
();
this
.
dust_remove
=
gd
.
getNextBoolean
();
this
.
black_back
=
gd
.
getNextBoolean
();
this
.
black_back
=
gd
.
getNextBoolean
();
this
.
keep_weights
=
gd
.
getNextBoolean
();
this
.
keep_weights
=
gd
.
getNextBoolean
();
this
.
replace_weights
=
gd
.
getNextBoolean
();
this
.
sharp_alpha
=
gd
.
getNextBoolean
();
this
.
sharp_alpha
=
gd
.
getNextBoolean
();
this
.
alpha0
=
gd
.
getNextNumber
();
this
.
alpha0
=
gd
.
getNextNumber
();
this
.
alpha1
=
gd
.
getNextNumber
();
this
.
alpha1
=
gd
.
getNextNumber
();
...
...
src/main/java/com/elphel/imagej/gpu/GpuQuad.java
View file @
f6006466
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
View file @
f6006466
...
@@ -349,14 +349,15 @@ public class ImageDtt extends ImageDttCPU {
...
@@ -349,14 +349,15 @@ public class ImageDtt extends ImageDttCPU {
if
(
texture_img
!=
null
)
{
if
(
texture_img
!=
null
)
{
Rectangle
woi
=
new
Rectangle
();
// will be filled out to match actual available image
Rectangle
woi
=
new
Rectangle
();
// will be filled out to match actual available image
gpuQuad
.
execRBGA
(
gpuQuad
.
execRBGA
(
col_weights
,
// double [] color_weights,
col_weights
,
// double [] color_weights,
isLwir
(),
// boolean is_lwir,
isLwir
(),
// boolean is_lwir,
min_shot
,
// double min_shot, // 10.0
min_shot
,
// double min_shot, // 10.0
scale_shot
,
// double scale_shot, // 3.0
scale_shot
,
// double scale_shot, // 3.0
diff_sigma
,
// double diff_sigma, // pixel value/pixel change
diff_sigma
,
// double diff_sigma, // pixel value/pixel change
diff_threshold
,
// double diff_threshold, // pixel value/pixel change
diff_threshold
,
// double diff_threshold, // pixel value/pixel change
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
dust_remove
);
// boolean dust_remove,
dust_remove
,
// boolean dust_remove,
0
);
// int keep_weights)
float
[][]
rbga
=
gpuQuad
.
getRBGA
(
float
[][]
rbga
=
gpuQuad
.
getRBGA
(
(
isMonochrome
()
?
1
:
3
),
// int num_colors,
(
isMonochrome
()
?
1
:
3
),
// int num_colors,
(
texture_woi_pix
!=
null
)?
texture_woi_pix
:
woi
);
(
texture_woi_pix
!=
null
)?
texture_woi_pix
:
woi
);
...
@@ -376,6 +377,7 @@ public class ImageDtt extends ImageDttCPU {
...
@@ -376,6 +377,7 @@ public class ImageDtt extends ImageDttCPU {
diff_threshold
,
// double diff_threshold, // pixel value/pixel change - never used in GPU ?
diff_threshold
,
// double diff_threshold, // pixel value/pixel change - never used in GPU ?
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
dust_remove
,
// boolean dust_remove, // Do not reduce average weight when only one image differs much from the average
dust_remove
,
// boolean dust_remove, // Do not reduce average weight when only one image differs much from the average
0
,
// int keep_weights, // 2 bits now, move to parameters
false
,
// boolean calc_textures,
false
,
// boolean calc_textures,
true
,
// boolean calc_extra
true
,
// boolean calc_extra
false
);
// boolean linescan_order) // TODO: use true to avoid reordering of the low-res output
false
);
// boolean linescan_order) // TODO: use true to avoid reordering of the low-res output
...
@@ -427,6 +429,7 @@ public class ImageDtt extends ImageDttCPU {
...
@@ -427,6 +429,7 @@ public class ImageDtt extends ImageDttCPU {
diff_threshold
,
// double diff_threshold, // pixel value/pixel change - never used in GPU ?
diff_threshold
,
// double diff_threshold, // pixel value/pixel change - never used in GPU ?
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
dust_remove
,
// boolean dust_remove, // Do not reduce average weight when only one image differs much from the average
dust_remove
,
// boolean dust_remove, // Do not reduce average weight when only one image differs much from the average
0
,
// int keep_weights, // 2 bits now, move to parameters
true
,
// boolean calc_textures,
true
,
// boolean calc_textures,
false
,
// boolean calc_extra
false
,
// boolean calc_extra
false
);
// boolean linescan_order)
false
);
// boolean linescan_order)
...
@@ -438,7 +441,7 @@ public class ImageDtt extends ImageDttCPU {
...
@@ -438,7 +441,7 @@ public class ImageDtt extends ImageDttCPU {
numcol
,
// int num_colors,
numcol
,
// int num_colors,
false
);
// clt_parameters.keep_weights); // boolean keep_weights);
false
);
// clt_parameters.keep_weights); // boolean keep_weights);
g
puQuad
.
doubleTextures
(
G
puQuad
.
doubleTextures
(
new
Rectangle
(
0
,
0
,
tilesX
,
tilesY
),
// Rectangle woi,
new
Rectangle
(
0
,
0
,
tilesX
,
tilesY
),
// Rectangle woi,
texture_tiles
,
// double [][][][] texture_tiles, // null or [tilesY][tilesX]
texture_tiles
,
// double [][][][] texture_tiles, // null or [tilesY][tilesX]
texture_indices
,
// int [] indices,
texture_indices
,
// int [] indices,
...
@@ -663,7 +666,8 @@ public class ImageDtt extends ImageDttCPU {
...
@@ -663,7 +666,8 @@ public class ImageDtt extends ImageDttCPU {
double
diff_sigma
,
// pixel value/pixel change Used much larger sigma = 10.0 instead of 1.5
double
diff_sigma
,
// pixel value/pixel change Used much larger sigma = 10.0 instead of 1.5
double
diff_threshold
,
// pixel value/pixel change
double
diff_threshold
,
// pixel value/pixel change
double
min_agree
,
// minimal number of channels to agree on a point (real number to work with fuzzy averages)
double
min_agree
,
// minimal number of channels to agree on a point (real number to work with fuzzy averages)
boolean
dust_remove
boolean
dust_remove
,
int
keep_weights
// 2 bits now, move to parameters
){
){
int
numcol
=
isMonochrome
()?
1
:
3
;
int
numcol
=
isMonochrome
()?
1
:
3
;
double
[]
col_weights
=
new
double
[
numcol
];
double
[]
col_weights
=
new
double
[
numcol
];
...
@@ -684,6 +688,7 @@ public class ImageDtt extends ImageDttCPU {
...
@@ -684,6 +688,7 @@ public class ImageDtt extends ImageDttCPU {
diff_threshold
,
// double diff_threshold, // pixel value/pixel change
diff_threshold
,
// double diff_threshold, // pixel value/pixel change
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
dust_remove
,
// boolean dust_remove,
dust_remove
,
// boolean dust_remove,
keep_weights
,
// int keep_weights, // 2 bits now, move to parameters
true
,
// boolean calc_textures,
true
,
// boolean calc_textures,
false
,
// boolean calc_extra
false
,
// boolean calc_extra
false
);
// boolean linescan_order)
false
);
// boolean linescan_order)
...
@@ -696,7 +701,7 @@ public class ImageDtt extends ImageDttCPU {
...
@@ -696,7 +701,7 @@ public class ImageDtt extends ImageDttCPU {
int
tilesX
=
gpuQuad
.
img_width
/
GPUTileProcessor
.
DTT_SIZE
;
int
tilesX
=
gpuQuad
.
img_width
/
GPUTileProcessor
.
DTT_SIZE
;
int
tilesY
=
gpuQuad
.
img_height
/
GPUTileProcessor
.
DTT_SIZE
;
int
tilesY
=
gpuQuad
.
img_height
/
GPUTileProcessor
.
DTT_SIZE
;
double
[][][][]
texture_tiles
=
new
double
[
tilesY
][
tilesX
][][];
double
[][][][]
texture_tiles
=
new
double
[
tilesY
][
tilesX
][][];
g
puQuad
.
doubleTextures
(
G
puQuad
.
doubleTextures
(
new
Rectangle
(
0
,
0
,
tilesX
,
tilesY
),
// Rectangle woi,
new
Rectangle
(
0
,
0
,
tilesX
,
tilesY
),
// Rectangle woi,
texture_tiles
,
// double [][][][] texture_tiles, // null or [tilesY][tilesX]
texture_tiles
,
// double [][][][] texture_tiles, // null or [tilesY][tilesX]
texture_indices
,
// int [] indices,
texture_indices
,
// int [] indices,
...
@@ -744,6 +749,7 @@ public class ImageDtt extends ImageDttCPU {
...
@@ -744,6 +749,7 @@ public class ImageDtt extends ImageDttCPU {
diff_threshold
,
// double diff_threshold, // pixel value/pixel change
diff_threshold
,
// double diff_threshold, // pixel value/pixel change
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
dust_remove
,
// boolean dust_remove,
dust_remove
,
// boolean dust_remove,
0
,
// int keep_weights, // 2 bits now, move to parameters
false
,
// boolean calc_textures,
false
,
// boolean calc_textures,
true
,
// boolean calc_extra
true
,
// boolean calc_extra
false
);
// boolean linescan_order)
false
);
// boolean linescan_order)
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
View file @
f6006466
...
@@ -1655,7 +1655,9 @@ public class QuadCLT extends QuadCLTCPU {
...
@@ -1655,7 +1655,9 @@ public class QuadCLT extends QuadCLTCPU {
clt_parameters
.
diff_sigma
,
// double diff_sigma, // pixel value/pixel change Used much larger sigma = 10.0 instead of 1.5
clt_parameters
.
diff_sigma
,
// double diff_sigma, // pixel value/pixel change Used much larger sigma = 10.0 instead of 1.5
clt_parameters
.
diff_threshold
,
// double diff_threshold, // pixel value/pixel change
clt_parameters
.
diff_threshold
,
// double diff_threshold, // pixel value/pixel change
clt_parameters
.
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
clt_parameters
.
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
clt_parameters
.
dust_remove
);
// boolean dust_remove
clt_parameters
.
dust_remove
,
// boolean dust_remove
0
);
// int keep_weights // 2 bits now, move to parameters
if
(
max_distortion
>
0
)
{
// remove distorted tiles
if
(
max_distortion
>
0
)
{
// remove distorted tiles
double
max_distortion2
=
max_distortion
*
max_distortion
;
double
max_distortion2
=
max_distortion
*
max_distortion
;
...
@@ -2225,6 +2227,10 @@ public class QuadCLT extends QuadCLTCPU {
...
@@ -2225,6 +2227,10 @@ public class QuadCLT extends QuadCLTCPU {
col_weights
[
1
]
=
clt_parameters
.
corr_blue
*
col_weights
[
2
];
col_weights
[
1
]
=
clt_parameters
.
corr_blue
*
col_weights
[
2
];
}
}
Rectangle
woi
=
new
Rectangle
();
// will be filled out to match actual available image
Rectangle
woi
=
new
Rectangle
();
// will be filled out to match actual available image
// int keep_weights = (clt_parameters.keep_weights? 1 : 0) + (clt_parameters.replace_weights? 2 : 0);
int
keep_weights
=
(
clt_parameters
.
replace_weights
?
2
:
0
);
// just 0/2
int
text_colors
=
(
isMonochrome
()
?
1
:
3
);
int
texture_layers
=
(
text_colors
+
1
)+((
keep_weights
!=
0
)?(
text_colors
*
getNumSensors
()):
0
);
gpuQuad
.
execRBGA
(
gpuQuad
.
execRBGA
(
col_weights
,
// double [] color_weights,
col_weights
,
// double [] color_weights,
isLwir
(),
// boolean is_lwir,
isLwir
(),
// boolean is_lwir,
...
@@ -2233,9 +2239,10 @@ public class QuadCLT extends QuadCLTCPU {
...
@@ -2233,9 +2239,10 @@ public class QuadCLT extends QuadCLTCPU {
clt_parameters
.
diff_sigma
,
// double diff_sigma, // pixel value/pixel change Used much larger sigma = 10.0 instead of 1.5
clt_parameters
.
diff_sigma
,
// double diff_sigma, // pixel value/pixel change Used much larger sigma = 10.0 instead of 1.5
clt_parameters
.
diff_threshold
,
// double diff_threshold, // pixel value/pixel change
clt_parameters
.
diff_threshold
,
// double diff_threshold, // pixel value/pixel change
clt_parameters
.
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
clt_parameters
.
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
clt_parameters
.
dust_remove
);
// boolean dust_remove,
clt_parameters
.
dust_remove
,
// boolean dust_remove,
keep_weights
);
// int keep_weights)
float
[][]
rbga
=
gpuQuad
.
getRBGA
(
float
[][]
rbga
=
gpuQuad
.
getRBGA
(
(
isMonochrome
()
?
1
:
3
),
// int num_colors,
texture_layers
-
1
,
//
(isMonochrome() ? 1 : 3), // int num_colors,
woi
);
woi
);
for
(
int
ncol
=
0
;
ncol
<
texture_img
.
length
;
ncol
++)
if
(
ncol
<
rbga
.
length
)
{
for
(
int
ncol
=
0
;
ncol
<
texture_img
.
length
;
ncol
++)
if
(
ncol
<
rbga
.
length
)
{
texture_img
[
ncol
]
=
rbga
[
ncol
];
texture_img
[
ncol
]
=
rbga
[
ncol
];
...
@@ -2301,6 +2308,7 @@ public class QuadCLT extends QuadCLTCPU {
...
@@ -2301,6 +2308,7 @@ public class QuadCLT extends QuadCLTCPU {
clt_parameters
.
diff_threshold
,
// double diff_threshold, // pixel value/pixel change
clt_parameters
.
diff_threshold
,
// double diff_threshold, // pixel value/pixel change
clt_parameters
.
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
clt_parameters
.
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
clt_parameters
.
dust_remove
,
// boolean dust_remove,
clt_parameters
.
dust_remove
,
// boolean dust_remove,
0
,
// int keep_weights, // 2 bits now, move to parameters
false
,
// boolean calc_textures,
false
,
// boolean calc_textures,
true
,
// boolean calc_extra
true
,
// boolean calc_extra
false
);
// boolean linescan_order) // TODO: use true to avoid reordering of the low-res output
false
);
// boolean linescan_order) // TODO: use true to avoid reordering of the low-res output
...
@@ -2320,6 +2328,7 @@ public class QuadCLT extends QuadCLTCPU {
...
@@ -2320,6 +2328,7 @@ public class QuadCLT extends QuadCLTCPU {
}
}
if
(
try_textures
)
{
if
(
try_textures
)
{
int
keep_weights
=
(
clt_parameters
.
keep_weights
?
1
:
0
)
+
(
clt_parameters
.
replace_weights
?
2
:
0
);
//Generate non-overlapping (16x16) texture tiles, prepare
//Generate non-overlapping (16x16) texture tiles, prepare
gpuQuad
.
execTextures
(
gpuQuad
.
execTextures
(
col_weights
,
// double [] color_weights,
col_weights
,
// double [] color_weights,
...
@@ -2330,27 +2339,33 @@ public class QuadCLT extends QuadCLTCPU {
...
@@ -2330,27 +2339,33 @@ public class QuadCLT extends QuadCLTCPU {
clt_parameters
.
diff_threshold
,
// double diff_threshold, // pixel value/pixel change
clt_parameters
.
diff_threshold
,
// double diff_threshold, // pixel value/pixel change
clt_parameters
.
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
clt_parameters
.
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
clt_parameters
.
dust_remove
,
// boolean dust_remove,
clt_parameters
.
dust_remove
,
// boolean dust_remove,
keep_weights
,
// int keep_weights, // 2 bits now, move to parameters
true
,
// boolean calc_textures,
true
,
// boolean calc_textures,
false
,
// boolean calc_extra
false
,
// boolean calc_extra
false
);
// boolean linescan_order)
false
);
// boolean linescan_order)
int
[]
texture_indices
=
gpuQuad
.
getTextureIndices
();
int
[]
texture_indices
=
gpuQuad
.
getTextureIndices
();
int
numcol
=
isMonochrome
()?
1
:
3
;
int
numcol
=
isMonochrome
()?
1
:
3
;
int
num_src_slices
=
numcol
+
1
;
// + (clt_parameters.keep_weights?(ports + numcol + 1):0); // 12 ; // calculate
// int num_src_slices = numcol + 1; // + (clt_parameters.keep_weights?(ports + numcol + 1):0); // 12 ; // calculate
int
num_src_slices
=
numcol
+
1
+
(
clt_parameters
.
keep_weights
?(
getNumSensors
()
+
numcol
+
1
):
0
);
// 12 ; // calculate
float
[]
flat_textures
=
gpuQuad
.
getFlatTextures
(
// fatal error has been detected by the Java Runtime Environment:
float
[]
flat_textures
=
gpuQuad
.
getFlatTextures
(
// fatal error has been detected by the Java Runtime Environment:
texture_indices
.
length
,
texture_indices
.
length
,
numcol
,
// int num_colors,
numcol
,
// int num_colors,
false
);
// clt_parameters.keep_weights); // boolean keep_weights);
(
keep_weights
!=
0
));
// false); // clt_parameters.keep_weights); // boolean keep_weights);
if
(
keep_weights
!=
0
)
{
}
// numcol + 1 + (clt_parameters.keep_weights?(getNumSensors() + numcol + 1):0); // 12 ; // calculate
int
tilesX
=
gpuQuad
.
img_width
/
GPUTileProcessor
.
DTT_SIZE
;
int
tilesX
=
gpuQuad
.
img_width
/
GPUTileProcessor
.
DTT_SIZE
;
int
tilesY
=
gpuQuad
.
img_height
/
GPUTileProcessor
.
DTT_SIZE
;
int
tilesY
=
gpuQuad
.
img_height
/
GPUTileProcessor
.
DTT_SIZE
;
double
[][][][]
texture_tiles
=
new
double
[
tilesY
][
tilesX
][][];
double
[][][][]
texture_tiles
=
new
double
[
tilesY
][
tilesX
][][];
g
puQuad
.
doubleTextures
(
G
puQuad
.
doubleTextures
(
new
Rectangle
(
0
,
0
,
tilesX
,
tilesY
),
// Rectangle woi,
new
Rectangle
(
0
,
0
,
tilesX
,
tilesY
),
// Rectangle woi,
texture_tiles
,
// double [][][][] texture_tiles, // null or [tilesY][tilesX]
texture_tiles
,
// double [][][][] texture_tiles, // null or [tilesY][tilesX]
texture_indices
,
// int [] indices,
texture_indices
,
// int [] indices,
flat_textures
,
// float [][][] ftextures,
flat_textures
,
// float [][][] ftextures,
tilesX
,
// int full_width,
tilesX
,
// int full_width,
isMonochrome
()?
2
:
4
,
// rbga only /int num_slices
num_src_slices
,
// isMonochrome()? 2: 4,
// rbga only /int num_slices
num_src_slices
// int num_src_slices
num_src_slices
// int num_src_slices
);
);
int
num_out_slices
=
0
;
int
num_out_slices
=
0
;
...
@@ -2361,6 +2376,29 @@ public class QuadCLT extends QuadCLTCPU {
...
@@ -2361,6 +2376,29 @@ public class QuadCLT extends QuadCLTCPU {
}
}
}
}
if
(
num_out_slices
>
0
)
{
if
(
num_out_slices
>
0
)
{
String
[]
dbg_titles
=
new
String
[
num_out_slices
];
fill_titles:
{
int
indx
=
0
;
for
(
int
i
=
0
;
i
<
numcol
;
i
++)
{
if
(
indx
>=
num_out_slices
)
break
fill_titles
;
else
dbg_titles
[
indx
++]
=
"c"
+
i
;
}
if
(
indx
>=
num_out_slices
)
break
fill_titles
;
else
dbg_titles
[
indx
++]
=
"alpha"
;
for
(
int
i
=
0
;
i
<
getNumSensors
();
i
++)
{
if
(
indx
>=
num_out_slices
)
break
fill_titles
;
else
dbg_titles
[
indx
++]
=
(((
keep_weights
&
2
)
!=
0
)?
"t"
:
"w"
)+
i
;
}
for
(
int
i
=
0
;
i
<
numcol
;
i
++)
{
if
(
indx
>=
num_out_slices
)
break
fill_titles
;
else
dbg_titles
[
indx
++]
=
"crms"
+
i
;
}
if
(
indx
>=
num_out_slices
)
break
fill_titles
;
else
dbg_titles
[
indx
++]
=
"crms"
;
}
//crms
int
ssize
=
2
*
GPUTileProcessor
.
DTT_SIZE
;
int
ssize
=
2
*
GPUTileProcessor
.
DTT_SIZE
;
int
width
=
tilesX
*
ssize
;
int
width
=
tilesX
*
ssize
;
int
height
=
tilesY
*
ssize
;
int
height
=
tilesY
*
ssize
;
...
@@ -2390,8 +2428,8 @@ public class QuadCLT extends QuadCLTCPU {
...
@@ -2390,8 +2428,8 @@ public class QuadCLT extends QuadCLTCPU {
width
,
width
,
height
,
height
,
true
,
true
,
getImageName
()+
"-textures
"
getImageName
()+
"-textures
-"
+
keep_weights
,
);
dbg_titles
);
}
}
System
.
out
.
println
(
"try_textures DONE"
);
System
.
out
.
println
(
"try_textures DONE"
);
}
}
...
@@ -2661,6 +2699,7 @@ public class QuadCLT extends QuadCLTCPU {
...
@@ -2661,6 +2699,7 @@ public class QuadCLT extends QuadCLTCPU {
clt_parameters
.
diff_threshold
,
// double diff_threshold, // pixel value/pixel change - never used in GPU ?
clt_parameters
.
diff_threshold
,
// double diff_threshold, // pixel value/pixel change - never used in GPU ?
clt_parameters
.
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
clt_parameters
.
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
clt_parameters
.
dust_remove
,
// boolean dust_remove, // Do not reduce average weight when only one image differs much from the average
clt_parameters
.
dust_remove
,
// boolean dust_remove, // Do not reduce average weight when only one image differs much from the average
0
,
// int keep_weights, // 2 bits now, move to parameters
calc_textures
,
// boolean calc_textures,
calc_textures
,
// boolean calc_textures,
calc_extra
,
// boolean calc_extra)
calc_extra
,
// boolean calc_extra)
false
);
// boolean linescan_order) // TODO: use true to avoid reordering of the low-res output
false
);
// boolean linescan_order) // TODO: use true to avoid reordering of the low-res output
...
@@ -2680,7 +2719,9 @@ public class QuadCLT extends QuadCLTCPU {
...
@@ -2680,7 +2719,9 @@ public class QuadCLT extends QuadCLTCPU {
clt_parameters
.
diff_sigma
,
// double diff_sigma, // pixel value/pixel change
clt_parameters
.
diff_sigma
,
// double diff_sigma, // pixel value/pixel change
clt_parameters
.
diff_threshold
,
// double diff_threshold, // pixel value/pixel change
clt_parameters
.
diff_threshold
,
// double diff_threshold, // pixel value/pixel change
clt_parameters
.
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
clt_parameters
.
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
clt_parameters
.
dust_remove
);
// boolean dust_remove,
clt_parameters
.
dust_remove
,
// boolean dust_remove,
0
);
// int keep_weights)
long
endTexturesRBGA
=
System
.
nanoTime
();
long
endTexturesRBGA
=
System
.
nanoTime
();
long
endGPUTime
=
System
.
nanoTime
();
long
endGPUTime
=
System
.
nanoTime
();
...
@@ -2973,7 +3014,7 @@ public class QuadCLT extends QuadCLTCPU {
...
@@ -2973,7 +3014,7 @@ public class QuadCLT extends QuadCLTCPU {
String
results_path
=
quadCLT_main
.
correctionsParameters
.
selectResultsDirectory
(
// selectX3dDirectory(
String
results_path
=
quadCLT_main
.
correctionsParameters
.
selectResultsDirectory
(
// selectX3dDirectory(
true
,
// smart,
true
,
// smart,
true
);
//newAllowed, // save
true
);
//newAllowed, // save
quadCLT_main
.
e
yesisCorrections
.
saveAndShow
(
// save and show color RGBA texture
E
yesisCorrections
.
saveAndShow
(
// save and show color RGBA texture
imp_texture_stack
,
imp_texture_stack
,
results_path
,
results_path
,
true
,
// quadCLT_main.correctionsParameters.png && !clt_parameters.black_back,
true
,
// quadCLT_main.correctionsParameters.png && !clt_parameters.black_back,
...
@@ -3021,7 +3062,8 @@ public class QuadCLT extends QuadCLTCPU {
...
@@ -3021,7 +3062,8 @@ public class QuadCLT extends QuadCLTCPU {
}
}
}
}
double
[][][][]
texture_tiles
=
new
double
[
tilesY
][
tilesX
][][];
double
[][][][]
texture_tiles
=
new
double
[
tilesY
][
tilesX
][][];
quadCLT_main
.
getGPU
().
doubleTextures
(
quadCLT_main
.
getGPU
();
GpuQuad
.
doubleTextures
(
new
Rectangle
(
0
,
0
,
tilesX
,
tilesY
),
// Rectangle woi,
new
Rectangle
(
0
,
0
,
tilesX
,
tilesY
),
// Rectangle woi,
texture_tiles
,
// double [][][][] texture_tiles, // null or [tilesY][tilesX]
texture_tiles
,
// double [][][][] texture_tiles, // null or [tilesY][tilesX]
texture_indices
,
// int [] indices,
texture_indices
,
// int [] indices,
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
View file @
f6006466
...
@@ -13730,7 +13730,8 @@ public class QuadCLTCPU {
...
@@ -13730,7 +13730,8 @@ public class QuadCLTCPU {
clt_parameters
.
diff_sigma
,
// double diff_sigma, // pixel value/pixel change Used much larger sigma = 10.0 instead of 1.5
clt_parameters
.
diff_sigma
,
// double diff_sigma, // pixel value/pixel change Used much larger sigma = 10.0 instead of 1.5
clt_parameters
.
diff_threshold
,
// double diff_threshold, // pixel value/pixel change
clt_parameters
.
diff_threshold
,
// double diff_threshold, // pixel value/pixel change
clt_parameters
.
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
clt_parameters
.
min_agree
,
// double min_agree, // minimal number of channels to agree on a point (real number to work with fuzzy averages)
clt_parameters
.
dust_remove
);
// boolean dust_remove
clt_parameters
.
dust_remove
,
// boolean dust_remove
0
);
// int keep_weights // 2 bits now, move to parameters
}
}
if
(
save_diff
||
save_lowres
)
{
if
(
save_diff
||
save_lowres
)
{
image_dtt
.
get_diffs_lowres
(
// CUDA_ERROR_INVALID_VALUE (because no tiles)
image_dtt
.
get_diffs_lowres
(
// CUDA_ERROR_INVALID_VALUE (because no tiles)
...
...
src/main/resources/kernels/TileProcessor.cuh
View file @
f6006466
This diff is collapsed.
Click to expand it.
src/main/resources/kernels/TileProcessor.h
View file @
f6006466
...
@@ -144,6 +144,7 @@ extern "C" __global__ void textures_nonoverlap(
...
@@ -144,6 +144,7 @@ extern "C" __global__ void textures_nonoverlap(
float
params
[
5
],
float
params
[
5
],
float
weights
[
3
],
// scale for R,B,G
float
weights
[
3
],
// scale for R,B,G
int
dust_remove
,
// Do not reduce average weight when only one image differs much from the average
int
dust_remove
,
// Do not reduce average weight when only one image differs much from the average
int
keep_weights
,
// Was not here before 10/12/2022. return channel weights after A in RGBA (was removed) (should be 0 if gpu_texture_rbg)?
// combining both non-overlap and overlap (each calculated if pointer is not null )
// combining both non-overlap and overlap (each calculated if pointer is not null )
size_t
texture_stride
,
// in floats (now 256*4 = 1024) // may be 0 if not needed
size_t
texture_stride
,
// in floats (now 256*4 = 1024) // may be 0 if not needed
float
*
gpu_texture_tiles
,
// (number of colors +1 + ?)*16*16 rgba texture tiles // may be 0 if not needed
float
*
gpu_texture_tiles
,
// (number of colors +1 + ?)*16*16 rgba texture tiles // may be 0 if not needed
...
...
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