LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

Help mathscript node


Hi to all of us.
I' m working with LV 8.20 Professional Development suite and I' m trying to use correctly the new Mathscript Node function.

One of the program that I created use the Matlab function to execute the blind deconvolution of two images.
The program doesn't work. I think that this type of function is not implemented in the LabVIEW MathScript functions and so the editor can't compile the script.
How can I operate to run this application?
I send the file.m. It works correctly with the Matlab script node and not with the Mathscript node. In the last case the error is "Unknown symbol on line 3: fspecial".
Could anybody help me in some way?

Thanks to much.
Andrea Sassaroli

0 Kudos
Message 1 of 4
(7,368 Views)
Hi Andrea,
 
Although I haven't seen your m-file script, it's likely that the "Unknown symbol on line 3: fspecial", message that you are seeing means that you are trying to call a function called "fspecial" that isn't defined in MathScript as a built-in or user-defined function.
 
I can think of several possibilities for this, depending on the source of the fspecial function you are trying to call:
  1. fspecial could be a function that you have defined in a separate m-file script -- a user-defined function. If that's the case, then you would want to make sure that you have set the search path for MathScript to include the folder that includes your source m-file scripts for the function. (One way to set the MathScript search path is with the built-in MathScript function "path"--see here for more information.)
  2. fspecial could be a function that you are trying to call from a third party image processing add-on toolbox. Although LabVIEW 8.20 MathScript includes functional coverage that's comparible to what you might find in the competitor that you mention with an add-on Signal Processing Toolbox installed (see here for a function list), it doesn't support 3rd-party add-on toolboxes.

I hope this helps...

--Sam

 
Sam Shearman
0 Kudos
Message 2 of 4
(7,353 Views)
Hi Sam and thanks to reply me.

The .m code is:

close all;
clear all;
I = imread('cameraman.tif');
PSF = fspecial('motion',13,45);
Blurred = imfilter(I,PSF,'circ','conv');
INITPSF = ones(size(PSF));
[J P]= deconvblind(Blurred,INITPSF,30);
WEIGHT = edge(I,'sobel',.28);
se1 = strel('disk',1);
se2 = strel('line',13,45);
WEIGHT = ~imdilate(WEIGHT,[se1 se2]);
WEIGHT = padarray(WEIGHT(2:end-1,2:end-1),[2 2]);
WEIGHT(:,size(WEIGHT,2)) = [];
WEIGHT(:,size(WEIGHT,2)-1) = [];
WEIGHT(size(WEIGHT,1),:) = [];
WEIGHT(size(WEIGHT,1)-1,:) = [];
WS = double(WEIGHT);
P1 = P;
P1(find(P1 < 0.01))=0;
[J2 P2] = deconvblind(Blurred,P1,50,[],WS);
save -ASCII -tabs PSF.txt PSF;
imwrite (Blurred,'blurredprova.jpeg');
imwrite (WS,'WSprova.jpeg');

"fspecial" is a function of the MATLAB Image Processing Toolbox and it' s used to create special filters to process image.
Is not possible to work with this function without calling of MATLAB editor?

Thanks a lot for your time.

Bye
Andrea.
0 Kudos
Message 3 of 4
(7,341 Views)

Hi Andrea,

Since the fspecial function isn't currently supported by MathScript, the only way I can think of that could potentially allow you to work with MathScript (and not the competition) would be to implement your own user-defined function for fspecial.

--Sam

Sam Shearman
0 Kudos
Message 4 of 4
(7,330 Views)