LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert the two dimensional array values in matrix into x-y coordinates

as I know all of such algorithm are famous to optical flow
0 Kudos
Message 11 of 13
(1,090 Views)

Hi Bob,

thank yu for writing here. Yes, I have looked into the example and these two algorithms as well and I would like to implement them via the mathematical operation. I have found some algorithm called normalized cross correlation which I would like to implement to get the displacement .  An algorithm in mathematical form is attached here. Please help me how I implement this to get the displacement in pixels between the two images one being the initial image without movement and the other is moved a bit in xy direction. 

 

BR

Ravi

0 Kudos
Message 12 of 13
(1,089 Views)

@ravirocks43 wrote:

Hi Bob,

thank yu for writing here. Yes, I have looked into the example and these two algorithms as well and I would like to implement them via the mathematical operation. I have found some algorithm called normalized cross correlation which I would like to implement to get the displacement .  An algorithm in mathematical form is attached here. Please help me how I implement this to get the displacement in pixels between the two images one being the initial image without movement and the other is moved a bit in xy direction. 

 

BR

Ravi


Several comments.

  • Before doing your own "implementation via the mathematical operation", you should look at the Example(s).  They are LabVIEW code, so you can see how they work.  At a certain point, they might call an "internal Function" to do the hard work, and this, in turn, might be a call to a DLL, with lots of input and output parameters.  This generally means that someone who (we presume, and hope) knows what they are doing and is very skilled at the math and programming required.  Because this is being done at the lower "machine" level, it is probably going to run much faster than any code you could hope to write using higher-level LabVIEW functions.  So you need to ask if it is worth your time and effort to duplicate code that (a) is more likely to work and give the right answer, and (b) will run much faster than your code.
  • As you may know, there are two methods of doing cross-correlations.  One is the "direct method" that uses the function values directly.  For a 1D vector of length N, this requires operations that scale with N*N.  The other method uses an FFT and can be faster (for large N), scaling as N lg N (where lg is log base 2).
  • The formula that you showed in your picture is not the formula for the cross correlation of f and g.

If you want to implement your (strange) formula in LabVIEW, it is a simple problem of handling Arrays (no need for Matrices).  The Brute Force way to do it is to simply bring F and G into a For Loop using an indexing input tunnel and doing multiplication and Array Summation.  With that as a hint, and if you know anything about Arrays and For Loops, you should be able to code this up, yourself.

 

I'm a great believer in "Learn by Doing", hence I am not posting what I see as the easy solution to your summation.  You should be able to do this yourself, and if you write a tiny little VI to do this, and provide it with known inputs that you create, you should be able to convince yourself that your code is correct (i.e. it "gives the right answer" -- this is a necessary, but not sufficient, condition).  If you get stuck, post your best effort and ask for help.

 

Bob Schor

 

0 Kudos
Message 13 of 13
(1,076 Views)