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
a6cd306e
Commit
a6cd306e
authored
May 29, 2019
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more on pattern detection
parent
4ffb8a32
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
4 deletions
+66
-4
MatchSimulatedPattern.java
.../com/elphel/imagej/calibration/MatchSimulatedPattern.java
+15
-3
DoubleFHT.java
src/main/java/com/elphel/imagej/common/DoubleFHT.java
+51
-1
No files found.
src/main/java/com/elphel/imagej/calibration/MatchSimulatedPattern.java
View file @
a6cd306e
...
...
@@ -9262,7 +9262,8 @@ dbgThis=true;
" numOfNeib="
+
numOfNeib
+
" (distortionParameters.correlationAverageOnRefine="
+
distortionParameters
.
correlationAverageOnRefine
);
}
double
[][]
modelCorrs
=
new
double
[
numOfNeib
][];
double
[][]
modelCorrs
=
new
double
[
numOfNeib
][];
double
[][]
modelCorrs_new
=
new
double
[
numOfNeib
][];
double
[][]
debugGreens
=
new
double
[
numOfNeib
][
0
];
for
(
numNeib
=
0
;
numNeib
<
numOfNeib
;
numNeib
++)
{
neibCenter
[
0
]=
diffBeforeXY
[
0
]+
0.5
*(
greenNeib
[
numNeib
][
0
]+
greenNeib
[
numNeib
][
1
]);
...
...
@@ -9309,14 +9310,24 @@ dbgThis=true;
debugGreens
[
numNeib
]=
simGreensCentered
.
clone
();
// testing if phase reversal would exactly inverse result pattern - tested, perfect
double
[]
simGreensCenteredClone
=
simGreensCentered
.
clone
();
modelCorrs
[
numNeib
]=
fht_instance
.
correlate
(
greens
.
clone
(),
// measured pixel array
// modelCorr=fht_instance.correlate (greens, // measured pixel array
simGreensCentered
,
// simulated (model) pixel array)
// distortionParameters.correlationHighPassSigma);
distortionParameters
.
correlationHighPassSigma
,
fast
?
distortionParameters
.
correlationLowPassSigma
:
0.0
,
// moved to decimation via FFT
distortionParameters
.
phaseCorrelationFraction
);
(
fast
?
distortionParameters
.
correlationLowPassSigma
:
0.0
),
// moved to decimation via FFT
distortionParameters
.
phaseCorrelationFraction
);
modelCorrs_new
[
numNeib
]=
fht_instance
.
phaseCorrelate
(
greens
.
clone
(),
simGreensCenteredClone
,
patternDetectParameters
.
phaseCoeff
,
0
,
// distortionParameters.correlationHighPassSigma,
patternDetectParameters
.
lowpass_sigma
,
// (fast?distortionParameters.correlationLowPassSigma:0.0),// moved to decimation via FFT
null
,
null
);
if
(
dbgStr
!=
null
)
{
double
dbgSumWindow
=
0.0
;
for
(
double
[]
dbgSlice:
modelCorrs
)
for
(
double
dbgD:
dbgSlice
)
dbgSumWindow
+=
dbgD
;
...
...
@@ -9333,6 +9344,7 @@ dbgThis=true;
if
(
debug_level
>
(
debug_threshold
+
0
)){
System
.
out
.
println
(
">=========Showing modelCorrs, passNumber="
+
passNumber
);
SDFA_INSTANCE
.
showArrays
(
modelCorrs
,
true
,
"modelCorrs:"
+
numOfNeib
);
SDFA_INSTANCE
.
showArrays
(
modelCorrs_new
,
true
,
"modelCorrs_new:"
+
numOfNeib
);
}
// combine 4 correlations into the double resolution, same output size (so half input size) array
...
...
src/main/java/com/elphel/imagej/common/DoubleFHT.java
View file @
a6cd306e
...
...
@@ -303,7 +303,7 @@ public class DoubleFHT {
else
return
phaseCorrelate
(
first
,
second
,
phaseCoeff
,
filter
);
}
//asymmetrical - will divide by squared second amplitude (pattern to match)
public
double
[]
phaseCorrelate
(
public
double
[]
phaseCorrelate
(
// old
double
[]
first
,
double
[]
second
,
double
phaseCoeff
,
...
...
@@ -371,6 +371,56 @@ public class DoubleFHT {
swapQuadrants
(
first
);
return
first
;
}
public
double
[]
phaseCorrelate
(
double
[]
first
,
double
[]
second
,
double
phaseCoeff
,
double
highPassSigma
,
double
lowPassSigma
,
double
[]
first_save
,
double
[]
second_save
){
//null-OK
updateMaxN
(
first
);
double
[]
filter
=
null
;
if
((
highPassSigma
>
0
)
||
(
lowPassSigma
>
0
))
{
filter
=
createFrequencyFilter
(
highPassSigma
,
lowPassSigma
);
}
return
phaseCorrelate
(
first
,
second
,
phaseCoeff
,
filter
,
// high/low pass filtering
first_save
,
second_save
);
}
public
double
[]
phaseCorrelate
(
// new
double
[]
first
,
double
[]
second
,
double
phaseCoeff
,
double
[]
filter
,
// high/low pass filtering
double
[]
first_save
,
double
[]
second_save
){
//null-OK
if
(
first
.
length
!=
second
.
length
)
{
IJ
.
showMessage
(
"Error"
,
"Correlation arrays should be the same size"
);
return
null
;
}
updateMaxN
(
first
);
swapQuadrants
(
first
);
swapQuadrants
(
second
);
if
(!
transform
(
first
,
false
))
return
null
;
// direct FHT
if
(!
transform
(
second
,
false
))
return
null
;
// direct FHT
if
(
first_save
!=
null
)
System
.
arraycopy
(
first
,
0
,
first_save
,
0
,
first
.
length
);
if
(
second_save
!=
null
)
System
.
arraycopy
(
second
,
0
,
second_save
,
0
,
second
.
length
);
first
=
phaseMultiplyNorm
(
first
,
second
,
phaseCoeff
);
// correlation, not convolution
if
(
filter
!=
null
)
multiplyByReal
(
first
,
filter
);
transform
(
first
,
true
)
;
// inverse transform
swapQuadrants
(
first
);
return
first
;
}
//
public
double
[]
applyFreqFilter
(
double
[]
first
,
...
...
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