LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

OpenCV "filter2d" is a crosscorrelation, but not like MASM::CrossCorrelation.vi

Question:

What transformations on inputs or settings, assuming equal-sized 2d "src" and "kernel", are required for the MASM::CrossCorrelation.vi to give output consistent with CpenCV::filter2d?

 

Details:

I have code that is slow that was originally written in Python with OpenCV.

 

At the heart of this is the OpenCV::filter2d function which, according to OpenCV is really a correlation.

Capture.PNG

It claims to be a correlation, not a convolution, and in fact gives guidance for how to turn it into a convolution.

 

How do I go about getting consistent results?  OpenCV has results with signed integer-valued intensities.  LabVIEW has a table with very small coefficients, relatively speaking (1e-7 vs integers [-255,255]).

 

References:

Update:

  • I'm going to try setting the input to type int8, and see how that impacts this.
0 Kudos
Message 1 of 3
(2,472 Views)

What do you think the resolution of the coefficients needs to be to match your previous codes performance?

0 Kudos
Message 2 of 3
(2,316 Views)

Do you have some simple input matrices and expected result? What size output do you want? (same?, doublexdouble?)

 


@EngrStudent wrote:

Update:

  • I'm going to try setting the input to type int8, and see how that impacts this.

I8 seems ill advised, because I guaranteed you'll overflow unless all inputs are <<<11 (a single 11x11 is already close to the max (127) and then you do all the additions on top. Most advanced math functions are only implemented for DBL anyway.

Message 3 of 3
(2,306 Views)