From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ArrayToImage VB 16 bit data.

I have IMAQ3.3.  (no vision license).    I can collect (via framegrabber) and display  8 bit data and save it via the ImageToArray function.   Then I can read this data back and display it at a later time using the ArrayToImage function.
 
However,  after saving 16 bit data,  I cannot read it back as 16 bit data.   The ArrayToImage function always truncates it to 8 bit data!!!!   How can I get it to read 16 bit data?      The image it is reading from is an array of 16 bit data.
0 Kudos
Message 1 of 7
(3,673 Views)
dkim--

Take a look in the help for the function and see if there is a setting that will enable this or if it will even read 16bit at all. 

Also, if you wouldn't mind checking in Measurement and Automation Explorer, under the software heading, what the version of IMAQ, IMAQ I/O (if installed) and if you see IMAQdx what version that is also.

Finally, if you could provide an example of what is happening that would be helpful also.

Regards,

John H
Applications Engineer
National Instruments
0 Kudos
Message 2 of 7
(3,653 Views)
CWIMAQ 3.3
 
The following will read data from a file assuming it is 8 bit data.   I assumed if I changed ImageArray and B1 to 16 bit integers it would read as 16 bit data.   Instead....it reads as 16 bit data....then truncates to 8 bit as it puts the data into CWIMAQ1.
 
I only use this for debug purposes....   We usually collect and run the data live, which works fine.     However, I can save the collected data and "play it back"  to check my software processing.   I need to put it into CWIMAQ1 since this is the structure that it gets when running "live".     When I try to modify the CWIMAQ1 parameters to indicate a 16 bit image I get something like "vision license required".       I can read the image in as 8 bit data and do all the 8 to 16 bit  conversion myself (my fallback which works fine).       I Just wanted to know if this was indeed a "licensing issue"   or if there was something I was missing.
 

Private Function GetNewImages(ByVal ImageFile As String)
   Dim k As Long
   Dim l As Byte
   Dim ImageArray(4096, 2050) As Byte
   Dim B1 As Byte
  
   CWIMAQ1.Images.RemoveAll
   CWIMAQ1.Images.Add (mlNumActiveFrames)
       
   Open ImageFile For Binary As #97
    For k = 1 To mlNumActiveFrames
 
   For l = 1 To 20
     Get #97, , B1
   Next l
    
  
      Get #97, , ImageArray
     
       If EOF(97) Then
              MsgBox "Error reading " & ImageFile, , " "
              GetNewImages = False
              Exit Function
            End If
           
      CWIMAQ1.Images.Item(k).ArrayToImage ImageArray
   Next k
   Close #97
   GetNewImages = True
End Function
0 Kudos
Message 3 of 7
(3,649 Views)
dkim--

        Alright let's take a step back.  First, it would be helpful to know what version of IMAQ you have installed.  I've looked on our website and through our servers and cannot see a version 3.3.  Please check in Measurement and Automation Explorer. Another thing, you never mentioned that you were programming in text and have not said what language you are programming in, that would be helpful.  Also, do you have Vision installed?  The function ArraytoImage should not be available without Vision.  Furthermore, once there it should not work unless licensed (for 8 or 16bit)  Was this ever installed or licensed, at all?
        To help us troubleshoot, let's see the results of code that we know works.  So, if you go into the folder C:\Program Files\National Instruments\Vision\Examples\MSVB.NET\1. Getting Started....and load the project and run the code and see if you can load an image.
        These are just a couple things needed to understand what is going on and one thing to try.  Any more info about what you've done is always helpful so if there is anything else I am missing please let me know.

Regards,

John H
0 Kudos
Message 4 of 7
(3,640 Views)

My bad.   Version is 3.1.1.3004.    I'm not sure where I remeber 3.3 from.... No I've never had vision installed and do not believe I have a license (and consequently do not have the path you are referring to.)   I believe the version I am using came on a disk that came with the FrameGrabber card.  

I'm not sure why ArrayToImage is visible, but it does work nicely for  8 bit data, and complains about a license if I try to change it.    Sorry, I did not realize it was off limits.   I've already completed my updates without it though, and my LIVE system is working great.  

0 Kudos
Message 5 of 7
(3,634 Views)
The language is Visual Basic.
0 Kudos
Message 6 of 7
(3,630 Views)
dkim--

     Found out a little more about that function and just wanted to close the loop.  It is possible in different version that it was free with IMAQ and didn't require Vision.  Over the versions that function has been moved towards being free.  In the latest version of the driver you should have complete access to the functionality.  If you wanted to try that you could just update to the latest driver.  It sounds like your application is moving along without this function though.  I just wanted to let you know in case that is something that you wanted to do.

Regards,

John H.
0 Kudos
Message 7 of 7
(3,590 Views)