Interfacing Arduino with MATLAB for image processing
How can I connect an Arduino board and MATLAB for image processing? I am making an autonomous robot which require image开发者_开发百科 processing in MATLAB.
You can use the MATLAB-to-Arduino package at the offical MATLAB site, "MATLAB Interface to Arduino".
If you have serial communication on the Arduino, Matlab has built in tools for talking with the chip over USB or RS232. It is fairly simple to setup, but if your images are high in resolution you may not get the necessary speed from standard RS232.
something along the lines of:
s=serial('COM1','baudrate',115200)
Then you can read and write to the Arduino through Matlab functions and scripts
You can get connected to the MATLAB interface by simply using the serial
and fopen
commands on MATLAB
eg:
s=serial('COM2','Baudrate',9600,'Databits',8);
fopen(s);
count=0;
while count<50
a=fscanf(s);
count=count+1;
end
fclose(s);
whereas on Arduino, use Serial.print()
function.
Simple data can be sent using this. I never tried camera by using this technique. But by using a camera shield mounted on Ardunino, taking snapshots and later sending the data through Arduino to MATLAB as a matrix might work. Just an idea, might be possible.
Edit1: I was looked up more into this, and found some potential hardwares for the same: 1. ArduCam Shield for Arduino 2. https://www.sparkfun.com/products/11418
精彩评论