LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I convert a 680x480x2 array of values into binary and then joining adjacent elements to make a 640x480 array?

I am obtaining data from a camera and getting 10-bit data in Labview. I want to convert the element values to binary and then join adjacent elements to create an array half the size of the original. 

0 Kudos
Message 1 of 16
(2,975 Views)

Hi cowboy,

 

well 640×480 is not exactly half of 680×480×2...

 

- You have to read the specs of your camera. Then you should know how to combine the values.

- When you get 10bit values you probably need I16 datatype to store the values. Unless you also decrease the color resolution to 8 bit you are still stuck to 640×480×2 byte per image...

- To join numbers you should have a look at the numerics->data manipulation function palette Smiley Wink

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 16
(2,956 Views)

Thanks so much.

 

Could you, or anyone else, elaborate how to convert an array with interger values into an array with corresponding binary values?

 

0 Kudos
Message 3 of 16
(2,937 Views)

Hi cowboy,

 

as soon as you elaborate what you understand by "binary values"...

 

You could:

- change the formatting of your numbers to binary

- use the function "integer to bool array"

 

But first you really should think about your task to express your questions in clear phrases...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 16
(2,933 Views)

Sorry for not being clear about the situation.

 

Right now, the .vi I was given is programmed to obtain data from a firefly camera and in addition to providing an image of what the camera is looking at, but also a 640 x 480 array of corresponding values (from the block diagram, I assume they are RGB value). Right now the maximum values on the arrays when the camera is saturated is 255.

 

I want to convert these values in the array to its binary equivalent (i.e. 010 01011). Then I am going to combine adjacent elements to cut the number of elements in half. I ultimately would like to the maximum value on the array to be 1023.

 

Perhaps it sounds like I am making this too complicated and there is an easier way.

 

 

0 Kudos
Message 5 of 16
(2,927 Views)

Ignoring the "convert to binary" issue, what mathematical operation do you want to do to combine values?  Computers store numbers in binary so there's no conversion needed; you just need to determine how you want to combine the bits, and use the appropriate operations.  LabVIEW provides functions for bit-shifting, and all the boolean operations (AND, OR, etc) work for integers, not just booleans.

0 Kudos
Message 6 of 16
(2,921 Views)

Hi cowboy,

 

"Perhaps it sounds like I am making this too complicated and there is an easier way."

Yes, definitely. Usually all you need are some boolean operations and maybe some shifting and/or join operations...

 

You have to be sure on the data formatting on your "640 x 480 array of corresponding values" and also be sure about the format of the desired resulting array. When you have all the information needed you should either try on your own or explain in more detail. As long as you only have assumptions and wishes there is not much we can do...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 16
(2,918 Views)

You say "join", and that almost sounds like you want to combine to adjacent 8 bit values to create a 16 bit value (in this case you also need to worry about byte order). 

 

  • What is the representation of your original array you have?
  • What is the representation of the output array you want?

can you attach a VI containing a typical input array as diagram constant?

0 Kudos
Message 8 of 16
(2,912 Views)

Yes, I want to combine adjacent 8 bit values to create a 16-bit value. Would it be easier to convert everything to binary first in that case?

 

I don't have the .vi on-hand, but essentially I want a 640 x  480 array with each cell containing 16-bit value. The original array is double the size, with 8-bit. 

 

I apologize for lack of clarity, I will try to obtain more specific information. Thank you all for your time!

0 Kudos
Message 9 of 16
(2,902 Views)

@cowboys99 wrote:

Yes, I want to combine adjacent 8 bit values to create a 16-bit value. Would it be easier to convert everything to binary first in that case?


Again, all your numbers are already in binary.  That's how the computer represents them.  It is neither necessary nor possible to "convert everything to binary."  LabVIEW can convert a number to an array of booleans that corresponds to the numeric value, but for most operations that's unnecessary and inefficient.

0 Kudos
Message 10 of 16
(2,897 Views)