Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert 2D arrays samples to image file?

I am using a Digital Start-Stop scheme for data acquisition for my application on a PCI-6024E board in combination with a PCI-6602 board. I need to arrange the data points I gathered such that they have an exact number of samples in a "per frame of array samples" scheme and have them on an even and odd frames each time it finishes a data acquisition loop.I also need to rotate all even frames. How would this be done? My application has to do with imaging surfaces from Laser diode feedback current I gather as reflectance when I rotate a nanometric displacement motor in clockwise and then in counterclockwise direction in optical set-up.
Bernardino Jerez Buenaobra
Senior Test and Systems Development Engineer
Test and Systems Development Group
Integrated Microelectronics Inc.- Philippines
Telephone:+632772-4941-43
Fax/Data: +632772-4944
URL: http://www.imiphil.com/our_location.html
email: Bernardino.Buenaobra@ph.global-imi.com
0 Kudos
Message 1 of 5
(3,573 Views)
If I understand correctly, you are acquiring a fixed number of points for each row of your image. Since you are scanning back and forth, your even rows need to be reversed. This can be done by storing each row as a 1-D array. Loop through the arrays and reverse the even ones by checking for zero remainder. Store each row in the appropriate place in a preallocated 2-D array. Use 2-D array to image to convert it to an IMAQ image.

Bruce
Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 5
(3,573 Views)
Thanks Bruce, that I already did,actually with a 1D scan as a result of my data acquisition I also needed to transpose each array frame I gathered right? Essentially at the end what I have is X-scan by Y-scan matrix. Also, what I get are floating point voltage values, how would I convert them to grayscale? Would it be possibe a 2D matrix (pre-allocated as you say) be dynamically resized by how many samples I decide to scan? Attached is my code to count the scans (I still need to incorporate the reversing and matrix forming part) any suggestions?

Berns
Bernardino Jerez Buenaobra
Senior Test and Systems Development Engineer
Test and Systems Development Group
Integrated Microelectronics Inc.- Philippines
Telephone:+632772-4941-43
Fax/Data: +632772-4944
URL: http://www.imiphil.com/our_location.html
email: Bernardino.Buenaobra@ph.global-imi.com
0 Kudos
Message 3 of 5
(3,573 Views)
I would allocate the array after acquiring the data but before creating the image. At this point, you know what size the image will be.

You could just keep the values as floating point and use a floating point image to store them. This would automate the process of scaling the data since this feature is part of IMAQ. Otherwise, you will need to determine the min and max values of the array and scale them to 0-255 manually.

Bruce
Bruce Ammons
Ammons Engineering
0 Kudos
Message 4 of 5
(3,573 Views)
Thanks Bruce, our system was down for a couple of days and could'nt read this reply soon. I manage to capture the feedback current into the array and have them regenerated as image on an older picture control VI because I am having a problem of IMAQ painting the image at the back of the panel (?) where it can't be seen. Attached is the latest version of code.
Bernardino Jerez Buenaobra
Senior Test and Systems Development Engineer
Test and Systems Development Group
Integrated Microelectronics Inc.- Philippines
Telephone:+632772-4941-43
Fax/Data: +632772-4944
URL: http://www.imiphil.com/our_location.html
email: Bernardino.Buenaobra@ph.global-imi.com
Download All
0 Kudos
Message 5 of 5
(3,573 Views)