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
dc4e1f60
Commit
dc4e1f60
authored
Feb 29, 2020
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated tested GPU image conversion with selectable kernel source
parent
ed43abc2
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
796 additions
and
10 deletions
+796
-10
EyesisCorrectionParameters.java
...com/elphel/imagej/cameras/EyesisCorrectionParameters.java
+17
-2
Eyesis_Correction.java
.../java/com/elphel/imagej/correction/Eyesis_Correction.java
+1
-1
GPUTileProcessor.java
src/main/java/com/elphel/imagej/gpu/GPUTileProcessor.java
+10
-2
JCuda_ImageJ_Example_Plugin.java
...va/com/elphel/imagej/gpu/JCuda_ImageJ_Example_Plugin.java
+0
-2
TwoQuadCLT.java
...main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
+7
-3
dtt8x8.cuh
src/main/resources/dtt8x8.cuh
+761
-0
No files found.
src/main/java/com/elphel/imagej/cameras/EyesisCorrectionParameters.java
View file @
dc4e1f60
...
@@ -85,6 +85,7 @@ public class EyesisCorrectionParameters {
...
@@ -85,6 +85,7 @@ public class EyesisCorrectionParameters {
public
boolean
equirectangular
=
true
;
public
boolean
equirectangular
=
true
;
public
boolean
zcorrect
=
true
;
public
boolean
zcorrect
=
true
;
public
boolean
saveSettings
=
true
;
public
boolean
saveSettings
=
true
;
public
String
tile_processor_gpu
=
""
;
// absolute path to tile_processor_gpu project or empty to use default GPU kernels
public
String
[]
sourcePaths
=
{};
public
String
[]
sourcePaths
=
{};
// public String [] sourceSetPaths= {}; // 2019 - directories with image sets
// public String [] sourceSetPaths= {}; // 2019 - directories with image sets
...
@@ -909,6 +910,9 @@ public class EyesisCorrectionParameters {
...
@@ -909,6 +910,9 @@ public class EyesisCorrectionParameters {
gd
.
addTab
(
"File paths"
,
"Select files and directories paths (common to main and optional auxiliary)"
);
gd
.
addTab
(
"File paths"
,
"Select files and directories paths (common to main and optional auxiliary)"
);
gd
.
addMessage
(
"============ Common to the main and optional auxiliary camera============"
);
gd
.
addMessage
(
"============ Common to the main and optional auxiliary camera============"
);
gd
.
addStringField
(
"GPU tile_processor_gpu project absolute path"
,
this
.
tile_processor_gpu
,
60
,
"Keep empty to use default GPU kernels"
);
gd
.
addCheckbox
(
"Select GPU directory"
,
false
);
gd
.
addCheckbox
(
"Save current settings with results"
,
this
.
saveSettings
);
// 1
gd
.
addCheckbox
(
"Save current settings with results"
,
this
.
saveSettings
);
// 1
gd
.
addStringField
(
"Source files directory"
,
this
.
sourceDirectory
,
60
);
// 2
gd
.
addStringField
(
"Source files directory"
,
this
.
sourceDirectory
,
60
);
// 2
...
@@ -1022,9 +1026,9 @@ public class EyesisCorrectionParameters {
...
@@ -1022,9 +1026,9 @@ public class EyesisCorrectionParameters {
gd
.
showDialog
();
gd
.
showDialog
();
if
(
gd
.
wasCanceled
())
return
false
;
if
(
gd
.
wasCanceled
())
return
false
;
this
.
tile_processor_gpu
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectGPUSourceDirectory
(
false
,
false
);
this
.
saveSettings
=
gd
.
getNextBoolean
();
// 1
this
.
saveSettings
=
gd
.
getNextBoolean
();
// 1
this
.
sourceDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectSourceDirectory
(
false
,
false
);
// 3
this
.
sourceDirectory
=
gd
.
getNextString
();
if
(
gd
.
getNextBoolean
())
selectSourceDirectory
(
false
,
false
);
// 3
this
.
use_set_dirs
=
gd
.
getNextBoolean
();
this
.
use_set_dirs
=
gd
.
getNextBoolean
();
...
@@ -1760,6 +1764,17 @@ public class EyesisCorrectionParameters {
...
@@ -1760,6 +1764,17 @@ public class EyesisCorrectionParameters {
if
(
dir
!=
null
)
this
.
sourceDirectory
=
dir
;
if
(
dir
!=
null
)
this
.
sourceDirectory
=
dir
;
return
dir
;
return
dir
;
}
}
public
String
selectGPUSourceDirectory
(
boolean
smart
,
boolean
newAllowed
)
{
// normally newAllowed=false
String
dir
=
CalibrationFileManagement
.
selectDirectory
(
smart
,
newAllowed
,
// save
"GPU kernel development project"
,
// title
"Select GPU project directory"
,
// button
null
,
// filter
this
.
tile_processor_gpu
);
// this.sourceDirectory);
if
(
dir
!=
null
)
this
.
tile_processor_gpu
=
dir
;
return
dir
;
}
public
String
selectSensorDirectory
(
boolean
smart
,
boolean
newAllowed
)
{
public
String
selectSensorDirectory
(
boolean
smart
,
boolean
newAllowed
)
{
String
dir
=
CalibrationFileManagement
.
selectDirectory
(
String
dir
=
CalibrationFileManagement
.
selectDirectory
(
smart
,
smart
,
...
...
src/main/java/com/elphel/imagej/correction/Eyesis_Correction.java
View file @
dc4e1f60
...
@@ -5784,7 +5784,7 @@ private Panel panel1,
...
@@ -5784,7 +5784,7 @@ private Panel panel1,
}
}
if
(
GPU_TILE_PROCESSOR
==
null
)
{
if
(
GPU_TILE_PROCESSOR
==
null
)
{
try
{
try
{
GPU_TILE_PROCESSOR
=
new
GPUTileProcessor
();
GPU_TILE_PROCESSOR
=
new
GPUTileProcessor
(
CORRECTION_PARAMETERS
.
tile_processor_gpu
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Failed to initialize GPU class"
);
System
.
out
.
println
(
"Failed to initialize GPU class"
);
// TODO Auto-generated catch block
// TODO Auto-generated catch block
...
...
src/main/java/com/elphel/imagej/gpu/GPUTileProcessor.java
View file @
dc4e1f60
...
@@ -240,7 +240,7 @@ public class GPUTileProcessor {
...
@@ -240,7 +240,7 @@ public class GPUTileProcessor {
return
new
PointerWithAddress
(
p
).
getAddress
();
return
new
PointerWithAddress
(
p
).
getAddress
();
}
}
public
GPUTileProcessor
()
throws
IOException
public
GPUTileProcessor
(
String
cuda_project_directory
)
throws
IOException
{
{
// From code by Marco Hutter - http://www.jcuda.org
// From code by Marco Hutter - http://www.jcuda.org
// Enable exceptions and omit all subsequent error checks
// Enable exceptions and omit all subsequent error checks
...
@@ -276,7 +276,15 @@ public class GPUTileProcessor {
...
@@ -276,7 +276,15 @@ public class GPUTileProcessor {
"#define IMCLT_TILES_PER_BLOCK "
+
IMCLT_TILES_PER_BLOCK
+
"\n"
;
"#define IMCLT_TILES_PER_BLOCK "
+
IMCLT_TILES_PER_BLOCK
+
"\n"
;
for
(
String
src_file:
GPU_KERNEL_FILES
)
{
for
(
String
src_file:
GPU_KERNEL_FILES
)
{
File
file
=
new
File
(
classLoader
.
getResource
(
src_file
).
getFile
());
File
file
=
null
;
if
((
cuda_project_directory
==
null
)
||
(
cuda_project_directory
==
""
))
{
file
=
new
File
(
classLoader
.
getResource
(
src_file
).
getFile
());
System
.
out
.
println
(
"Loading resource "
+
file
);
}
else
{
File
src_dir
=
new
File
(
cuda_project_directory
,
"src"
);
file
=
new
File
(
src_dir
.
getPath
(),
src_file
);
System
.
out
.
println
(
"Loading resource "
+
file
);
}
System
.
out
.
println
(
file
.
getAbsolutePath
());
System
.
out
.
println
(
file
.
getAbsolutePath
());
String
cuFileName
=
file
.
getAbsolutePath
();
// /home/eyesis/workspace-python3/nvidia_dct8x8/src/dtt8x8.cuh";// "dtt8x8.cuh";
String
cuFileName
=
file
.
getAbsolutePath
();
// /home/eyesis/workspace-python3/nvidia_dct8x8/src/dtt8x8.cuh";// "dtt8x8.cuh";
String
sourceFile
=
readFileAsString
(
cuFileName
);
// readResourceAsString(cuFileName);
String
sourceFile
=
readFileAsString
(
cuFileName
);
// readResourceAsString(cuFileName);
...
...
src/main/java/com/elphel/imagej/gpu/JCuda_ImageJ_Example_Plugin.java
View file @
dc4e1f60
...
@@ -206,8 +206,6 @@ public class JCuda_ImageJ_Example_Plugin implements PlugInFilter
...
@@ -206,8 +206,6 @@ public class JCuda_ImageJ_Example_Plugin implements PlugInFilter
*/
*/
private
static
String
readResourceAsString
(
String
name
)
private
static
String
readResourceAsString
(
String
name
)
{
{
int
a
=
0
;
Class
ccc
=
JCuda_ImageJ_Example_Plugin
.
class
;
InputStream
inputStream
=
InputStream
inputStream
=
JCuda_ImageJ_Example_Plugin
.
class
.
getResourceAsStream
(
name
);
JCuda_ImageJ_Example_Plugin
.
class
.
getResourceAsStream
(
name
);
if
(
inputStream
==
null
)
if
(
inputStream
==
null
)
...
...
src/main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
View file @
dc4e1f60
...
@@ -1920,6 +1920,7 @@ public class TwoQuadCLT {
...
@@ -1920,6 +1920,7 @@ public class TwoQuadCLT {
String
[]
rgb_titles
=
{
"red"
,
"blue"
,
"green"
};
String
[]
rgb_titles
=
{
"red"
,
"blue"
,
"green"
};
int
out_width
=
GPUTileProcessor
.
IMG_WIDTH
+
GPUTileProcessor
.
DTT_SIZE
;
int
out_width
=
GPUTileProcessor
.
IMG_WIDTH
+
GPUTileProcessor
.
DTT_SIZE
;
int
out_height
=
GPUTileProcessor
.
IMG_HEIGHT
+
GPUTileProcessor
.
DTT_SIZE
;
int
out_height
=
GPUTileProcessor
.
IMG_HEIGHT
+
GPUTileProcessor
.
DTT_SIZE
;
/*
for (int ncam = 0; ncam < iclt_fimg.length; ncam++) {
for (int ncam = 0; ncam < iclt_fimg.length; ncam++) {
String title=name+"-RBG"+String.format("%02d", ncam);
String title=name+"-RBG"+String.format("%02d", ncam);
...
@@ -1931,7 +1932,7 @@ public class TwoQuadCLT {
...
@@ -1931,7 +1932,7 @@ public class TwoQuadCLT {
title,
title,
rgb_titles);
rgb_titles);
}
}
*/
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
=
name
+
"-"
+
String
.
format
(
"%02d"
,
ncam
);
String
title
=
name
+
"-"
+
String
.
format
(
"%02d"
,
ncam
);
...
@@ -2081,9 +2082,12 @@ public class TwoQuadCLT {
...
@@ -2081,9 +2082,12 @@ public class TwoQuadCLT {
double_stacks_main
[
i
][
2
][
j
]*=
0.5
;
// Scale green 0.5 to compensate more pixels than R,B
double_stacks_main
[
i
][
2
][
j
]*=
0.5
;
// Scale green 0.5 to compensate more pixels than R,B
}
}
}
}
for
(
int
i
=
0
;
i
<
double_stacks_aux
.
length
;
i
++){
for
(
int
i
=
0
;
i
<
double_stacks_aux
.
length
;
i
++){
for
(
int
j
=
0
;
j
<
double_stacks_aux
[
i
][
0
].
length
;
j
++){
if
(
double_stacks_aux
[
i
].
length
>
2
)
{
// skip for monochrome, only if color
double_stacks_aux
[
i
][
2
][
j
]*=
0.5
;
// Scale green 0.5 to compensate more pixels than R,B
for
(
int
j
=
0
;
j
<
double_stacks_aux
[
i
][
0
].
length
;
j
++){
double_stacks_aux
[
i
][
2
][
j
]*=
0.5
;
// Scale green 0.5 to compensate more pixels than R,B
}
}
}
}
}
quadCLT_main
.
setTiles
(
imp_quad_main
[
0
],
// set global tp.tilesX, tp.tilesY
quadCLT_main
.
setTiles
(
imp_quad_main
[
0
],
// set global tp.tilesX, tp.tilesY
...
...
src/main/resources/dtt8x8.cuh
0 → 100644
View file @
dc4e1f60
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