08-26-2008 04:03 AM
08-26-2008 04:07 AM
Downshift:
by applying downshift, you can convert your 12 bits image to 16 bits image and I'm confident you can deal with it from that point.
Bit Plane Slicing:
which by you may eliminate the lower bit planes (planes 0,1,2,3) and keeping the remaining 8 bit planes (plane 4,5,6,7,8,9,10,11). The lower bit planes contain finer details, so your loss won't be drastic.
Downshift methd is already available in NI IMAQ. for the second resolution, you may resort to perform pixel by pixel operation, extracting pixel value, trim the mentioned lower planes and construct the new image.
Thanx a lot for the suggestion.I will defenitely try downshift.Bit plane slicing is what i think i am doing indirectly.Will get back to you once i try your valuable suggestions
08-26-2008 06:56 PM
08-27-2008 10:24 AM - edited 08-27-2008 10:27 AM
Well still i have not done with this. Now Giving you a clear picture of situation. From the reverse
245
204
246
So I will recive 2250000 bits of data in the format mentioned above.
Waleed,Mike and bruce any insight will be of grt help to me.
08-28-2008 12:04 PM
I guess I can repeat my answer if that helps.
It looks like you are packing two 12 bit values into three 8 bit values. You need to write an algorithm that takes three 8 bit values at a time and converts them back to two 12 bit values, then adds four zeroes to get a 16 bit values. It will be kind of messy, but shouldn't be too difficult.
I still think the easier method would be to have your device send the upper 8 bits of your twelve bit value, then send the lower 4 bits with 4 zeroes appended. Combining the two 8 bit values into a 16 bit value is a piece of cake on the PC side. The only downside is that sending all those zeroes will increase the amount of data transmitted to 3,000,000 bytes. Unless this is too much data to transmit, I would think this method would be much easier.
Bruce
08-29-2008 12:48 AM
Wow that is exactly what i did. But the problem is looping.I need to run a for loop for 3,000,000 times.That is time consuming.I will post the screen shot or my vi in a while.
Thanx bruce
08-29-2008 11:24 AM
08-29-2008 12:45 PM
You are doing it the hard way. Try these steps:
Read an array of 3,000,000 U8 values from the comport.
Use Decimate 1D array to split the array into the high and low bytes.
Use Join Numbers to combine the two U8 arrays into a single U16 array.
Reshape the array to a 2D array for ArrayToImage.
Bruce
08-29-2008 03:45 PM
08-30-2008 01:53 AM
You are doing it the hard way. Try these steps:
Read an array of 3,000,000 U8 values from the comport.
Use Decimate 1D array to split the array into the high and low bytes.
Use Join Numbers to combine the two U8 arrays into a single U16 array.
Reshape the array to a 2D array for ArrayToImage.
I tried that first.But i didnt get the desired output.I need to convert the U8 values to binary then need to join them and then convert it back to decimal value.That way i would have converted the U8 to U16.
Any idea avoiding the loop would be of grt help.