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
388be26d
Commit
388be26d
authored
Jun 26, 2024
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented saving parameters with the model version, fixed bugs
parent
a8fe8f68
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
113 additions
and
29 deletions
+113
-29
CLTParameters.java
src/main/java/com/elphel/imagej/cameras/CLTParameters.java
+1
-1
Eyesis_Correction.java
.../java/com/elphel/imagej/correction/Eyesis_Correction.java
+46
-26
MultipleExtensionsFileFilter.java
...lphel/imagej/correction/MultipleExtensionsFileFilter.java
+38
-0
ErsCorrection.java
...n/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
+1
-1
IntersceneMatchParameters.java
...lphel/imagej/tileprocessor/IntersceneMatchParameters.java
+1
-1
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+11
-0
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+15
-0
No files found.
src/main/java/com/elphel/imagej/cameras/CLTParameters.java
View file @
388be26d
...
...
@@ -504,7 +504,7 @@ public class CLTParameters {
public
double
gmap_discard_rdisp
=
0.02
;
// discard above/below this fraction of average height
public
double
gmap_pix_size
=
0.005
;
// hdr_x0y0, // in meters
public
int
gmap_max_image_width
=
4000
;
// 3200; // increase pixel size as a power of 2 until image fits
public
double
gmap_min_sfm
=
10.0
;
// minimal SfM gain to keep ground map
public
double
gmap_min_sfm
=
2.0
;
//
10.0; // minimal SfM gain to keep ground map
public
double
gmap_frac_sfm
=
0.25
;
// Disregard SfM mask if lower good SfM area
public
boolean
gmap_crop_empty
=
true
;
public
int
gmap_crop_extra
=
20
;
...
...
src/main/java/com/elphel/imagej/correction/Eyesis_Correction.java
View file @
388be26d
...
...
@@ -436,7 +436,8 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
public
static
int
CONVOLVE_FFT_SIZE
=
128
;
// FFT size for sliding convolution with kernel
public
static
int
THREADS_MAX
=
100
;
// testing multi-threading, limit maximal number of threads
public
double
GAUSS_WIDTH
=
0.4
;
// 0 - use Hamming window
/// public double GAUSS_WIDTH = 0.4; // 0 - use Hamming window
public
static
double
GAUSS_WIDTH
=
0.4
;
// 0 - use Hamming window
/* replace */
public
static
int
PSF_SUBPIXEL_SHOULD_BE_4
=
4
;
// sub-pixel decimation
...
...
@@ -1595,7 +1596,12 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
if
(
label
.
equals
(
"Save Clean"
))
{
PROPERTIES
=
new
Properties
();
}
saveProperties
(
null
,
CORRECTION_PARAMETERS
.
resultsDirectory
,
true
,
PROPERTIES
,
DEBUG_LEVEL
);
saveProperties
(
null
,
CORRECTION_PARAMETERS
.
resultsDirectory
,
true
,
PROPERTIES
,
DEBUG_LEVEL
);
return
;
/* ======================================================================== */
}
else
if
(
label
.
equals
(
"Save offset"
))
{
...
...
@@ -9273,15 +9279,26 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
return
selectDirectoryOrFile
(
save
,
false
,
title
,
button
,
filter
,
defaultPath
);
}
public
String
selectFile
(
boolean
save
,
String
title
,
String
button
,
FileFilter
filter
,
String
defaultPath
)
{
return
selectDirectoryOrFile
(
save
,
false
,
title
,
button
,
filter
,
defaultPath
);
public
static
String
selectFile
(
boolean
save
,
String
title
,
String
button
,
FileFilter
filter
,
String
defaultPath
)
{
return
selectDirectoryOrFile
(
save
,
false
,
title
,
button
,
filter
,
defaultPath
);
}
public
String
[]
selectFiles
(
boolean
save
,
String
title
,
String
button
,
FileFilter
filter
,
String
[]
defaultPaths
)
{
public
static
String
[]
selectFiles
(
boolean
save
,
String
title
,
String
button
,
FileFilter
filter
,
String
[]
defaultPaths
)
{
return
selectDirectoriesOrFiles
(
save
,
false
,
title
,
button
,
filter
,
defaultPaths
);
}
public
String
[]
selectDirectoriesOrFiles
(
boolean
save
,
boolean
directory
,
String
title
,
String
button
,
public
static
String
[]
selectDirectoriesOrFiles
(
boolean
save
,
boolean
directory
,
String
title
,
String
button
,
FileFilter
filter
,
String
[]
defaultPaths
)
{
File
dir
=
null
;
String
defaultPath
=
null
;
...
...
@@ -9352,7 +9369,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
return
filenames
;
}
public
String
selectDirectoryOrFile
(
boolean
save
,
boolean
directory
,
String
title
,
String
button
,
FileFilter
filter
,
public
static
String
selectDirectoryOrFile
(
boolean
save
,
boolean
directory
,
String
title
,
String
button
,
FileFilter
filter
,
String
defaultPath
)
{
File
dir
=
null
;
if
((
defaultPath
!=
null
)
&&
(!
defaultPath
.
equals
(
""
)))
{
...
...
@@ -9392,7 +9409,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
DEFAULT_DIRECTORY
=
fc
.
getCurrentDirectory
().
getPath
();
return
fc
.
getSelectedFile
().
getPath
();
}
/*
class MultipleExtensionsFileFilter extends FileFilter {
protected String[] patterns;
protected String description = "JP4 files";
...
...
@@ -9424,10 +9441,10 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
return description;
}
}
*/
/* ======================================================================== */
private
boolean
fixSliceSequence
(
ImageStack
stack
)
{
private
static
boolean
fixSliceSequence
(
ImageStack
stack
)
{
int
i
,
j
;
int
[]
rgbNumbers
=
{
0
,
0
,
0
};
for
(
j
=
0
;
j
<
3
;
j
++)
{
...
...
@@ -9474,7 +9491,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
}
/* ======================================================================== */
public
void
swapStackSlices
(
ImageStack
stack
,
int
slice1
,
int
slice2
)
{
public
static
void
swapStackSlices
(
ImageStack
stack
,
int
slice1
,
int
slice2
)
{
String
label
=
stack
.
getSliceLabel
(
slice1
);
stack
.
setSliceLabel
(
stack
.
getSliceLabel
(
slice2
),
slice1
);
stack
.
setSliceLabel
(
label
,
slice2
);
...
...
@@ -9484,7 +9501,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
}
/* ======================================================================== */
public
ImageStack
cropStack32
(
ImageStack
stack
,
EyesisCorrectionParameters
.
SplitParameters
splitParameters
)
{
public
static
ImageStack
cropStack32
(
ImageStack
stack
,
EyesisCorrectionParameters
.
SplitParameters
splitParameters
)
{
int
size
=
stack
.
getSize
();
int
iWidth
=
stack
.
getWidth
();
int
height
=
stack
.
getHeight
()
-
splitParameters
.
addTop
-
splitParameters
.
addBottom
;
...
...
@@ -9509,7 +9526,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
}
/* ======================================================================== */
public
ImageStack
rotateStack32CW
(
ImageStack
stack
)
{
public
static
ImageStack
rotateStack32CW
(
ImageStack
stack
)
{
int
size
=
stack
.
getSize
();
int
height
=
stack
.
getHeight
();
int
width
=
stack
.
getWidth
();
...
...
@@ -9532,7 +9549,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
}
/* ======================================================================== */
public
ImagePlus
cropImage32
(
ImagePlus
imp
,
EyesisCorrectionParameters
.
SplitParameters
splitParameters
)
{
public
static
ImagePlus
cropImage32
(
ImagePlus
imp
,
EyesisCorrectionParameters
.
SplitParameters
splitParameters
)
{
int
iWidth
=
imp
.
getWidth
();
int
height
=
imp
.
getHeight
()
-
splitParameters
.
addTop
-
splitParameters
.
addBottom
;
int
width
=
imp
.
getWidth
()
-
splitParameters
.
addLeft
-
splitParameters
.
addRight
;
...
...
@@ -9552,7 +9569,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
}
/* ======================================================================== */
public
ImagePlus
rotateImage32CW
(
ImagePlus
imp
)
{
public
static
ImagePlus
rotateImage32CW
(
ImagePlus
imp
)
{
int
width
=
imp
.
getWidth
();
int
height
=
imp
.
getHeight
();
int
length
=
width
*
height
;
...
...
@@ -9569,7 +9586,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
}
/* ======================================================================== */
public
CompositeImage
convertToComposite
(
ImagePlus
imp
)
{
public
static
CompositeImage
convertToComposite
(
ImagePlus
imp
)
{
// if (imp.isComposite()) return imp;
if
(
imp
.
isComposite
())
return
null
;
...
...
@@ -9585,7 +9602,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
}
/* ======================================================================== */
public
ImageStack
convertRGB32toRGB16Stack
(
ImageStack
stack32
,
public
static
ImageStack
convertRGB32toRGB16Stack
(
ImageStack
stack32
,
EyesisCorrectionParameters
.
RGBParameters
rgbParameters
)
{
ImageStack
stack16
=
new
ImageStack
(
stack32
.
getWidth
(),
stack32
.
getHeight
());
int
length
=
stack32
.
getWidth
()
*
stack32
.
getHeight
();
...
...
@@ -9619,7 +9636,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
}
public
ImagePlus
convertRGB48toRGB24
(
ImageStack
stack16
,
String
title
,
int
r_min
,
int
r_max
,
int
g_min
,
int
g_max
,
public
static
ImagePlus
convertRGB48toRGB24
(
ImageStack
stack16
,
String
title
,
int
r_min
,
int
r_max
,
int
g_min
,
int
g_max
,
int
b_min
,
int
b_max
,
int
alpha_min
,
int
alpha_max
)
{
int
[]
mins
=
{
r_min
,
g_min
,
b_min
,
alpha_min
};
int
[]
maxs
=
{
r_max
,
g_max
,
b_max
,
alpha_max
};
...
...
@@ -9655,7 +9672,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
}
/* ======================================================================== */
public
ImagePlus
Image32toGreyRGB24
(
ImagePlus
imp
)
{
public
static
ImagePlus
Image32toGreyRGB24
(
ImagePlus
imp
)
{
int
width
=
imp
.
getWidth
();
int
height
=
imp
.
getHeight
();
int
length
=
width
*
height
;
...
...
@@ -9684,7 +9701,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
}
/* ======================================================================== */
public
void
saveTimestampedProperties
(
String
path
,
// full path or null
public
static
void
saveTimestampedProperties
(
String
path
,
// full path or null
String
directory
,
// use as default directory if path==null
boolean
useXML
,
Properties
properties
)
{
if
(
path
==
null
)
{
...
...
@@ -9701,7 +9718,8 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
}
public
void
saveProperties
(
String
path
,
// full path or null
public
static
void
saveProperties
(
String
path
,
// full path or null
String
directory
,
// use as default directory if path==null
boolean
useXML
,
Properties
properties
,
...
...
@@ -9709,13 +9727,15 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
String
[]
XMLPatterns
=
{
".corr-xml"
,
".xml"
};
String
[]
confPatterns
=
{
".conf"
};
String
[]
patterns
=
useXML
?
XMLPatterns
:
confPatterns
;
String
ext
=
(
useXML
?
"XML "
:
""
)
+
"Configuration files ("
+
(
useXML
?
"*.corr-xml"
:
"*.conf"
)
+
")"
;
MultipleExtensionsFileFilter
filter
=
new
MultipleExtensionsFileFilter
(
patterns
,
ext
);
// filter
if
(
path
==
null
)
{
path
=
selectFile
(
true
,
// save
"Save configuration selection"
,
// title
"Select configuration file"
,
// button
new
MultipleExtensionsFileFilter
(
patterns
,
(
useXML
?
"XML "
:
""
)
+
"Configuration files ("
+
(
useXML
?
"*.corr-xml"
:
"*.conf"
)
+
")"
),
// filter
filter
,
// filter
directory
);
// may be ""
}
else
path
+=
patterns
[
0
];
...
...
@@ -9898,7 +9918,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
/* ======================================================================== */
public
void
setAllProperties
(
Properties
properties
)
{
public
static
void
setAllProperties
(
Properties
properties
)
{
properties
.
setProperty
(
"MASTER_DEBUG_LEVEL"
,
MASTER_DEBUG_LEVEL
+
""
);
properties
.
setProperty
(
"UPDATE_STATUS"
,
UPDATE_STATUS
+
""
);
SPLIT_PARAMETERS
.
setProperties
(
"SPLIT_PARAMETERS."
,
properties
);
...
...
@@ -9937,7 +9957,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
}
/* ======================================================================== */
public
void
getAllProperties
(
Properties
properties
)
{
public
static
void
getAllProperties
(
Properties
properties
)
{
MASTER_DEBUG_LEVEL
=
Integer
.
parseInt
(
properties
.
getProperty
(
"MASTER_DEBUG_LEVEL"
));
UPDATE_STATUS
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
"UPDATE_STATUS"
));
SPLIT_PARAMETERS
.
getProperties
(
"SPLIT_PARAMETERS."
,
properties
);
...
...
src/main/java/com/elphel/imagej/correction/MultipleExtensionsFileFilter.java
0 → 100644
View file @
388be26d
package
com
.
elphel
.
imagej
.
correction
;
import
java.io.File
;
import
javax.swing.filechooser.FileFilter
;
public
class
MultipleExtensionsFileFilter
extends
FileFilter
{
protected
String
[]
patterns
;
protected
String
description
=
"JP4 files"
;
public
MultipleExtensionsFileFilter
(
String
[]
patterns
,
String
description
)
{
this
.
description
=
description
;
this
.
patterns
=
patterns
.
clone
();
}
public
MultipleExtensionsFileFilter
(
String
[]
patterns
)
{
this
.
patterns
=
patterns
.
clone
();
}
@Override
public
boolean
accept
(
File
file
)
{
int
i
;
String
name
=
file
.
getName
();
if
(
file
.
isDirectory
())
return
true
;
for
(
i
=
0
;
i
<
patterns
.
length
;
i
++)
{
if
(
name
.
toLowerCase
().
endsWith
(
patterns
[
i
].
toLowerCase
()))
return
true
;
}
return
false
;
}
@Override
public
String
getDescription
()
{
return
description
;
}
}
src/main/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
View file @
388be26d
...
...
@@ -1075,7 +1075,7 @@ public class ErsCorrection extends GeometryCorrection {
System
.
arraycopy
(
deltas0
,
0
,
deltas
,
0
,
deltas0
.
length
);
System
.
arraycopy
(
deltas0
,
3
,
deltas
,
deltas0
.
length
,
deltas0
.
length
-
3
);
for
(
int
i
=
0
;
i
<
deltas
.
length
;
i
++)
deltas
[
i
]
*=
scale_delta
;
int
dbg_tile
=
7508
;
// 56:23 // 16629;
int
dbg_tile
=
-
7508
;
// 56:23 // 16629;
ErsCorrection
scene_ers
=
scene_QuadClt
.
getErsCorrection
();
TileProcessor
tp
=
reference_QuadClt
.
getTileProcessor
();
int
tilesX
=
tp
.
getTilesX
();
...
...
src/main/java/com/elphel/imagej/tileprocessor/IntersceneMatchParameters.java
View file @
388be26d
...
...
@@ -65,7 +65,7 @@ public class IntersceneMatchParameters {
public
boolean
sfm_use
=
true
;
// use SfM to improve depth map
public
double
sfm_min_base
=
0.6
;
// 2.0; // use SfM if baseline exceeds this
public
double
sfm_min_gain
=
3
.0
;
// 5.0; // Minimal SfM gain to apply SfM to the depth map
public
double
sfm_min_gain
=
2
.0
;
// 5.0; // Minimal SfM gain to apply SfM to the depth map
public
double
sfm_min_frac
=
0.5
;
// Minimal fraction of defined tiles to have SfM correction
public
int
sfm_num_pairs
=
32
;
// desired number of SfM pairs to average
...
...
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
388be26d
...
...
@@ -6492,6 +6492,17 @@ public class OpticalFlow {
start_ref_pointers
[
0
]
=
earliest_scene
;
start_ref_pointers
[
1
]
=
ref_index
;
}
// temporary fix save/restore linkedModels, sourceDirectory, sourcePaths
// that are copied main-> aux in EyesisCorrectionParameters.updateAuxFromMain()
// quadCLT_main.correctionsParameters
String
bkp_linkedModels
=
quadCLT_main
.
correctionsParameters
.
linkedModels
;
String
bkp_sourceDirectory
=
quadCLT_main
.
correctionsParameters
.
sourceDirectory
;
String
[]
bkp_sourcePaths
=
quadCLT_main
.
correctionsParameters
.
sourcePaths
;
quadCLTs
[
ref_index
].
saveConfInModelDirectory
();
// save all (global) configurations in model/version directory
quadCLT_main
.
correctionsParameters
.
linkedModels
=
bkp_linkedModels
;
quadCLT_main
.
correctionsParameters
.
sourceDirectory
=
bkp_sourceDirectory
;
quadCLT_main
.
correctionsParameters
.
sourcePaths
=
bkp_sourcePaths
;
System
.
out
.
println
(
"buildSeries(): DONE"
);
//
return
quadCLTs
[
ref_index
].
getX3dTopDirectory
();
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
View file @
388be26d
...
...
@@ -4979,6 +4979,21 @@ public class QuadCLTCPU {
return
file_path
;
}
public
String
saveConfInModelDirectory
()
{
String
x3d_path
=
getX3dDirectory
();
String
file_name
=
image_name
+
"-SETTINGS"
;
String
file_path
=
x3d_path
+
Prefs
.
getFileSeparator
()
+
file_name
;
Properties
properties
=
new
Properties
();
Eyesis_Correction
.
saveProperties
(
file_path
,
null
,
true
,
properties
,
0
);
// DEBUG_LEVEL >-3);
return
file_path
;
}
public
String
saveAVIInModelDirectory
(
boolean
dry_run
,
...
...
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