sending image over serial port
8 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(2 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!