diff --git a/hunks/adhoc/correlate.js b/hunks/adhoc/correlate.js index e5a734ab965a1229405d0a2e8e7c5bc8cccf8d18..cf80e1b6d0c1bc382af3a9776d9db4bf1822ebda 100644 --- a/hunks/adhoc/correlate.js +++ b/hunks/adhoc/correlate.js @@ -23,8 +23,9 @@ let correlate = (a, b, x, y) => { for(let i = 0; i < a.data.length; i ++){ sumA += a.data[i] - bi = y * b.width + x - bi += Math.floor(i / a.width) * b.width + i + // something is up w/ this feer sure + bi = (y * b.width + x) * 4 + bi += Math.floor(i / (a.width * 4)) * (b.width * 4) + i sumB += b.data[bi] sumDot += a.data[i] * b.data[bi] @@ -91,6 +92,8 @@ export default function Correlate(){ let resOut = this.output('ImageData', 'correlation') let canvasA = $('<canvas>').get(0) + canvasA.width = 50 + canvasA.height = 50 let ctxA = canvasA.getContext('2d') ctxA.width = 50 ctxA.height = 50 diff --git a/save/contexts/cuttlefish/correlate.json b/save/contexts/cuttlefish/correlate.json index 8e3bb970f8b8ce1901ec61898a3d92438663d214..e68e608578f5ebce50c91d51870c5d48b172b4db 100644 --- a/save/contexts/cuttlefish/correlate.json +++ b/save/contexts/cuttlefish/correlate.json @@ -55,16 +55,26 @@ "type": "ImageData", "connections": [ { - "inHunkIndex": "3", + "inHunkIndex": "4", "inHunkInput": "0" } ] } ] }, + { + "type": "image/displayimagedata", + "name": "image/displayimagedata_4", + "inputs": [ + { + "name": "image", + "type": "ImageData" + } + ] + }, { "type": "adhoc/correlate", - "name": "adhoc/correlate_3", + "name": "adhoc/correlate_5", "inputs": [ { "name": "frame", @@ -74,7 +84,13 @@ "outputs": [ { "name": "correlation", - "type": "ImageData" + "type": "ImageData", + "connections": [ + { + "inHunkIndex": "3", + "inHunkInput": "0" + } + ] } ] }