06-14-2011 10:06 PM
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.
06-15-2011 02:32 AM - edited 06-15-2011 02:32 AM
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
06-15-2011 01:23 PM
Thanks so much.
Could you, or anyone else, elaborate how to convert an array with interger values into an array with corresponding binary values?
06-15-2011 01:29 PM
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...
06-15-2011 01:59 PM
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.
06-15-2011 02:09 PM
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.
06-15-2011 02:10 PM
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...
06-15-2011 02:35 PM - edited 06-15-2011 02:36 PM
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).
can you attach a VI containing a typical input array as diagram constant?
06-15-2011 02:54 PM
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!
06-15-2011 03:00 PM
@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.