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
3ddc661d
Commit
3ddc661d
authored
Jul 04, 2019
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Getting processed LWIR images
parent
adf9d12f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
11 deletions
+93
-11
ThermalColor.java
src/main/java/com/elphel/imagej/cameras/ThermalColor.java
+5
-4
EyesisCorrections.java
.../java/com/elphel/imagej/correction/EyesisCorrections.java
+51
-0
QuadCLT.java
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
+37
-7
No files found.
src/main/java/com/elphel/imagej/cameras/ThermalColor.java
View file @
3ddc661d
...
...
@@ -26,11 +26,11 @@ public class ThermalColor {
public
double
[]
getRGB
(
double
v
)
{
// Get R,G,B (0..255) triplet for input value in the range 0..1
double
k
=
out_range
/
PALETTE_RANGE
;
double
value
=
(
v
-
min
)/(
max
-
min
);
int
ivalue
=
(
int
)
(
value
/(
this
.
palette
.
length
-
1
)
);
double
value
=
(
v
-
min
)/(
max
-
min
)
*
(
this
.
palette
.
length
-
1
)
;
int
ivalue
=
(
int
)
(
value
);
if
(
ivalue
<
0
)
return
this
.
palette
[
0
];
if
(
ivalue
>=
(
this
.
palette
.
length
-
1
))
return
this
.
palette
[
this
.
palette
.
length
-
1
];
double
a
=
(
value
-
ivalue
)
*(
this
.
palette
.
length
-
1
)
;
// 0..1
double
a
=
(
value
-
ivalue
);
// 0..1
double
[]
rslt
=
{
k
*((
1
-
a
)
*
this
.
palette
[
ivalue
][
0
]
+
a
*
this
.
palette
[
ivalue
+
1
][
0
]),
k
*((
1
-
a
)
*
this
.
palette
[
ivalue
][
1
]
+
a
*
this
.
palette
[
ivalue
+
1
][
1
]),
...
...
@@ -97,7 +97,8 @@ public class ThermalColor {
0xfff285
,
0xfff28a
,
0xfff38e
,
0xfff492
,
0xfff496
,
0xfff49a
,
0xfff59e
,
0xfff5a2
,
0xfff5a6
,
0xfff6aa
,
0xfff6af
,
0xfff7b3
,
0xfff7b6
,
0xfff8ba
,
0xfff8bd
,
0xfff8c1
,
0xfff8c4
,
0xfff9c7
,
0xfff9ca
,
0xfff9cd
,
0xfffad1
,
0xfffad4
,
0xfffbd8
,
0xfffcdb
,
0xfffcdf
,
0xfffde2
,
0xfffde5
,
0xfffde8
,
0xfffeeb
,
0xfffeee
,
0xfffef1
,
0xfffef4
,
0xfffff
};
0xfffcdf
,
0xfffde2
,
0xfffde5
,
0xfffde8
,
0xfffeeb
,
0xfffeee
,
0xfffef1
,
0xfffef4
,
0xffffff
};
int
[][]
palettes
=
{
white_hot_palette
,
black_hot_palette
,
iron_palette
};
if
(
indx
<
0
)
indx
=
0
;
else
if
(
indx
>=
palettes
.
length
)
indx
=
palettes
.
length
-
1
;
...
...
src/main/java/com/elphel/imagej/correction/EyesisCorrections.java
View file @
3ddc661d
...
...
@@ -1838,6 +1838,57 @@ public class EyesisCorrections {
return
imp
;
}
public
static
ImagePlus
convertRGBAFloatToRGBA32
(
ImageStack
stackFloat
,
//r,g,b,a
String
title
,
double
r_min
,
double
r_max
,
double
g_min
,
double
g_max
,
double
b_min
,
double
b_max
,
double
alpha_min
,
double
alpha_max
){
double
[]
mins
=
{
r_min
,
g_min
,
b_min
,
alpha_min
};
double
[]
maxs
=
{
r_max
,
g_max
,
b_max
,
alpha_max
};
int
i
;
int
length
=
stackFloat
.
getWidth
()*
stackFloat
.
getHeight
();
int
numSlices
=
stackFloat
.
getSize
();
if
(
numSlices
>
4
)
numSlices
=
4
;
float
[][]
fpixels
=
new
float
[
numSlices
][];
int
[]
sliceSeq
=
new
int
[
numSlices
];
for
(
int
j
=
0
;
j
<
numSlices
;
j
++)
sliceSeq
[
j
]
=
(
j
+
((
numSlices
>
3
)?
3
:
0
))
%
4
;
int
[]
pixels
=
new
int
[
length
];
int
c
,
d
;
double
[]
scale
=
new
double
[
numSlices
];
for
(
c
=
0
;
c
<
numSlices
;
c
++)
{
scale
[
c
]=
256.0
/(
maxs
[
c
]-
mins
[
c
]);
}
for
(
i
=
0
;
i
<
numSlices
;
i
++)
{
fpixels
[
i
]=
(
float
[])
stackFloat
.
getPixels
(
i
+
1
);
}
for
(
i
=
0
;
i
<
length
;
i
++)
{
pixels
[
i
]=
0
;
for
(
int
j
=
0
;
j
<
numSlices
;
j
++)
{
c
=
sliceSeq
[
j
];
d
=(
int
)((
fpixels
[
c
][
i
]-
mins
[
c
])*
scale
[
c
]);
if
(
d
>
255
)
d
=
255
;
else
if
(
d
<
0
)
d
=
0
;
pixels
[
i
]=
d
|
(
pixels
[
i
]
<<
8
);
}
}
ColorProcessor
cp
=
new
ColorProcessor
(
stackFloat
.
getWidth
(),
stackFloat
.
getHeight
());
cp
.
setPixels
(
pixels
);
ImagePlus
imp
=
new
ImagePlus
(
title
,
cp
);
return
imp
;
}
public
ImageStack
convertRGB48toRGBA24Stack
(
ImageStack
stack16
,
double
[]
dalpha
,
// alpha pixel array 0..1.0 or null
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
View file @
3ddc661d
...
...
@@ -4505,6 +4505,10 @@ public class QuadCLT {
}
}
if
(
isLwir
())
{
String
[]
rgb_titles
=
{
"red"
,
"green"
,
"blue"
};
String
[]
rgba_titles
=
{
"red"
,
"green"
,
"blue"
,
"alpha"
};
String
[]
titles
=
(
alpha
==
null
)
?
rgb_titles
:
rgba_titles
;
int
num_slices
=
(
alpha
==
null
)
?
3
:
4
;
double
offset
=
getLwirOffset
();
double
mn
=
colorProcParameters
.
lwir_low
-
offset
;
double
mx
=
colorProcParameters
.
lwir_high
-
offset
;
...
...
@@ -4513,13 +4517,38 @@ public class QuadCLT {
mn
,
mx
,
255.0
);
rbg_in
=
new
double
[
3
][
iclt_data
[
green_index
].
length
];
for
(
int
i
=
0
;
i
<
rbg_in
[
0
].
length
;
i
++)
{
double
[][]
rgba
=
new
double
[
num_slices
][];
for
(
int
i
=
0
;
i
<
3
;
i
++)
rgba
[
i
]
=
new
double
[
iclt_data
[
green_index
].
length
];
for
(
int
i
=
0
;
i
<
rbg_in
[
green_index
].
length
;
i
++)
{
if
(
i
==
700
)
{
System
.
out
.
println
(
"linearStackToColor(): i="
+
i
);
}
double
[]
rgb
=
tc
.
getRGB
(
iclt_data
[
green_index
][
i
]);
rbg_in
[
0
][
i
]
=
rgb
[
0
];
// red
rbg_in
[
1
][
i
]
=
rgb
[
2
];
// blue
rbg_in
[
2
][
i
]
=
rgb
[
1
];
// green
}
rgba
[
0
][
i
]
=
rgb
[
0
];
// red
rgba
[
1
][
i
]
=
rgb
[
1
];
// green
rgba
[
2
][
i
]
=
rgb
[
2
];
// blue
}
if
(
alpha
!=
null
)
{
rgba
[
3
]
=
alpha
;
// 0..1
}
ImageStack
stack
=
sdfa_instance
.
makeStack
(
rgba
,
// iclt_data,
width
,
// (tilesX + 0) * clt_parameters.transform_size,
height
,
// (tilesY + 0) * clt_parameters.transform_size,
titles
,
// or use null to get chn-nn slice names
true
);
// replace NaN with 0.0
ImagePlus
imp_rgba
=
EyesisCorrections
.
convertRGBAFloatToRGBA32
(
stack
,
// ImageStack stackFloat, //r,g,b,a
name
+
"ARGB"
+
suffix
,
// String title,
0.0
,
// double r_min,
255.0
,
// double r_max,
0.0
,
// double g_min,
255.0
,
// double g_max,
0.0
,
// double b_min,
255.0
,
// double b_max,
0.0
,
// double alpha_min,
1.0
);
// double alpha_max)
return
imp_rgba
;
}
ImageStack
stack
=
sdfa_instance
.
makeStack
(
...
...
@@ -4659,6 +4688,7 @@ public class QuadCLT {
titleFull
=
name
+
"-YPrPb"
+
suffix
;
if
(
debugLevel
>
1
)
System
.
out
.
println
(
"Using full stack, including YPbPr"
);
}
if
(
alpha_pixels
!=
null
){
stack
.
addSlice
(
"alpha"
,
alpha_pixels
);
}
...
...
@@ -8178,7 +8208,7 @@ public class QuadCLT {
texture_overlap
[
alpha_index
][
i
]
=
d
;
}
}
// for now - use just RGB. Later add op
r
ion for RGBA
// for now - use just RGB. Later add op
t
ion for RGBA
double
[][]
texture_rgb
=
{
texture_overlap
[
0
],
texture_overlap
[
1
],
texture_overlap
[
2
]};
double
[][]
texture_rgba
=
{
texture_overlap
[
0
],
texture_overlap
[
1
],
texture_overlap
[
2
],
texture_overlap
[
3
]};
double
[][]
texture_rgbx
=
((
clt_parameters
.
alpha1
>
0
)?
texture_rgba:
texture_rgb
);
...
...
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