LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cRIO IMAQ: Writing time images to string then to JSON

Highlighted

Hardware I am using:

  • cRIO-9035
    • Dalsa GigE Nano M1930 NIR

Software I am using:

  • LabVIEW 2018
    • JKI Tools Library
    • NI IMAQ Vision Express

About the issue:

I'm trying to acquire images at several different time intervals. I set up an array of the time intervals and hacked together some condition statements (I don't know if this is the correct way to do something like this, this is my second week using IMAQ). When the capture command is given the images are flattened to a string. I'm trying to append to the string by using concatenate string, but it doesn't appear to be working.

 

Right now it is only writing one of the images into JSON formatting. I've attached the output text for you all to look at. Not exactly sure what the issue is since no error is being produced.

 

This is the segment of timed capture that I'm not sure about. I imagine there is a much more forward approach to this, so hopefully someone can point me in the right direction. I want the time intervals to range from 2^-4 to 2^10 milliseconds. Where the first capture is at 2^-4 ms, the second at 2^-3 and so on

Timed Capture.png

 

 

Here is where I am trying to convert the information to JSON format. As you can see I am flattening the image to a string, then clustering everything together. Once all the information is clustered, I flatten the variant to a string. This is where I try to concatenate the strings to before converting back to a variant.

Converting to JSON.png

 

 

 

 

Also, ideally my JSON output would look like this:

{
    "Image_1":{
          "Image_Time": time,
          "Image_Binary":image binary data
    }
    "Image_2":{
          "Image_Time": time,
          "Image_Binary":image binary data
    }
    etc.
}

 but that isn't as important as the timing and appending issues

Download All
0 Kudos
Message 1 of 27
(833 Views)
Highlighted

can you please downgrade the vi to LV2014 or below, not everyone has the privledge to use the advance versions.....Smiley Very Happy

CLD Using LabVIEW since 2013
0 Kudos
Message 2 of 27
(798 Views)
Highlighted

I don't have a Dalsa camera, so I can't run the code. But how does the Timer Duration attribute work with your camera? Does it set the exposure time for the sensor? Or is it the time between taking subsequent frames?

 

Either way, I see one problem with the way you are doing the acquisition. I believe you are doing a continuous acquisition and you have set the Acquire Image Type to acquire every image. This means that as soon as you start acquiring, IMAQdx is going to start buffering frames in the background. In your loop when you call the Vision Acquisition Express VI, it will return the next frame in the buffer. Because of this, I'm pretty sure the returned image will not correspond to the updated Timer Duration setting you are giving the express VI. I'd make a suggestion about another way to approach this, except I'd need more information about how you are trying to use the Timer Duration setting.

 

As for why only one image is being written to the JSON string, I could see this happening if you are only entering the True case of that case structure once. You should debug the logic that gets you into that True case to make sure it is sound.

 

-Jordan

Message 3 of 27
(792 Views)
Highlighted

How do I save it as a 2013 copy?

0 Kudos
Message 4 of 27
(786 Views)
Highlighted

I think the timer duration sets the time between the frames. I'm trying to use the timer duration setting to capture a photo at .0625 ms, .125 ms, ... I'm not sure if it is the right control to use for that sort of thing or if I need to use one of the other controls.

 

For the JSON, the true case enters the same amount of times as the capture count. I can see it entering and outputting the correct names/strings in highlight execution mode, but even then it is not updating the string properly

0 Kudos
Message 5 of 27
(784 Views)
Highlighted

Here is a list of the camera controls from the vision acquisition express VI associated with my cameraCameraControls.png

 

 

 

0 Kudos
Message 6 of 27
(776 Views)
Highlighted

To backsave the VI, open it and then go to File»Save for previous version.

 

I made some changes to the acquisition so that I could at least run the VI. I found through probes that the string is concatenating correctly, but the Flattened String to Variant function is cutting off everything except the first image's data. The problem is that you are taking a cluster (which is fixed size), flattening it to a string, concatenating the string, and then trying to unflatten it back into the same cluster datatype (which is determined by the Type String input to Flattened String to Variant). Not sure what a workaround would be. Maybe try using the normal Unflatten from String function instead of the variant version?

 

-Jordan

Message 7 of 27
(775 Views)
Highlighted

Here's the 2013 version

 

Edit: When I use a regular unflatten string I get this text output

Download All
0 Kudos
Message 8 of 27
(773 Views)
Highlighted

I think the biggest issue right now is to make sure the image is capturing at the exact rates that I am inputting, but I am not sure how to check that without properly converting/saving the images

0 Kudos
Message 9 of 27
(724 Views)
Highlighted

It looks like that is stripping out the cluster information. We already determined that you can't add on to the string and then try to unflatten it back into a cluster since the cluster is a fixed size. Do you have to use that data structure? Could you use an array of clusters instead of trying to append to the data string?

 

-Jordan

0 Kudos
Message 10 of 27
(721 Views)