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
71215e97
Commit
71215e97
authored
Dec 22, 2016
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more on factorization
parent
4754c088
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
19 deletions
+23
-19
Eyesis_Correction.java
src/main/java/Eyesis_Correction.java
+2
-2
FactorConvKernel.java
src/main/java/FactorConvKernel.java
+21
-17
No files found.
src/main/java/Eyesis_Correction.java
View file @
71215e97
...
@@ -2835,8 +2835,8 @@ private Panel panel1,panel2,panel3,panel4,panel5,panel5a, panel6,panel7,panelPos
...
@@ -2835,8 +2835,8 @@ private Panel panel1,panel2,panel3,panel4,panel5,panel5a, panel6,panel7,panelPos
factorConvKernel
.
setDebugLevel
(
DEBUG_LEVEL
);
factorConvKernel
.
setDebugLevel
(
DEBUG_LEVEL
);
factorConvKernel
.
numIterations
=
DCT_PARAMETERS
.
LMA_steps
;
factorConvKernel
.
numIterations
=
DCT_PARAMETERS
.
LMA_steps
;
factorConvKernel
.
setCompactnessWeight
(
DCT_PARAMETERS
.
compactness
);
factorConvKernel
.
setCompactnessWeight
(
DCT_PARAMETERS
.
compactness
);
//// int target_kernel_size = 2*DCT_PARAMETERS.dct_size + DCT_PARAMETERS.asym_size -1;
int
target_kernel_size
=
2
*
DCT_PARAMETERS
.
dct_size
+
DCT_PARAMETERS
.
asym_size
-
1
;
int
target_kernel_size
=
2
*
DCT_PARAMETERS
.
dct_size
+
DCT_PARAMETERS
.
asym_size
-
2
;
double
[]
target_kernel
=
new
double
[
target_kernel_size
*
target_kernel_size
];
double
[]
target_kernel
=
new
double
[
target_kernel_size
*
target_kernel_size
];
for
(
int
ii
=
0
;
ii
<
target_kernel
.
length
;
ii
++)
target_kernel
[
ii
]=
0.0
;
for
(
int
ii
=
0
;
ii
<
target_kernel
.
length
;
ii
++)
target_kernel
[
ii
]=
0.0
;
// for (int ii = -2; ii<=2; ii++) {
// for (int ii = -2; ii<=2; ii++) {
...
...
src/main/java/FactorConvKernel.java
View file @
71215e97
...
@@ -150,8 +150,8 @@ public class FactorConvKernel {
...
@@ -150,8 +150,8 @@ public class FactorConvKernel {
private
double
[]
setInitialVector
(
private
double
[]
setInitialVector
(
double
[]
target_kernel
)
// should be (asym_size + 2*sym_radius-1)**2
double
[]
target_kernel
)
// should be (asym_size + 2*sym_radius-1)**2
{
{
int
conv_size
=
asym_size
+
2
*
sym_radius
-
1
;
//
int conv_size = asym_size + 2*sym_radius-1;
// int sym_size = 2*sym_radius - 1
;
int
conv_size
=
asym_size
+
2
*
sym_radius
-
2
;
int
sym_rad_m1
=
sym_radius
-
1
;
// 7
int
sym_rad_m1
=
sym_radius
-
1
;
// 7
// find center of the target kernel squared value
// find center of the target kernel squared value
double
s0
=
0.0
,
sx
=
0.0
,
sy
=
0.0
;
double
s0
=
0.0
,
sx
=
0.0
,
sy
=
0.0
;
...
@@ -170,7 +170,8 @@ public class FactorConvKernel {
...
@@ -170,7 +170,8 @@ public class FactorConvKernel {
int
j0
=
(
int
)
Math
.
round
(
sx
/
s0
-
sym_rad_m1
);
// should be ~ async_center
int
j0
=
(
int
)
Math
.
round
(
sx
/
s0
-
sym_rad_m1
);
// should be ~ async_center
int
i0
=
(
int
)
Math
.
round
(
sy
/
s0
-
sym_rad_m1
);
// should be ~ async_center
int
i0
=
(
int
)
Math
.
round
(
sy
/
s0
-
sym_rad_m1
);
// should be ~ async_center
if
(
debugLevel
>
1
){
if
(
debugLevel
>
1
){
System
.
out
.
println
(
"setInitialVector(): fi0 = "
+(
sy
/
s0
-
sym_radius
)+
" fj0 = "
+(
sx
/
s0
-
sym_radius
));
System
.
out
.
println
(
"setInitialVector(): conv_size = "
+
conv_size
+
" fj0 = "
+(
sx
/
s0
-
sym_radius
));
System
.
out
.
println
(
"setInitialVector(): fi0 = "
+(
sy
/
s0
-
sym_radius
)+
" asym_size = "
+
asym_size
+
" sym_radius = "
+
sym_radius
);
System
.
out
.
println
(
"setInitialVector(): i0 = "
+
i0
+
" j0 = "
+
j0
+
" asym_size="
+
asym_size
);
System
.
out
.
println
(
"setInitialVector(): i0 = "
+
i0
+
" j0 = "
+
j0
+
" asym_size="
+
asym_size
);
}
}
// fit i0,j0 to asym_kernel (it should be larger)
// fit i0,j0 to asym_kernel (it should be larger)
...
@@ -245,10 +246,12 @@ public class FactorConvKernel {
...
@@ -245,10 +246,12 @@ public class FactorConvKernel {
private
double
[]
convKernels
(
private
double
[]
convKernels
(
double
[]
kvect
)
// first - all elements of sym kernel but [0] (replaced by 1.0), then - asym ones
double
[]
kvect
)
// first - all elements of sym kernel but [0] (replaced by 1.0), then - asym ones
{
{
int
conv_size
=
asym_size
+
2
*
sym_radius
-
1
;
//// int conv_size = asym_size + 2*sym_radius-1;
double
[]
conv_data
=
new
double
[
conv_size
*
conv_size
];
int
conv_size
=
asym_size
+
2
*
sym_radius
-
2
;
// int asym_start= (2 * sym_radius - 1) * (2 * sym_radius - 1)-1;
int
asym_start
=
sym_radius
*
sym_radius
-
1
;
int
asym_start
=
sym_radius
*
sym_radius
-
1
;
int
sym_radius_m1
=
sym_radius
-
1
;
double
[]
conv_data
=
new
double
[
conv_size
*
conv_size
];
if
(
this
.
debugLevel
>
2
){
if
(
this
.
debugLevel
>
2
){
System
.
out
.
println
(
"convKernels(): vector_length= "
+
kvect
.
length
);
System
.
out
.
println
(
"convKernels(): vector_length= "
+
kvect
.
length
);
System
.
out
.
println
(
"convKernels(): sym_radius= "
+
sym_radius
);
System
.
out
.
println
(
"convKernels(): sym_radius= "
+
sym_radius
);
...
@@ -258,14 +261,15 @@ public class FactorConvKernel {
...
@@ -258,14 +261,15 @@ public class FactorConvKernel {
System
.
out
.
println
(
"convKernels(): asym_start= "
+
asym_start
);
System
.
out
.
println
(
"convKernels(): asym_start= "
+
asym_start
);
}
}
for
(
int
i
=
0
;
i
<
conv_data
.
length
;
i
++)
conv_data
[
i
]
=
0.0
;
for
(
int
i
=
0
;
i
<
conv_data
.
length
;
i
++)
conv_data
[
i
]
=
0.0
;
for
(
int
i
=
-
sym_radius
+
1
;
i
<
sym_radius
;
i
++)
{
for
(
int
i
=
-
sym_radius
_m1
;
i
<=
sym_radius_m1
;
i
++)
{
for
(
int
j
=
-
sym_radius
+
1
;
j
<
sym_radius
;
j
++)
{
for
(
int
j
=
-
sym_radius
_m1
;
j
<=
sym_radius_m1
;
j
++)
{
int
indx
=
((
i
<
0
)?
-
i
:
i
)
*
sym_radius
+
((
j
<
0
)?
-
j
:
j
);
int
indx
=
((
i
<
0
)?
-
i
:
i
)
*
sym_radius
+
((
j
<
0
)?
-
j
:
j
);
double
sd
=
(
indx
>
0
)?
kvect
[
indx
-
1
]
:
1.0
;
double
sd
=
(
indx
>
0
)?
kvect
[
indx
-
1
]
:
1.0
;
int
base_indx
=
conv_size
*
(
i
+
sym_radius
-
1
)
+
(
j
+
sym_radius
-
1
);
int
base_indx
=
conv_size
*
(
i
+
sym_radius
_m1
)
+
(
j
+
sym_radius_m
1
);
for
(
int
ia
=
0
;
ia
<
asym_size
;
ia
++)
{
for
(
int
ia
=
0
;
ia
<
asym_size
;
ia
++)
{
for
(
int
ja
=
0
;
ja
<
asym_size
;
ja
++)
{
for
(
int
ja
=
0
;
ja
<
asym_size
;
ja
++)
{
conv_data
[
base_indx
+
conv_size
*
ia
+
ja
]
+=
sd
*
kvect
[
asym_size
*
ia
+
ja
+
asym_start
];
int
async_index
=
asym_size
*
ia
+
ja
+
asym_start
;
conv_data
[
base_indx
+
conv_size
*
ia
+
ja
]
+=
sd
*
kvect
[
async_index
];
}
}
}
}
}
}
...
@@ -316,14 +320,15 @@ public class FactorConvKernel {
...
@@ -316,14 +320,15 @@ public class FactorConvKernel {
private
double
[][]
getJacobian
(
private
double
[][]
getJacobian
(
double
[]
kvect
)
double
[]
kvect
)
{
{
int
conv_size
=
asym_size
+
2
*
sym_radius
-
1
;
//// int conv_size =
asym_size + 2*sym_radius-1;
// int asym_start = (2 * sym_radius - 1) * (2 * sym_radius - 1)-1
;
int
conv_size
=
asym_size
+
2
*
sym_radius
-
2
;
int
asym_start
=
sym_radius
*
sym_radius
-
1
;
int
asym_start
=
sym_radius
*
sym_radius
-
1
;
int
sym_radius_m1
=
sym_radius
-
1
;
double
cw
=
getCompactWeight
();
double
cw
=
getCompactWeight
();
double
[][]
jacob
=
new
double
[
kvect
.
length
][
conv_size
*
conv_size
+
asym_size
*
asym_size
];
double
[][]
jacob
=
new
double
[
kvect
.
length
][
conv_size
*
conv_size
+
asym_size
*
asym_size
];
int
asym_terms_start
=
conv_size
*
conv_size
;
int
asym_terms_start
=
conv_size
*
conv_size
;
for
(
int
i
=
-
sym_radius
+
1
;
i
<
sym_radius
;
i
++)
{
for
(
int
i
=
-
sym_radius
_m1
;
i
<=
sym_radius_m1
;
i
++)
{
for
(
int
j
=
-
sym_radius
+
1
;
j
<
sym_radius
;
j
++)
{
for
(
int
j
=
-
sym_radius
_m1
;
j
<=
sym_radius_m1
;
j
++)
{
int
indx
=
((
i
<
0
)?
-
i
:
i
)
*
sym_radius
+
((
j
<
0
)?
-
j
:
j
);
int
indx
=
((
i
<
0
)?
-
i
:
i
)
*
sym_radius
+
((
j
<
0
)?
-
j
:
j
);
double
sd
=
(
indx
>
0
)?
kvect
[
indx
-
1
]
:
1.0
;
double
sd
=
(
indx
>
0
)?
kvect
[
indx
-
1
]
:
1.0
;
int
base_indx
=
conv_size
*
(
i
+
sym_radius
-
1
)
+
(
j
+
sym_radius
-
1
);
int
base_indx
=
conv_size
*
(
i
+
sym_radius
-
1
)
+
(
j
+
sym_radius
-
1
);
...
@@ -333,8 +338,6 @@ public class FactorConvKernel {
...
@@ -333,8 +338,6 @@ public class FactorConvKernel {
int
conv_index
=
base_indx
+
conv_size
*
ia
+
ja
;
int
conv_index
=
base_indx
+
conv_size
*
ia
+
ja
;
if
(
indx
>
0
)
jacob
[
indx
-
1
][
conv_index
]
+=
kvect
[
async_index
];
if
(
indx
>
0
)
jacob
[
indx
-
1
][
conv_index
]
+=
kvect
[
async_index
];
jacob
[
async_index
][
conv_index
]
+=
sd
;
jacob
[
async_index
][
conv_index
]
+=
sd
;
// conv_data[base_indx + conv_size * ia + ja] += sd* kvect[asym_size * ia + ja + asym_start];
}
}
}
}
}
}
...
@@ -382,8 +385,9 @@ public class FactorConvKernel {
...
@@ -382,8 +385,9 @@ public class FactorConvKernel {
jTByDiff
[
i
]
+=
jacob
[
i
][
k
]*(
target_kernel
[
k
]-
conv_data
[
k
]);
jTByDiff
[
i
]
+=
jacob
[
i
][
k
]*(
target_kernel
[
k
]-
conv_data
[
k
]);
}
}
}
}
//// int conv_size = asym_size + 2*sym_radius-1;
int
conv_size
=
asym_size
+
2
*
sym_radius
-
2
;
int
asym_start
=
sym_radius
*
sym_radius
-
1
;
int
asym_start
=
sym_radius
*
sym_radius
-
1
;
int
conv_size
=
asym_size
+
2
*
sym_radius
-
1
;
int
asym_terms_start
=
conv_size
*
conv_size
;
int
asym_terms_start
=
conv_size
*
conv_size
;
double
cw
=
getCompactWeight
();
double
cw
=
getCompactWeight
();
for
(
int
ia
=
0
;
ia
<
asym_size
;
ia
++){
for
(
int
ia
=
0
;
ia
<
asym_size
;
ia
++){
...
...
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