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
16b4ece4
Commit
16b4ece4
authored
Dec 04, 2021
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Got GPU-processed LWIR images
parent
75da8cbd
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
238 additions
and
140 deletions
+238
-140
ThermalColor.java
src/main/java/com/elphel/imagej/cameras/ThermalColor.java
+14
-2
GpuQuad.java
src/main/java/com/elphel/imagej/gpu/GpuQuad.java
+3
-2
QuadCLT.java
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
+34
-12
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+187
-124
No files found.
src/main/java/com/elphel/imagej/cameras/ThermalColor.java
View file @
16b4ece4
...
@@ -42,8 +42,20 @@ public class ThermalColor {
...
@@ -42,8 +42,20 @@ public class ThermalColor {
double
k
=
out_range
/
PALETTE_RANGE
;
double
k
=
out_range
/
PALETTE_RANGE
;
double
value
=
(
v
-
min
)/(
max
-
min
)
*
(
this
.
palette
.
length
-
1
);
double
value
=
(
v
-
min
)/(
max
-
min
)
*
(
this
.
palette
.
length
-
1
);
int
ivalue
=
(
int
)
(
value
);
int
ivalue
=
(
int
)
(
value
);
if
(
ivalue
<
0
)
return
getRGB
((
float
)
min
);
// this.palette[0];
if
(
ivalue
<
0
)
{
if
(
ivalue
>=
(
this
.
palette
.
length
-
1
))
return
getRGB
((
float
)
max
);
// this.palette[this.palette.length -1];
// return getRGB((float) min); // this.palette[0];
return
new
float
[]
{
(
float
)
this
.
palette
[
0
][
0
],
(
float
)
this
.
palette
[
0
][
1
],
(
float
)
this
.
palette
[
0
][
2
]};
}
if
(
ivalue
>=
(
this
.
palette
.
length
-
1
))
{
// return getRGB((float) max); // this.palette[this.palette.length -1];
return
new
float
[]
{
(
float
)
this
.
palette
[
this
.
palette
.
length
-
1
][
0
],
(
float
)
this
.
palette
[
this
.
palette
.
length
-
1
][
1
],
(
float
)
this
.
palette
[
this
.
palette
.
length
-
1
][
2
]};
}
double
a
=
(
value
-
ivalue
);
// 0..1
double
a
=
(
value
-
ivalue
);
// 0..1
float
[]
rslt
=
{
float
[]
rslt
=
{
(
float
)
(
k
*((
1
-
a
)
*
this
.
palette
[
ivalue
][
0
]
+
a
*
this
.
palette
[
ivalue
+
1
][
0
])),
(
float
)
(
k
*((
1
-
a
)
*
this
.
palette
[
ivalue
][
0
]
+
a
*
this
.
palette
[
ivalue
+
1
][
0
])),
...
...
src/main/java/com/elphel/imagej/gpu/GpuQuad.java
View file @
16b4ece4
...
@@ -1346,7 +1346,7 @@ public class GpuQuad{ // quad camera description
...
@@ -1346,7 +1346,7 @@ public class GpuQuad{ // quad camera description
cuCtxSynchronize
();
cuCtxSynchronize
();
// Call the kernel function
// Call the kernel function
cuLaunchKernel
(
this
.
gpuTileProcessor
.
GPU_IMCLT_ALL_kernel
,
cuLaunchKernel
(
this
.
gpuTileProcessor
.
GPU_IMCLT_ALL_kernel
,
// failed with LWIR
GridFullWarps
[
0
],
GridFullWarps
[
1
],
GridFullWarps
[
2
],
// Grid dimension
GridFullWarps
[
0
],
GridFullWarps
[
1
],
GridFullWarps
[
2
],
// Grid dimension
ThreadsFullWarps
[
0
],
ThreadsFullWarps
[
1
],
ThreadsFullWarps
[
2
],
// Block dimension
ThreadsFullWarps
[
0
],
ThreadsFullWarps
[
1
],
ThreadsFullWarps
[
2
],
// Block dimension
0
,
null
,
// Shared memory size and stream (shared - only dynamic, static is in code)
0
,
null
,
// Shared memory size and stream (shared - only dynamic, static is in code)
...
@@ -2231,7 +2231,8 @@ public class GpuQuad{ // quad camera description
...
@@ -2231,7 +2231,8 @@ public class GpuQuad{ // quad camera description
copyD2H
.
dstPitch
=
width_in_bytes
;
copyD2H
.
dstPitch
=
width_in_bytes
;
copyD2H
.
WidthInBytes
=
width_in_bytes
;
copyD2H
.
WidthInBytes
=
width_in_bytes
;
copyD2H
.
Height
=
3
*
height
;
// /2;
// copyD2H.Height = 3 * height; // /2;
copyD2H
.
Height
=
num_colors
*
height
;
// /2;
cuMemcpy2D
(
copyD2H
);
// run copy
cuMemcpy2D
(
copyD2H
);
// run copy
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
View file @
16b4ece4
...
@@ -2260,12 +2260,34 @@ public class QuadCLT extends QuadCLTCPU {
...
@@ -2260,12 +2260,34 @@ public class QuadCLT extends QuadCLTCPU {
int
out_width
=
gpuQuad
.
getImageWidth
()
+
gpuQuad
.
getDttSize
();
int
out_width
=
gpuQuad
.
getImageWidth
()
+
gpuQuad
.
getDttSize
();
int
out_height
=
gpuQuad
.
getImageHeight
()
+
gpuQuad
.
getDttSize
();
int
out_height
=
gpuQuad
.
getImageHeight
()
+
gpuQuad
.
getDttSize
();
if
(
isLwir
()
&&
colorProcParameters
.
lwir_autorange
)
{
double
rel_low
=
colorProcParameters
.
lwir_low
;
double
rel_high
=
colorProcParameters
.
lwir_high
;
if
(!
Double
.
isNaN
(
getLwirOffset
()))
{
rel_low
-=
getLwirOffset
();
rel_high
-=
getLwirOffset
();
}
double
[]
cold_hot
=
autorange
(
iclt_fimg
,
// iclt_data, // double [][][] iclt_data, // [iQuad][ncol][i] - normally only [][2][] is non-null
rel_low
,
// double hard_cold,// matches data, DC (this.lwir_offset) subtracted
rel_high
,
// double hard_hot, // matches data, DC (this.lwir_offset) subtracted
colorProcParameters
.
lwir_too_cold
,
// double too_cold, // pixels per image
colorProcParameters
.
lwir_too_hot
,
// double too_hot, // pixels per image
1024
);
// int num_bins)
if
(
cold_hot
!=
null
)
{
if
(!
Double
.
isNaN
(
getLwirOffset
()))
{
cold_hot
[
0
]
+=
getLwirOffset
();
cold_hot
[
1
]
+=
getLwirOffset
();
}
}
setColdHot
(
cold_hot
);
// will be used for shifted images and for texture tiles
}
/* Prepare 4-channel images*/
/* Prepare 4-channel images*/
ImagePlus
[]
imps_RGB
=
new
ImagePlus
[
iclt_fimg
.
length
];
ImagePlus
[]
imps_RGB
=
new
ImagePlus
[
iclt_fimg
.
length
];
for
(
int
ncam
=
0
;
ncam
<
iclt_fimg
.
length
;
ncam
++)
{
for
(
int
ncam
=
0
;
ncam
<
iclt_fimg
.
length
;
ncam
++)
{
String
title
=
String
.
format
(
"%s%s-%02d"
,
image_name
,
sAux
(),
ncam
);
String
title
=
String
.
format
(
"%s%s-%02d"
,
image_name
,
sAux
(),
ncam
);
imps_RGB
[
ncam
]
=
linearStackToColor
(
// probably no need to separate and process the second half with quadCLT_aux
imps_RGB
[
ncam
]
=
linearStackToColor
(
// probably no need to separate and process the second half with quadCLT_aux
(!)
clt_parameters
,
clt_parameters
,
colorProcParameters
,
colorProcParameters
,
rgbParameters
,
rgbParameters
,
...
@@ -2284,22 +2306,22 @@ public class QuadCLT extends QuadCLTCPU {
...
@@ -2284,22 +2306,22 @@ public class QuadCLT extends QuadCLTCPU {
if
(
clt_parameters
.
gen_chn_img
||
only4slice
)
{
// save and show 4-slice image
if
(
clt_parameters
.
gen_chn_img
||
only4slice
)
{
// save and show 4-slice image
// combine to a sliced color image
// combine to a sliced color image
// assuming total number of images to be multiple of 4
int
[]
slice_seq
=
{
0
,
1
,
3
,
2
};
//clockwise
// int [] slice_seq = {0,1,3,2}; //clockwise
if
(
imps_RGB
.
length
>
4
)
{
// int [] slice_seq = new int[gpuQuad.getNumCams()]; //results
.length];
slice_seq
=
new
int
[
imps_RGB
.
length
];
int
[]
slice_seq
=
new
int
[
getNumSensors
()];
//results.length];
for
(
int
i
=
0
;
i
<
slice_seq
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
slice_seq
.
length
;
i
++)
{
slice_seq
[
i
]
=
i
;
slice_seq
[
i
]
=
i
^
((
i
>>
1
)
&
1
);
// 0,1,3,2,4,5,7,6, ...
}
}
}
int
width
=
imps_RGB
[
0
].
getWidth
();
int
width
=
imps_RGB
[
0
].
getWidth
();
int
height
=
imps_RGB
[
0
].
getHeight
();
int
height
=
imps_RGB
[
0
].
getHeight
();
ImageStack
array_stack
=
new
ImageStack
(
width
,
height
);
ImageStack
array_stack
=
new
ImageStack
(
width
,
height
);
for
(
int
i
=
0
;
i
<
slice_seq
.
length
;
i
++){
for
(
int
i
=
0
;
i
<
slice_seq
.
length
;
i
++){
/// if (imps_RGB[slice_seq[i]] != null) {
/// if (imps_RGB[slice_seq[i]] != null) {
array_stack
.
addSlice
(
"port_"
+
slice_seq
[
i
],
imps_RGB
[
slice_seq
[
i
]].
getProcessor
().
getPixels
());
array_stack
.
addSlice
(
"port_"
+
slice_seq
[
i
],
imps_RGB
[
slice_seq
[
i
]].
getProcessor
().
getPixels
());
/// } else {
/// } else {
/// array_stack.addSlice("port_"+slice_seq[i], results[slice_seq[i]].getProcessor().getPixels());
/// array_stack.addSlice("port_"+slice_seq[i], results[slice_seq[i]].getProcessor().getPixels());
/// }
/// }
}
}
ImagePlus
imp_stack
=
new
ImagePlus
(
image_name
+
sAux
()+
"-SHIFTED-D"
+
clt_parameters
.
disparity
,
array_stack
);
ImagePlus
imp_stack
=
new
ImagePlus
(
image_name
+
sAux
()+
"-SHIFTED-D"
+
clt_parameters
.
disparity
,
array_stack
);
imp_stack
.
getProcessor
().
resetMinAndMax
();
imp_stack
.
getProcessor
().
resetMinAndMax
();
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
View file @
16b4ece4
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