# Revision history [back]

OpenCV won't work on any microcontrollers (arduinos or similar); it needs Linux and a lots of libraries.

Fortunately, the edge detector is simple enough to implement yourself. The simplest filter uses the following matrices:

fy = |-1 |  and fx = [ -1 1 ]
| 1 |


Here is the code (considering that the image is in a width*height linear array). You might adapt it to your needs:

for(pos=0; pos<width*(height-1);pos++){
gx[pos]=im[pos+1]-im[pos];
gy[pos]=im[pos+width]-im[pos];
}


To get the amplitude and the angle:

ampl[pos]=sqrt(gx[pos]*gx[pos]+gy[pos]*gy[pos]);
angl[pos]=atan2(gy,gx);


The Sobel filter is a little bit more complicated (it uses two 3x3 matrices) but it gives far better results.