Beagle Board

From HBRC Wiki

Jump to: navigation, search

--Beagle board 12:25, 29 August 2008 (PDT)

Contents

A tutorial on setting up a system to do image processing with a BeagleBoard

This wiki page will primarily act as a short cookbook on how to set up a system to do image processing with a BeagleBoard; following this tutorial/cookbook, you should have OpenCV routines running on about $250 worth of hardware. The HBRC has/will have a separate site for working with OpenCV.


Source(s): tutorial


Why choose the BeagleBoard and OpenCV?

Here are Nathan's slides from the November 19, 2008 HBRC meeting [1]

And a video by TI showing the BEagleBoard used in a home environment [2]

Up until now vision processing has required a specialized system, like the CMUcam3, or a large, power hungry PC. Specialized hardware, like the CMUcam3, have a market that is many orders of magnitude smaller than consumer devices, so they tend to be expensive and don't have much developer community support. PCs are cheap, but with Windows there is no simple way to get at data from a WebCam without using a Microsoft development environment(which is very powerful, but has a learning curve).


The BeagleBoard has a OMAP3530 processor from TI, which is intended for the cell phone market. The cell phone market is billions/year, much much larger than the PC market. So there will be (already is!) a huge developer community growing around this chip. These latest cell phone chips support implementing full PC functionality. This means a robot based on a BeagleBoard can use the existing software infrastructure, including the Web.

The BeagleBoard is 3"x3" and uses less than 2 watts, so its form factor and energy consumption is close to what members already have on their robots.

Finally, the OMAP3530 has a DSP on it, which could be dedicated to vision processing, freeing developers from worrying about multiple processes competing for CPU cycles.

There at many (>7) HBRC members who have played with OpenCV (ie Open Computer Vision). Everyone is impressed. The OpenCV libraries are comprehensive. O'Reilly has released 'Learning OpenCV', which provides and excellant overview of OpenCV. The Jan - May 2007 issues of Servo have a series of short articles, by Robin Hewitt, about using using OpenCV. You may see these articles and download the associated code examples on the Cognotics website at http://www.cognotics.com/opencv/servo_2007_series/index.html


Source(s): tutorial


History: why this Wiki page?

Nathan Monson showed up at the August 27, 2008 HBRC meeting with the just released BeagleBoard mated to a Quickcam 9000; and was able to process 800x600 YCrCb frames at 25FPS using only 4 watts. There were at least 5 members at the meeting who had played with OpenCV, and it appeared that several attendees will buy a BeagleBoard. This wiki page is intended as a help area for such interested parties.


There will be/is a huge number of resources for the BeagleBoard and OpenCV. This page should spare you from having to sift through all of this information. However, if good instructions already exists for something (like Linux installation instructions?), this page will just provide a link.


John Slater started this page. If you don't wish to edit this page yourself, e-mail John ('johngslater - gmail') with suggested changes. Please note, if this page grows too large it defeats the original intention of the page.


Source(s): tutorial


Members who are/will be using the BeagleBoard and OpenCV

Nathan Monson ---> slides from Nov 19 2008 HBRC talk: [3]

John Slater

Dave Curtis

Alex Sy

Enrique Ruiz

Ralph Gnauck

Kevin Bjorke


Source(s): tutorial


using the BB as a 'device' versus as a 'host'

The BB was designed to be compatible with the modern PC infrastructure, where you connect (and often power) most devices with a USB connection. The BB is kept small by having only one USB port. But the USB system was designed so you to connect a USB hub to a USB port, allowing more than one USB device to communicate though this single USB port.


In "device mode", the BB to a powered by connecting its USB port to some other USB port which has power (usually a USB port on the PC you want to talk to).

Or you can hook the BB to a USB hub. This is the "host mode", and you are now supplying power to other devices. Now you must hook a wallwart or other power source up to the BB.


Source(s): tutorial


what gets connected to your BB

When you buy a BB you get a board with a lot of connectors, but no cables.

from http://elinux.org/BeagleBoard#Components : File:Http://elinux.org/BeagleBoard/Beagle top notes.png



Because you are interested in doing computer vision you WILL be hooking a web cam to a USB hub, which is connected to the BB. For the keyboard/mouse/monitor there are a couple of options, a lot of potential confusion about what kind of cables and software you need. But before this gets discussed, you need to know a bit about USB connectors/connections.


USB connectors/connections


I assume everyone is familiar with plugging things in to USB ports.

Lets start with some common terminology: A computer 'cable' has 'plug' on one end, and a 'device' or 'plug' on the other end. A device may have 'ports' where you can insert the plug of a cable.

As an example, a mouse device has a cable. One end of the mouse's cable is the mouse. On the other end is a plug, which gets inserted into the port of some other device, usually a PC.

'Host' USB ports are powered. The amount of power supplied is minimal, but in many cases the power is suffient so a peripheral like a mouse, keyboard, or a USB flash/hard drive does not need batteries or its own power source. In fact, the BB is so energy efficient it can be run as a USB device powered by the USB host port of another device, like a PC.


USB ports can be pretty handy, many devices like PCs and portables will advertise how many USB ports they have. Because of the size of the BB, it has only one USB port. However, USB lines can carry more than one signal. So you can always connect a 4 port or 7 port USB hub to a USB port, and then hook up 4 or 7 USB devices to the hub.

You might not recognize the BB's USB port because of its small size. The USB connector everyone is familiar with, used on mice, keyboards and USB flash/hard drives, is the Series “A” size. As electronics has become more miniturized, the A plug's dimensions is sometimes too bulky. So other plug dimensions have come into use, like the "mini" size. The BB's USB port is a "mini-A" size, and it is referred to as the 'OTG port'.

Here is a look at typical plug ends (from http://en.wikipedia.org/wiki/USB)

File:Http://en.wikipedia.org/wiki/USB/180px-Types-usb svg.png

Almost all USB hubs have a mini-B port for input. Thus, you need a Mini A Male to Mini B Male cable to hook the BB to a USB hub.

http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=WM17494-ND


There is a standard for how much current a USB host port provides. And 'USB devices' need to use less than this amount of power. However, when hooking up to 4 or 7 devices to a USB, the current draw will often exceeed what the USB host can provide. So almost all USB hubs have a little power input where you can hook up a 5V wall-wart.


Most USB hubs have A size ports. If the USB device you want to plug in has a smaller plug, make certain you buy a USB hub contains a port with this size, or you will be need to buy an adaptor cable, like this USB Standard-A to Mini-A Adapter:

http://www.vernier.com/accessories/access.html?usb-mini&template=basic.html


When you start chaining things together, it is possible to form a loop. Since the USB cables are powered, this is similiar to shorting the terminals of a battery. So discourage this, the two ends of a USB cable are different. You probably never were concerned about this, because 'the other end' of most USB devices is the device itself, not a USB plug.

If you find plug designs interesting, see http://en.wikipedia.org/wiki/USB#Types_of_USB_connector.

The USB port on the BB is actually a OTG port, so depending on the situation, the port can act as a host or a device. from http://en.wikipedia.org/wiki/USB#Compatibility Two-way communication is also possible. In general, cables have only plugs, and hosts and devices have only receptacles: hosts having type-A receptacles and devices type-B. Type-A plugs only mate with type-A receptacles, and type-B with type-B. However, an extension to USB called USB On-The-Go allows a single port to act as either a host or a device — chosen by which end of the cable plugs into the socket on the unit. Even after the cable is hooked up and the units are talking, the two units may "swap" ends under program control. This facility targets units such as PDAs where the USB link might connect to a PC's host port as a device in one instance, yet connect as a host itself to a keyboard and mouse device in another instance

from http://elinux.org/BeagleBoard#OTG :

The HS USB OTG (OnTheGo) controller on OMAP3 on the BeagleBoard does have support for all the USB 2.0 speeds (LS/FS/HS) and can act as either a host or a gadget/device. The HS USB OTG port is used as the default power input for the BeagleBoard. It is possible to boot the BeagleBoard using this USB port. When using the OTG port in host mode, you must power the BeagleBoard using the +5V power jack. If you connect a USB hub, you'll probably also need external power for the USB hub as well, because according to the Hardware Reference manual the BeagleBoard OTG port only sources 100 mA. This is enough to drive a single low-power device, but probably won't work with multiple devices.

also see http://en.wikipedia.org/wiki/USB_On-The-Go


keyboard/mouse/monitor


We have two basic choices for how to hook a BB up to a keyboard/mouse/monitor. Here I will call these 'native' and 'remote' (those are my words).

The native set up uses a monitor or TV which accepts DVI digital input using a HDMI connector. You need a HDMI to DVI-D cable, which is available from Digi-Key (amongst others):

http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=WM19082-ND

Your keyboard and mouse are connected to the USB hub, which is in turn connected to the OTG port of the BB.


The remote set up uses the keyboard/mouse/monitor of another computer. The BB will communicate with the other computer through either a serial cable or a ethernet connection. These physical connections will be discussed shortly. The communication over this physical connection involves a lot of layers of software. Most of this need not concern you. You do need to know a bit about X-Windows. X-Windows is software that handles IO for the keyboard/mouse/monitor of computers. It is a standard part of most Unix/Linus/BSD systems. Normally you turn on a computer and the display, keyboard, and mouse 'just work'; you could be running on a computer that uses X-Windows and you would not even realize it.

But X-Windows is much more flexible. You do not need to hardwire a PC/computer to any particular keyboard/mouse/monitor. The events/IO can be set up to go to another computer's keyboard/mouse/monitor.

Your PC needs to have X-Window software installed, like mini-com. The BB will not take over your whole monitor on your PC. You start the X-Window software, which opens up an application window that becomes a virtual monitor. Issuing the proper commands, you connect PC's virtual monitor to the BB. Then the PC's X-Window application's virtual monitor window has focus, mouse and keyboard events are sent to the BB.



serial cable and ethernet connections


Communciation between the BB and PC can take place via some form of wireless, or cable (ethernet or serial). The X-Window system was designed with ethernet in mind; I am not certain how well it would work over a serial cables.

Serial cables are covered at

http://elinux.org/BeagleBoard#RS232

The popularity and availability of faster information exchange systems such as Ethernet made the use of null-modem cables less common. Nowadays, such a cable can still be useful to kernel hackers though, since it allows the user to remotely debug a kernel with a minimum of device drivers and code (a serial driver mainly consists of two FIFO buffers and an interrupt service routine).


For Ethernet, you can buy something like a TRENDnet TU-ET100C 10/100Mbps USB to Ethernet Adapter ($10 at Fyrs). The Ethernet Adapter is a USB device by my earlier definition. You hook the USB plug into your USB hub. Then connect a standard Ethernet cable between this Adapter and your PC. ??? if the Ethernet cable is connected to a router, then what?


Source(s): tutorial


about webcams

You will need to picking a webcam to be used with the BB Most webcams are/can_be used for video-chat. USB Video Class (UVC for short) is a new compatibility standard for USB 2.0 video-chat cameras. So it is imperative that whatever you buy supports UVC, or you won't find a Linux driver for the camera.

Windows Vista and Mac OSX (10.4.9 and up) natively support UVC class video cameras, so ANY UVC based USB cam will (should) Just Work when plugged in, without finding and installing a webcam driver.

With Linux your may have to install a UVC driver yourself. Logitech provides a Linux driver [[4]]. I presume installing luvcview does not restrict you to using a Logitech camera. (please confirm!)


Logitech had a nice SDK (pre 2006) But they migrated to using a Windows COM object wrapped around their Logitech SDK. Which was bad news for the non-Windows developers. Using the old Logitech SDK, robix produced an API that would serve the needs of people doing robot vision. But they had to give up [[5]]

Hopefully, since the UVC is OS agnostic, there should be few(er) problems to put some form of Linux on the BB and start accessing webcam data.

Logitech has has forums for drivers, including a separate forum for the GSPCA/SPCA5xx Linux webcam driver series [[6]]. Logitech seems to be on top of these forums, and their engineers often provide tips.

The Logitech QuickCam Pro 9000 takes great images and video. But their 'Right Light 2' function may cause low frame-rates in low-lighting conditions, and the camera does native motion blur when there are low frame-rates. 'Right Light 2' can be disabled and we need to find the way to turn off motion blur.

Logitech's Autofocus functions are not supported on the Mac for the QuickCam Logitech Pro 9000 [[7]]. We need to see if Autofocus is part of the UVC. However, various drivers are supporting autofocus: 'guvcview has software support for autofocus since SVN revision 194' [[8]] (aug 2008)

[[9]] has good information on Linux UVC drivers and tools. Logitech QuickCam Pro 9000 is marked as having questionable support! Logitech has detailed the problems, and workarounds [[10]]. Logitech also has a list of UVC webcams [[11]] that notes which hardware version of the Pro 9000 might have problems. See page 9 of [[12]]. Unfortunately, it the camera does not have a SN on it, and the packaging does not provide a PID.


Source(s): tutorial


1) TUTORIAL: What to buy

BeagleBoard, $150, from Digikey http://beagleboard.org/


Logitech QuickCam 9000 Pro, $70

Or buy the Quickcam Pro for Notebooks; however, There is also a Quickcam for Notebooks Pro (seriously), that is junk. To avoid confusion and disappointment just buy the Quickcam 9000 Pro, it has the same internals but a different case.


A USB 2.0 MINI A TO MINI B cable for connecting to a USB hub (the BB is in "host mode" when you do this: > http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=WM17494-ND


USB hub, $14, from Frys


POWER choices:

 5V wallwart
 2-AA battery power supply 
 ( http://beagleboard.org/hardware  mentions  http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=N321-ND )
 use a powered USB port on another device, like a PC, using a standard Male-A to Mini-B cable for this.  
 (You probably have 10 of them at home already.) This is the "device mode". 

serial cable

or


TRENDnet TU-ET100C 10/100Mbps USB to Ethernet Adapter

http://shop3.frys.com/product/4434796?site=sr:SEARCH:MAIN_RSLT_PG

and a standard Ethernet cable

2) TUTORIAL: Installing Linux

The TI-designed Linux BSP (board support package) and development libraries include

  • U-boot bootloader
  • 2.6.22 kernel
  • peripheral drivers
  • a RFS (root filesystem) based on busybox

The development libraries comprise

  • codecs
  • API to communicate "directly" with the SoCs' digital signal processor (DSP) and video accelerators.

From this the open source community is hacking on the Linux kernal and drivers. We (Nathan) has selected a kernal and drivers that seem to work well, and hopefully all you have to do it install this balck box of 0's and 1's.

You need to make a SD flash card, formated in the EXT2 format, with these files:

  • MLO 17KB
  • u-boot 150KB
  • uImage 2078 KB

which you may download from


These files must be in the first partion of the SD flash card, and MLO must be the first file. When the BB is powered up with the reset button pressed, the program the BB runs will look at the first file of the first partition. If this file is named 'MLO', it will execute it. MLO is a boot loader. After it is loaded, it runs and looks for 'u-boot', which is the standard boot loader everyone uses to start loading Linux. Finally, u-boot runs and it reads uImage. The file 'uImage' has a form of Linux called Angstrom and various files needed to capture images and process them with OpenCV.

The EXT2 format is supported by Linux, but to write an EXT2 formatted SD flash card with Windows, you need to download software. We will use xxx.


run the command prompt

see [[16]] for an explaination of the command prompt

  • Step 1: Click on the Start Menu
  • Step 2: Click on the Run option
  • Step 3: Type the appropriate command in the Open: field. XP type 'cmd.exe'
  • Step 4: Click on the OK button


Now type these commands

 dir
 cd my documents
 cd downloads
 dd if=bb.dd of=\\.\PhysicalDrive1  bs=512k

[[17]] has an explaination of the dd command. The dd command is copying bb.dd to our SD flash drive in the EXT2 format.


The final steps are to connect the BB to a PC and run telnet on the PC so we can talk to the BB.

The mode of connection we will use is to power the BB via a USB cable and send signals from the BB's RS232 serial port to a USB port on the PC. We hook the DB9M TO IDC10 SERIAL (AT-EVEREX) cable to the BB's RS232 serial port, witht the red strand of the ribbon cable connecting to pin 1 on the RS232 connector. A null model cable connects to the other end of the DB9M TO IDC10 SERIAL cable, and to the PC's parallel port. If your PC does not have a parallel port, you need a serial to USB conector or cable.


Run HyperTerminal (this description is for a PC running XP)
 start
   all programs
     accessories
        communications
          HyperTerminal

_____ DLG: Default Telnet Program?

We recommend that you make HyperTerminal your default telnet program.

Do you want to do this?

click:[No]

_____ DLG: Connection Description

Name: type anything (hit:'bb') Icon: pick any click:[OK]

_____ DLG: Connect To


Connect using: pick the menu item corresponding to port on your PC that you connected the BB to PC serial cable to; lets say this is COM4

_____ DLG: COM4 Properties

Bits per second: 2400 // change to 115200 Data bits: 8 Parity: None Stop bits: 1 Flow control; Hardware // change to None

click:[OK]

_____ finished asking for a HyperTerminal window

You should now have a window titled 'bb - HyperTerminal'

Hold down the 'User' button on the BB Connect the USB to OTG cable to the BB

By holdering down the User button while powering up, you are instructing the BB to download and run the file names 'MLO', which in turn runs a file names 'u-boot', which in turn runs the file 'uImage'. The purpose of MLO and u-boot is to install the functions necessary to load and install uImage. uImage contains Linux and the any programs and data we will use in the Linux environment.

In the future, everything will exist on the BB's flash memory; so in the future you will then NOT press the 'User' button while powering up the BB. The BB has 256MB of on-board flash, so it will store MLO and u-boot. (check this with Nathan). You WILL need to have a SD card with uImage. (check this with Nathan).


At this point the HyperTerminal window will start presenting diagnostics as the BB is booted from the files on the SD flash card.

In this process X-Windows is loaded, so if you had connected a screen with a HTMI connector you would see X-Windows appear on the screen. And at that point you could use any keyboard and mouse connected to the BB via a USB hub.

When you no longer see new boot diagnostics appearing,

 hit <enter> to display the standard  banner shown after a power-up.
 you should see the 'beagle board login:' prompt,  
 type 'root' and hit <enter>
 you should get 'root@beagle board:~#:'
 type 'ls' and hit <enter> so see what files and directories exist at the top level

You are now running Linux on the BB, and using HyperTerminal on your PC so the mouse, keyboard and a Window on your PC's screen act as the user interface devices for the BB.

Any files you add, delete, or modify will cause uImage to be changed on the SD card.

3) TUTORIAL: Talking to a webcam

As per our discussions of cameras, we assume you are using a UVC compliant camera with a USB2.0 connector.

linux-omap has a UVC driver built-in. But you need to use the latest kernal, and various patches to have everything work proeprly. Some additional patches may be required to make the Logitech QC9000 Pro work properly (Actually, it's a more general problem with USB OTG support, as mentioned in the cmaera hardware section.)

To capture content from a webcam that complies with the UVC standard, use
  http://www.quickcamteam.net/software/linux/v4l2-software/uvccapture 
These can be used to view images:
*lucview
*mjpg-streamer   http://www.quickcamteam.net/software/linux/v4l2-software/mjpg-streamer 
 MJPG-streamer takes JPGs from Linux-UVC compatible webcams, filesystem or other input plugins 
 and streams them as M-JPEG via HTTP to webbrowsers, VLC and other software. 
 It is the successor of uvc-streamer, a Linux-UVC streaming application with Pan/Tilt

Use the images listed above, which include a bunch of patches.

If the result has shortcomings, then the easiest way to get a working .27 kernel with the USB patches is here (rename this to uImage and copy to your boot partition): http://dominion.thruhere.net/koen/OE/uImage-2.6.26+2.6.27-rc7+r14+gite1c49d7d22af768188e2a54c167ed79919361e55-r14-beagleboard.bin

Also install these modules in /lib/modules: http://dominion.thruhere.net/koen/OE/modules-2.6.26+2.6.27-rc7+r14.1+gite1c49d7d22af768188e2a54c167ed79919361e55-r14.1-beagleboard.tgz

If you want to try building your own kernel, you can get the linux-omap tree here: git clone git://git2.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git

You will need to apply some of the patches here: http://dominion.thruhere.net/git/?p=openembedded.git;a=tree;f=packages/linux/linux-omap;h=e56ed500ba61ea636a2dd14ada76821320fb5eb8;hb=HEAD

All the patches starting with 'musb-' are needed to make the cameras work reliably.

4) TUTORIAL: Programming OpenCV on the BeagleBoard

---


Using the BeagleBoard's DSP for vision processing

A big attraction of the BB is that the CPU chip also has a DSP core. This will allow a huge speed-up in vision processing. The following explains where the DSP will be useful.


Doing convolution integrals is the basic operation behind most computer vision algorithms. This includes operations like smoothing, sharpening, edge detection, etc.

For digital signal processing, a Guassian Function is convolved with an input signal. Doing these convolution integrals is computationally intensive. So special chips have been created that are optimized for this operation. These DSP chips can also be used for vision processing.

The Sobel Operator [[18]] is a popular edge detection operator. It has a 3x3 kernel.

Assume we want to run the Sobel Operator over a 600x800 image. As a first shot, the code to run a horizontal derivative approximation over an image looks a little like this in pigeon JavaScript:

 var N=600;
 var M=800;
 var n=3;
 var sobel_x=[ [ 1, 0,-1],
               [ 2, 0,-2],
               [ 1, 0,-1] ];  // discrete horizontal derivative approximation
 function convolve(input,N,M,kernel,n) {
   var sz=Math.floor(n/2);
   var result=new Array(N-2*sz,M-2*siz);  // assume everything initialized to 0
   for(var I=sz; I<N-sz; I++) {
     for(var J=sz; J<M-sz; J++) { 
       for(var i=0; i<n-1; i++) {
         for(var j=0; j<n-1; j++) { 
           result[I-sz,J-sz]+=input[I+sz-i,J+sz-j]*kernal[i,j];
         }		
       }
     }
   }
   return result;
 }
 var edges_x=convolve(input600x800,600,800,sobel_x,3);
 display(edges_x,'x-gradient of image');

Deep inside a DSP chip's API there should be something equivalent to the convolve function above.

But it is instructive to do some surgery on the above code. But lets move the loops over i and j outside of the convolve function.

 var N=600;
 var M=800;
 var n=3;
 var sobel_x=[ [ 1, 0,-1],
               [ 2, 0,-2],
               [ 1, 0,-1] ];
 function convolve1(result,input,N,M,kernel,sz,i,j) {
   for(var I=sz; I<N-sz; I++) {
     for(var J=sz; J<M-sz; J++) { 
       result[I-sz,J-sz]+=input[I+sz-i,J+sz-j]*kernal;
     }
   }
 }
 var sz=Math.floor(n/2);
 var result=new Array(N-2*sz,M-2*siz);  // assume everything initialized to 0
 convolve1(result,input600x800,600,800,sobel_x[0,0],sz,0,0); // multiplying by identity!
 //convolve1(result,input600x800,600,800,sobel_x[0,1],sz,0,1); // skip mult by 0
 convolve1(result,input600x800,600,800,sobel_x[0,2],sz,0,2); // multiplying by identity!
 convolve1(result,input600x800,600,800,sobel_x[1,0],sz,1,0); // a bit shift is same as mult by 2 
 //convolve1(result,input600x800,600,800,sobel_x[1,1],sz,1,1); // skip mult by 0
 convolve1(result,input600x800,600,800,sobel_x[1,2],sz,1,2); // a bit shift is same as mult by 2
 convolve1(result,input600x800,600,800,sobel_x[2,0],sz,2,0); // multiplying by identity!
 //convolve1(result,input600x800,600,800,sobel_x[2,1],sz,2,1); // skip mult by 0
 convolve1(result,input600x800,600,800,sobel_x[2,2],sz,2,2); // multiplying by identity!
 display(result,'x-gradient of image');

Arrays are actually stored a a vector. So a matrix

  a b c d e
  f g h i j
  k l m n o
  p q r s t 
  

is stored in memory as

  a b c d e f g h i j k l m n o p q r s t 
  
  

So if result and input are vectorized arrays, convolve1 could be rewritten:

 function convolve1(result,input,N,M,kernel,sz,i,j) {
   for(var I=sz; I<N-sz; I++) {
     for(var J=sz; J<M-sz; J++) { 
       result[(I-sz-1)*(M-2*sz) + (J-sz)]+=input[(I+sz-i)*M + (J+sz-j)]*kernal;
     }
   }
 }

The result array is slightly smaller than the input array. It will greatally simplify things if the result is padded with empty entries, so its size is the same as the input array. And we extend the bounds of our loops slightly, which will dump put some numbers into these padded entries. As a final step we will have to remember to ignor thesepadded entries.

Then we have

 function convolve1(result,input,N,M,kernel,sz,i,j) {
   for(var I=0; I<N; I++) {
     for(var J=0; J<M; J++) { 
       result[I*M + J]+=input[(I*M + J  +  M*(sz-i)+sz-j)]*kernal;
     }
   }
 }

Finally, we can traversing through a matrix using a single loop:

 function convolve1(result,input,N,M,kernel,sz,i,j) {
   for(var I=0; I<N*M; I++) {
     result[I]+=input[I+  M*(sz-i)+sz-j)]*kernal;
   }
 }

M*(sz-i)+sz-j) is just an offset. If we are using C, C++ or C#, we can add this offeset to 'input' before calling convolve1. Now convolve1 becomes:

 function convolve1(result,input,NxM,k) {
   for(var I=0; I<NxM; I++) {
     result[I]+=k*input[I];
   }
 }

This is a very simple operation, and every DSP chip has a special operation to multiple a vector by a constant and acculumate/add this result to another vector.

This is very important! 90% of the number crunching involved in vision processing can be off loaded to a DSP just by making setting things up as we have outlined and calling convolve1!

So the primary hurdle to getting everyone to use the DSP chip inside the BB is to make it dead simple to set up a tool chain that allows us to connect to the DSP.


So far, this is what is out there (feel free to make updates!):

DSP bridge instructions Options [[19]]

BeagleBoard/DSP Howto [[20]]


Source(s): tutorial


---

Personal tools