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: 

IMAQ write to string function

Solved!
Go to solution

Hi community,

 

I'm working on an optical coherence tomography system with frame grabber in it. The frame grabber directly grab picture of coherence pattern, while I need the continuous measured coherence signal to do FFT, so I used "IMAQ write to String" function to get information of every pixel in the image. However, there are 2 problems:

1. In  "IMAQ write to String" function, 4 types image format are available: bmp, jpeg, png and tiff. However in my case, only png and tiff works well. When I choose bmp or jpeg, the output string always returns 0. I'm quite wondering what caused this bug and how to fix it.

2. My frame grabber got image with bitdepth of 12 bits (which means bytes per pixel=2), however, in Labview there is no function for converting string into U16 array (only "string to U8 array"). So how can I convert the output string to U16 array to get the value of each pixel in the image?

 

Attached is my case. I've tried different version of LabVIEW (2012 & 2015) but the bugs are still there. My frame grabber is from BitFlow Co. (type: NEON-PCE-CLB). 

Look forward to your ideas!

 

Sincerely,

Ning

Southeast University,

Nanjing,China, 210096

0 Kudos
Message 1 of 6
(2,563 Views)
Solution
Accepted by topic author nlu9

I attached a transform from string to U16 and displayed it in decimal and hex.

You can change this by changing the representation of the constant array above the typecast.

 

One of the reasons BMP and JPeg don't work is because you have 12 bit images.

greetings from the Netherlands
0 Kudos
Message 2 of 6
(2,527 Views)
Solution
Accepted by topic author nlu9

What do you really want to do? It sounds like you want the raw pixel data to process further in LabVIEW. If that is the case converting the IMAQ image to an external format is definitely the wrong way to go about this! Use IMAQ ImageToArray instead! That will give you directly a 2D array of the pixel values.

 

Converting to any of the file image formats will add various things like file format headers and other information into the created byte stream according to the standard for that format. This is only is useful if you want to pass these images to another application for further processing that requires a standard format input for images. But considering that you ask about converting the byte stream of the IMAQ write to String function to 16 bits, I doubt that you try to do that. And there is really no way to convert the output into something else without first decoding the image format stream into raw data first, so don't create a byte stream format if you have to decode it again anyhow to do something with it.

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 6
(2,525 Views)

Rolf is right I was too fast to offer a solution to your question instead of solving the question you should have asked.

greetings from the Netherlands
0 Kudos
Message 4 of 6
(2,521 Views)

Hi Rolf!

 

Thank you so much for your prompt reply! My goal is indeed to get the raw data and I've made it by IMAQ GetLinePixel to get each A-scan line in the frame. Your explanation is really helpful!

 

Much thanks,

Ning Lu

0 Kudos
Message 5 of 6
(2,495 Views)

Hi Albert,

 

Thanks a lot for your quick reply and great help! Indeed I chose the wrong function and I've fixed it. My system works great now!

 

Best,

Ning 

0 Kudos
Message 6 of 6
(2,494 Views)