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
4fefd6d1
Commit
4fefd6d1
authored
Sep 30, 2024
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Next working snapshot
parent
e8c48eba
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
15 deletions
+40
-15
VegetationLMA.java
...main/java/com/elphel/imagej/vegetation/VegetationLMA.java
+36
-12
VegetationModel.java
...in/java/com/elphel/imagej/vegetation/VegetationModel.java
+4
-3
No files found.
src/main/java/com/elphel/imagej/vegetation/VegetationLMA.java
View file @
4fefd6d1
...
...
@@ -1011,14 +1011,37 @@ public class VegetationLMA {
}
avg
/=
nn
;
// average
if
(
alpha_push
>
0
)
{
/*
* p = alpha_push
* n = alpha_push_neutral
* a0 = p/(2 * n)
* a1 = p/(2 * (1 - n))
* f1(x) = p/(2 * n)* x * (1 - x/(2*n))
* f2(x) = p * (x - 2*n + 1) * (1 - x) / (4 * (1-n)*(1-n)
* df1(x)/dx = p/(2 * n^2 )*( n - x)
* df2(x)/dx = p* (n-x)/(2*(1-n)^2)
*/
// average including center:
double
sum_w
=
(
nn
+
alpha_push_center
);
double
avg_c
=
(
avg
*
nn
+
vector
[
np
]
*
alpha_push_center
)
/
sum_w
;
double
one_minus_n
=
1.0
-
alpha_push_neutral
;
double
one_minus_p
=
1.0
-
alpha_push
;
double
x_minus_p
=
avg_c
-
alpha_push
;
if
((
avg_c
>
0
)
||
(
avg_c
<
1.0
))
{
fX
[
nx
]
+=
alpha_push
*
avg_c
*
(
1.0
-
avg_c
);
// fX[nx] += alpha_push * avg_c * (1.0 - avg_c);
if
(
avg_c
<=
alpha_push_neutral
)
{
fX
[
nx
]
+=
alpha_push
/
(
2
*
alpha_push_neutral
)
*
avg_c
*
(
1
-
avg_c
/
(
2
*
alpha_push_neutral
));
}
else
{
fX
[
nx
]
+=
alpha_push
*
(
avg_c
-
2
*
alpha_push_neutral
+
1
)
*
(
1
-
avg_c
)
/
(
4
*
one_minus_n
*
one_minus_n
);
}
if
(
jt
!=
null
)
{
double
dd
=
alpha_push
/
sum_w
*
(
1
-
2
*
avg_c
);
// double dd = alpha_push / sum_w * (1 - 2 * avg_c);
double
dd
;
if
(
avg_c
<=
alpha_push_neutral
)
{
dd
=
alpha_push
/
(
sum_w
*
2
*
alpha_push_neutral
*
alpha_push_neutral
)
*
(
alpha_push_neutral
-
avg_c
);
}
else
{
dd
=
alpha_push
/
(
sum_w
*
2
*
one_minus_n
*
one_minus_n
)
*
(
alpha_push_neutral
-
avg_c
);
}
jt
[
np
][
nx
]
+=
dd
*
alpha_push_center
;
// 2 * alpha_loss * d; // d/dalpha[i]
for
(
int
i
=
0
;
i
<
alpha_neibs
[
n
].
length
;
i
++)
{
// now 4, may be increased
int
di
=
alpha_neibs
[
n
][
i
];
...
...
@@ -1030,6 +1053,7 @@ public class VegetationLMA {
}
}
}
}
};
}
ImageDtt
.
startAndJoin
(
threads
);
...
...
src/main/java/com/elphel/imagej/vegetation/VegetationModel.java
View file @
4fefd6d1
...
...
@@ -679,6 +679,7 @@ public class VegetationModel {
boolean
diff_mode
=
true
;
// Rectangle woi50 = new Rectangle(143,317,35,35);
Rectangle
woi50
=
new
Rectangle
(
160
,
317
,
35
,
35
);
// X+17
// Rectangle woi50 = new Rectangle(177,317,35,35); // X+34
/* Bad, pull terr lower, so it all shifts to terrain
int min_scenes = 10;
double default_alpha = 0.8;
...
...
@@ -708,11 +709,11 @@ public class VegetationModel {
double
reg_weights
=
0.25
;
// fraction of the total weight used for regularization
double
alpha_loss
=
100.0
;
// 10.0; /// 100.0; // 10.0; // 10000.0; // 1000.0; // 100.; // 10.0; // quadratic loss when alpha reaches -1.0 or 2.0
double
alpha_offset
=
0.0
;
// 0.02; // 0.03; // if >0, start losses above 0.0 and below 1.0;
double
alpha_lpf
=
5
;
/// 10; /// 15; // 10.0; // 5.0; // 10.0; // 3; // 10; // 20; // 6.0; // 3.0; // 2.0; // 1.5; // 5.0; // 0.5; // pull to average of 4 neighbors
double
alpha_lpf
=
2
;
//
5; /// 10; /// 15; // 10.0; // 5.0; // 10.0; // 3; // 10; // 20; // 6.0; // 3.0; // 2.0; // 1.5; // 5.0; // 0.5; // pull to average of 4 neighbors
boolean
alpha_piece_linear
=
true
;
// false; // true;
double
alpha_scale_avg
=
1.0
;
// 1.1; // 0.9; // 2.0; // 1.5; // scale average alpha (around 0.5) when pulling to it
double
alpha_push
=
12
;
// 10.0; // 15.0; // push from alpha==0.5
double
alpha_push_neutral
=
0.8
;
// alpha point from which push (closer to opaque)
double
alpha_push_neutral
=
0.
5
;
// 0.6; // 0.
8; // alpha point from which push (closer to opaque)
double
alpha_push_center
=
1.5
;
// weight of center alpha pixel relative to each of the 4 ortho ones
double
alpha_mm_hole
=
0.1
;
// NaN to disable. Local "almost minimum" (lower than this fraction between min and max neighbor) is not subject to alpha_lpf
...
...
@@ -857,7 +858,7 @@ public class VegetationModel {
double
lambda_max
=
1000
;
boolean
last_run
=
false
;
double
rms_diff
=
1
e
-
8
;
// 0.0001; virtually forever
int
num_iter
=
100
;
int
num_iter
=
30
;
//
100;
vegetationLMA
.
debug_index
=
0
;
vegetationLMA
.
debug_image
=
new
double
[
num_iter
][];
...
...
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