Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cuttlefish
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
squidworks
cuttlefish
Commits
4fee2244
Commit
4fee2244
authored
5 years ago
by
Jake Read
Browse files
Options
Downloads
Patches
Plain Diff
stash correlate and attempt to go for color
parent
2a9d5c26
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
hunks/adhoc/correlate.js
+3
-32
3 additions, 32 deletions
hunks/adhoc/correlate.js
with
3 additions
and
32 deletions
hunks/adhoc/correlate.js
+
3
−
32
View file @
4fee2244
...
@@ -20,7 +20,6 @@ let correlate = (a, b, x, y) => {
...
@@ -20,7 +20,6 @@ let correlate = (a, b, x, y) => {
let
sumA
=
0
let
sumA
=
0
let
sumB
=
0
let
sumB
=
0
let
sumDot
=
0
let
sumDot
=
0
let
bi
=
0
// i will be index within the flat-af array under a,
// i will be index within the flat-af array under a,
for
(
let
i
=
0
;
i
<
a
.
length
;
i
++
){
for
(
let
i
=
0
;
i
<
a
.
length
;
i
++
){
for
(
let
j
=
0
;
j
<
a
[
0
].
length
;
j
++
){
for
(
let
j
=
0
;
j
<
a
[
0
].
length
;
j
++
){
...
@@ -29,36 +28,8 @@ let correlate = (a, b, x, y) => {
...
@@ -29,36 +28,8 @@ let correlate = (a, b, x, y) => {
sumDot
+=
a
[
i
][
j
]
*
b
[
i
+
x
][
j
+
y
]
sumDot
+=
a
[
i
][
j
]
*
b
[
i
+
x
][
j
+
y
]
}
}
}
}
return
sumDot
/
Math
.
sqrt
(
sumA
*
sumA
*
sumB
*
sumB
)
// I'm still not convinced this is a really great filter
return
sumDot
/
Math
.
sqrt
((
sumB
*
sumB
)
*
(
sumA
*
sumA
))
/*
for(let i = 0; i < a.data.length; i ++){
sumA += a.data[i]
// to find the reciprocal pixel in b,
// we can start at the top-left corner: here is the 'i_th' element
// within b, correspondign to the XY of the top-left of a,
bi = (y * b.width * 4) + x * 4
// to get down from here, the row of a this i is in:
let rca = Math.floor(i / a.width * 4)
bi += rca * b.width * 4
// and the increment,
bi += (i % (b.width * 4))
// ok ?
if(bi >= b.data.length){
bi = b.data.length
// happens all the time, go home do this tomorrow
console.log('yep', bi, rca, i, x, y)
//throw new Error('halting')
}
sumB += b.data[bi]
sumDot += a.data[i] * b.data[bi]
}
*/
//return 55 //(sumDot / Math.sqrt(sumA*sumA + sumB*sumB))
// a, b are str8 up matricies
//console.log(b.width)
// ok, now we can do the maths on a and b, thx
}
}
let
delay
=
(
time
)
=>
{
let
delay
=
(
time
)
=>
{
...
@@ -137,7 +108,7 @@ async function run(a, b){
...
@@ -137,7 +108,7 @@ async function run(a, b){
imdBuffer
[
lc
++
]
=
dt
imdBuffer
[
lc
++
]
=
dt
imdBuffer
[
lc
++
]
=
dt
imdBuffer
[
lc
++
]
=
dt
imdBuffer
[
lc
++
]
=
dt
imdBuffer
[
lc
++
]
=
dt
imdBuffer
[
lc
++
]
=
dt
imdBuffer
[
lc
++
]
=
255
}
}
}
}
let
imgRes
=
new
ImageData
(
imdBuffer
,
resX
,
resY
)
let
imgRes
=
new
ImageData
(
imdBuffer
,
resX
,
resY
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment