11-15-2009 08:58 PM
Hello,
I'm using LabView 8.6 Standard.
Could someone please point me toward the appropriate examples please or advise me on a solution.
The Problem.
I have an image varying in shades of colour that has been converted into a gradiant sorta like a heat scan i.e. http://www.infraredcamerasinc.com/images/Medical-Infrared-Thermography/Thermal-Infrared-Full-Body-Sc...
I want to load an image like the one above into labView. Then using the location of the pixel in the image as my x and y coordinates, I want to use the RGB level to be the z cordinate such that I end up with a 3D graph.
Any ideas? Or examples I can look at.
Cheers
K
Solved! Go to Solution.
11-16-2009 08:22 AM
This thread may help.
If that does not do it for you try searching with "Ben 3d" for other examples I have posted.
Ben
11-16-2009 03:01 PM
Hello,
Ok so this is what I have so far. The code can select and open a file. The image box actually has all the information I want as you scroll over the image you get the x - y and colour intensity.
Does anyone know how to extract that information and put it into a array to create a 3D plot using the pixel location as the x & y and the colour intensity as the z?
I do apologise Ben, but I'm still new at LabView and can't quite follow the examples.
Thanks
11-16-2009 03:05 PM
Are you sure you the intensity plot is not what you want?
Ben
11-16-2009 04:44 PM
Ok. I think I may be using the wrong word.
I want to plot the colour value of each pixel. 256 different colours I believe. As you notice, as you mouse over the image, the information is displayed in the top right.
11-17-2009 11:58 PM
Hello
OK, so I've had no luck.
So, I found a program called ImageJ. I can take my image and convert get the x-y location and the value of the pixel in a HUGH xls file.
I can load the .xls file into an array in LabVIEW. The xls file consists of three colomns. The first contains the x-pixel. The second contains the y-pixel and the thrid colomn contains the value of that pixel.
Does anyone know how I can take that data and create a 3D surface plot?
Cheers
K
Why is it so hard to make a surface plot if you already have the data?
11-18-2009 01:11 AM
Hello
I figured out how to pop items out of an array. I tried to pop the items out of the array into the 3D surface plot. But no luck.
Could anyone shed some light on the matter
Cheers
Attach is a sample excel file that I'm working with. There are attually 60k values, but for the samples, I've taken only 1000.
Thanks
K
11-19-2009 11:34 AM
The first issue is that you don't want the for loop-you need to generate the entire array to pass to the 3D graph. Otherwise, you are constantly replacing a single point on the graph.
To graph your data properly, you need to pass a 2-dimensional array of your z values to the z matrix input of the 3D graph. Since you have it in a 1-dimensional array, you need to reshape it to be 2-dimensional. In general, the size of your 2D array based on the x and y values in your Excel file is 72x13 (maximum x value minus minimum x value inclusive and the same for y). I had to clean up your data to make this work. For example, for some values of y you had an x value of 472 and other times you didn't. To clean up your data I made sure that the exact same x values were present for every value of y.
Now that you have the array of z values shaped correctly, you can plot your graph-no x or y vectors needed. The only problem is that it will use default coordinates instead of those specified by your x and y values. To get these on your graph, you need to form these vectors and pass them in. Based on the format of your x and y values, I took an array subset of your x values and manually created the y vector for simplicity.
The changes I made to your VI are displayed and the updated Excel file is attached. This can be confusing so please let me know if I can clarify any of the explanation.
11-19-2009 02:40 PM
Hello
The xls file was incomplete, because I have just discovered that ImageJ (the program used to attain the x-y-pixel value information) only converted 87% of the pixels in the image, meaning some information was missing, as you found out.
Ok, So I follow every part, but the y vector. I don't quite follow why I need it.
When I made the alterations to my code, but default it loaded the full xls file I had saved (a new one which was 100% converted) and it gave produced a 3D graph with no y-vector inputted into the surface plot.
I do have another question. Is it possble to manipulate the values in the array. I wish to change the pixel value but anywhere I try and put a multipler I get an array box (like the y-vector input) where I have to put the value in as many time ase there are elements.
Is there away around this?
Cheers
K
11-19-2009 02:46 PM
If you're x and y values are going from 0 to n and incrementing by 1, you shouldn't need the x or y vector. I would not have expected that I needed the y vector in my example, but it didn't seem to work quite right if I didn't include it. It may have had to do with the custom x vector I was inputting but that's complete speculation.
If you want to manipulate the values in the array, use the Index Array function to read the current value at a specific position in the 2D array and then use the Replace Array Subset function to set the new value.