Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How to input a jpeg/png image to the DAQ in Python, and the technique used to convert the picture file to more suitable stream (USB NI DAQ 6289)

Hello all. I am trying to input an image (any) into the DAQ, and reconstruct the same image by reading the analog input pin. Since my DAQ only have 4 analog input and 4 analog output ports, how do i split the image pixels into a suitable stream that can write to and read by all the ports? I have tried to build my own image converter generator, but i think it cant be used. Please help me.  ( cant upload jupyter notebook file T.T)

0 Kudos
Message 1 of 5
(399 Views)

Not sure what your use case is, but if I were stuck having to transmit an image over DAQ, I'd be trying to do it with digital I/O rather than analog.  Though I suppose that might depend on the bit depth per pixel.  The more bits, the more I'd want to go digital rather than analog.

 

A simple thought experiment for starters:

- let's suppose 32 bits per pixel -- 8 bits per RGB color, another 8 for "transparency"

- compute the 32 bit value for each pixel in a well-defined order

- this will be the digital value you want to send out.  If you have a 32 bit output port you can send them all at once.  If you have an 8 bit port, you'll need to cycle through them in a fixed sequence.

- either way, your receiving side needs to be sync'ed up to start receiving at the beginning of the sequence and know how to decode the bits.

 

You could conceivably try to approximate some of this with analog, but if you do, you'd need to use the approach that sends 8-bit values in a fixed sequence.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 5
(358 Views)

@stealthsniper wrote:

Hello all. I am trying to input an image (any) into the DAQ, and reconstruct the same image by reading the analog input pin. Since my DAQ only have 4 analog input and 4 analog output ports, how do i split the image pixels into a suitable stream that can write to and read by all the ports? I have tried to build my own image converter generator, but i think it cant be used. Please help me.  ( cant upload jupyter notebook file T.T)


Isn't this what the digital TV tuner cards were doing? What is your end goal? why this convoluted way of data transfer?

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 3 of 5
(354 Views)

@Kevin_Price wrote:

Not sure what your use case is, but if I were stuck having to transmit an image over DAQ, I'd be trying to do it with digital I/O rather than analog.  Though I suppose that might depend on the bit depth per pixel.  The more bits, the more I'd want to go digital rather than analog.

 

A simple thought experiment for starters:

- let's suppose 32 bits per pixel -- 8 bits per RGB color, another 8 for "transparency"

- compute the 32 bit value for each pixel in a well-defined order

- this will be the digital value you want to send out.  If you have a 32 bit output port you can send them all at once.  If you have an 8 bit port, you'll need to cycle through them in a fixed sequence.

- either way, your receiving side needs to be sync'ed up to start receiving at the beginning of the sequence and know how to decode the bits.

 

You could conceivably try to approximate some of this with analog, but if you do, you'd need to use the approach that sends 8-bit values in a fixed sequence.

 

 

-Kevin P


My DAQ is connected in a closed loop for this purpose. I prefer to use analog output because the end goal is not exactly sending/receiving an image. Basically, i just want to try to stream some arrays of data that has the format of a picture over all 4 channels simultaneously. I have designed a UI to control the DAQ, such that i will have a "upload" button to a file into the UI, and the UI will send the signals to write to the DAQ. So, the main reason why i chose a picture it is because i treat the 600x600 pixels (as example) picture as a normal 600x600 array of voltage values. So i will send these pictures through the DAQ's 4 channels, and read them from the other side, and recombine the pixels back from the output signals to form back the original sequence and array of values.

 

 Its not necessary have to be a picture. Is just a file that have multi-dimension array of values (2-D file like a picture) that i can used to send over the the DAQ and utilized all the 4 analog output channel together. If i can recombine back the file after reading the signals, this could mean I have successfully created a program that can send 2-D array of values in parallel with just 1 file. This is the functionality that i would like to add into the UI..which isnt fully done yet.   


[I have uploaded my jupyter notebook file (Saved as a python format). To look at my original code, just download the file and rename the format from .py to .ipynb in your editor]

0 Kudos
Message 4 of 5
(338 Views)

Essentially, i just wanna send a file that has 2-D array of values, I just replied the other person explaining my reason, can try to see if my explanation is clear to you or not. 

0 Kudos
Message 5 of 5
(336 Views)