Ask Your Question
0

Implementing edge detector on SAM3x8e ( Arduino Due )

asked 2016-11-05 15:14:52 -0600

Vaclav gravatar image

I am looking for minimal porting of OpenCV into SAM3x8e hardware. (.5GB ). Is there a "sample code" somewhere? I can go thru all the core includes step by step but would prefer not to reinvent the wheel. I do not need any GUI related classes, just want to be able to calculate edges. Thanks

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2016-11-07 02:44:17 -0600

kbarni gravatar image

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.

edit flag offensive delete link more

Comments

Yes, I know that. i WAS asking about minimal OpenCV. I am well aware of limitations of my hardware also. Let's call this closed OK?

Vaclav gravatar imageVaclav ( 2016-11-08 16:08:30 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-11-05 15:14:52 -0600

Seen: 319 times

Last updated: Nov 07 '16