04-27-2012 04:59 PM
salut!! j'ai un programme Matlab qui fait le traitement d'image , je veux l’exécuter sous Labview et recevoir le resultas sous Labview auss . je sais pas comment faire la conversion Array to image si quelqu'un Peut m'aider Merci !!
ci joint le programme utilise
04-30-2012 06:09 PM
I hope you're doing well today! You'd first have to output the variable or array that you'd like to convert from the Script Node into the LabVIEW environment. Then you could convert that array into a pixel map or whatever image format you would like. Do you know what kind of image formatting you plan on using?
Here's some more information to help get you started:
05-01-2012 05:53 AM
thank you very much for answering my question!! well I searched information about the matlabscript node and i could do the following program where the type of image is an RGB (U32). i also think in using a webcam so i will get an image from tha camera and try to process this image with th matlab functions of image processing. the problem for me is that i lose one color . for example in the figure 3 in my program i have a blue background for all the images i use. do you have any idea about why i have this and how i can solve it ??
have a great day !!
p.s : I was searching in the Forum and i found this but i didnt understand it :
05-02-2012 05:48 PM
Could you possibly show me a screenshot of the behavior that you're seeing on the images? I dont have the image file that you're working with so its hard for me to visualize. I'm also not too familiar with the functions that you're working with in the script node. Can you elaborate a bit more on what you expect from those functions?
What is the intended outputs of the imfilter() and the deconvwnr() functions?
Also, does this script work correctly in the MATLAB ® environment? or is it only within LabVIEW that you see it not functioning correctly?
05-07-2012 05:47 AM
sorry for being late in my answer , I had to finnish other work!! and thank you for answering
here are the uses of the functions that you asked me, from the help of Matlab !!
IMFILTER N-D filtering of multidimensional images.
B = IMFILTER(A,H,OPTION1,OPTION2,...) performs multidimensional
filtering according to the specified options.
'circular' Input array values outside the bounds of the array are computed by implicitly assuming the input array is periodic.
'conv' IMFILTER performs multidimensional filtering using convolution.
DECONVWNR Deblur image using Wiener filter.
J = DECONVWNR(I,PSF) deconvolves image I using Wiener filter algorithm,
returning deblurred image J. The assumption is that the image I was
created by convolving a true image with a point-spread function PSF and
possibly by adding noise. The algorithm is optimal in a sense of least
mean square error between the estimated and the true images, and
utilizes the correlation matrixes of image and noise. In the absence of
noise, the Weiner filter reduces to the ideal inverse filter.
Finally as you can see in the archives joined to this message , the results of Matlab and Labview are different , so i think that the problem is with the conversions of the type inLabview from image to array and array to image where i lose information of the image.
have a nice day !!
thank you !!
05-08-2012 06:21 PM
The part that i'm worried about in the code is the data type conversions,I've circled the places in the code where we have data type conversions.
Im wondering if the data type change when the code goes from the LabVIEW environment through the script node is causing it to be distorted before you even process any filtering. I would check to make sure that the image when it is first being read in the MATLAB environment is not incorrectly displayed or distorted to start.
You may have to find another way to represent the U32 array data before you pass it through the script node that must be a Floating data type.
05-08-2012 07:15 PM
yes i agree with you, and this exactly the problem that Im searching for the solution here !! I trayed alot of solutions but i always have the same problem with the images in color , (without colors, like grayscale U8,U16,I16..., it gaves the same results as Matlab ).
ok Im still working in this , if I find any solution i will inform you !!
have a nice day !!
05-09-2012 08:09 AM
Ah, glad we're on the same page! The first thing to identify should be the data type that the function in the script node typically handles. I know in LabVIEW we're working with a U32 that is shaped with ,
Bits 0-7 are Blue
Bits 8-15 are Green
Bits 16-23 are Red
I wonder if this is the same formatting that's being expected for the filter calculations in the script node? I wonder if the order is different for the MATLAB function basically.
Another thing we can check is, once we send in the the file through the Script Node, we should confirm that that file is still showing correctly. This can help us solidify whether there is an issue with the U32 to double conversion. My guess is that the changing of data types, which is causing the image to be distorted in color, occurs during the filter functions in the script node.
01-23-2013 11:34 AM
I am also facing the same problem. I need to read a color image but was unable to read through matscript node. In the mathscript I am doing color image segmentation. So I need to be able to read color image from labview to matlab. please suggest me how to handle this problem. Here i am attaching my file. Thanks in advance...
01-23-2013 11:54 AM
The problem that Aziz was facing before is actually a bit different because it is using the MATLAB ® Script Node in LabVIEW and you're using the MathScript Node. So, there is actually a bit of a difference in the troubleshooting steps needed. I recommend reposting this question to a new thread as it is different. This should be done for any new questions that you might have even if it is the same problem. In the new post, you can refer to another thread as being related.