sending image over serial port

조회 수: 9 (최근 30일)
Josephine
Josephine 2013년 12월 4일
답변: Josephine 2013년 12월 4일
hi i want to send a .bmp file over a serial port from pc. do i need some kind of conversion of the file into something that can be sent serially? and what is it? the output file should still be bitmap because i am going to send it to fpga for image processing. thank you in advance.

답변 (2개)

Walter Roberson
Walter Roberson 2013년 12월 4일
You do not need to convert the file if the other end is able to decode the file. But probably what the other end will need will be a data matrix, so you will need to convert the .bmp file into a data matrix by using imread() on it.
You can send the numeric data array over the serial port by using fwrite(). Serial ports are normally able to handle 8 bit bytes, and that should be the case for the situation you are in.
You will need to create a protocol so that the fpga knows how much data to expect and what the dimensions are -- unless those are invariant, of course.
As I come from the days when sending data over a serial port often involved whistling into a telephone, I always worry about the possibility of bytes getting lost or corrupted when sent by serial, so I tend to think in terms of protocols for detecting errors and resending the damaged portion, and so on. Remember, the faster you send the data, the more risk there is of data being lost.
How big are these images? And why are you processing them on an FPGA? Have you worked out how long it is going to take you to send the images? And how long to transmit the answer back? Couldn't that time be better used in just going ahead and computing whatever the FPGA would have been used for?
In the majority of circumstances that involve needing an FPGA, I would recommend against using a serial port to transmit the data. Use a DAQ (Data Acquisition Device) with a DIO (Digital Input/Output), or use ethernet or the like. You can get FPGA kits that have ethernet or Zigbies on-board.

Josephine
Josephine 2013년 12월 4일
thank you for your response mr.walter. i am really new to image processing and is currently researching and studying about it. i have so much to learn about fpga also including those which you have mentioned. i will try what you suggested.
what i am trying to do now is send an image over serial port in a loopback connection before i try it in fpga. my test image is 900kb, i used my laptop camera to capture the image and saved it as .bmp. i'm afraid sending file this large will take sometime and so, that's another problem.

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by