LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Different results from MATLAB vs MATLAB script node in LabVIEW

Solved!
Go to solution

Hello,

 

I am using a modified version of the MATLAB example Find Image Rotation and Scale:

 

http://www.mathworks.com/help/images/find-image-rotation-and-scale.html;jsessionid=f361fc9c69eae8406...

 

to find the rotation and scale differences between two nearly identical images. I am getting entirely different results running the script in MATLAB versus the MATLAB script node in LabVIEW (see attached image). I am using LabVIEW 2017 64 bit, and MATLAB R2017a. The script requires the MATLAB Computer Vision System Toolbox.

 

It looks like the script and the script node are functioning the same until estimateGeometricTransform in line 51 of the code (see the MATLAB vs LabVIEW Feature Matching Lines Comparison.jpg image).

 

The only changes I have made to the attached Snippet and MATLAB .m file is to make the imread path in lines 10 and 11 of the code non-specific to my computer.

 

Thanks!

0 Kudos
Message 1 of 3
(590 Views)
Highlighted
Solution
Accepted by topic author bentaztick

DISCLAMER: Not MATLAB expert.

 

Could MATLAB be using extended floats? LabVIEW uses doubles at the moment.

Message 2 of 3
(545 Views)
Highlighted

Their web page on Data Types says:

 

"By default, MATLAB® stores all numeric variables as double-precision floating-point values."

 

That being said, the scale_recovered and theta_recovered show as "1x1 singles" in the Workspace. I added the following code to the end of the program and it fixed the problem:

 

scale_recovered = double(scale_recovered);
theta_recovered = double(theta_recovered);

 

Thanks for your help!

0 Kudos
Message 3 of 3
(531 Views)