Python: Serial Transmission
Posted
by
Silent Elektron
on Stack Overflow
See other posts from Stack Overflow
or by Silent Elektron
Published on 2012-03-20T16:45:17Z
Indexed on
2012/03/21
11:29 UTC
Read the original article
Hit count: 250
python
|serial-port
I have an image stack of 500 images (jpeg) of 640x480. I intend to make 500 pixels (1st pixels of all images) as a list and then send that via COM1 to FPGA where I do my further processing.
I have a couple of questions here:
- How do I import all the 500 images at a time into python and how do i store it?
- How do I send the 500 pixel list via COM1 to FPGA?
I tried the following:
- Converted the jpeg image to intensity values (each pixel is denoted by a number between 0 and 255) in MATLAB, saved the intensity values in a text file, read that file using
readlines()
. But it became too cumbersome to make the intensity value files for all the 500 images! - Used NumPy to put the read files in a matrix and then pick the first pixel of all images. But when I send it, its coming like:
[56, 61, 78, ... ,71, 91]
.
Is there a way to eliminate the [ ]
and ,
while sending the data serially?
Thanks in Advance! :)
© Stack Overflow or respective owner