0.0.0 • Published 12 years ago
se2-correlate v0.0.0
se2-correlate
Computes the cross correlation for 2D images over the group of rigid motions.
Install
npm install se2-correlateExample
"use strict"
var zeros = require("zeros")
var ops = require("ndarray-ops")
var getPixels = require("get-pixels")
var se2corr = require("se2-correlate")
getPixels("robot.png", function(err, robotPixels) {
getPixels("maze.png", function(err, mazePixels) {
var robot = ops.neqseq(robotPixels.pick(undefined, undefined, 3), 0)
var maze = ops.ltseq(mazePixels.pick(undefined, undefined, 0), 128)
var obstacle = zeros([64, 256, 256])
ops.gtseq(se2corr(obstacle, robot, maze), 1.0)
//Obstacle is now the configuration space obstacle fo the robot
})
})Here is an interactive visualization
require("se2-correlation")(out, a, b)
Computes the cross correlation of two 2D images over the group of rigid motions. The value of the output at a given pixel is determined by,
out(\theta, x, y) = \int \limits_{R^2} a( \cos(\theta) u, \sin(\theta) v) b(u, v) d u \: dvIn the discretized version, the rotations are sampled uniformly. The input bitmaps are centered and rotations are performed about the center point in each case. The output correlation is also centered
outis a 3D array with shape[n, p, q]ais a 2D ndarraybis also a 2D ndarray
Returns out
Credit
(c) 2013 Mikola Lysenko. MIT License
0.0.0
12 years ago