October 22, 2012

Wavelet Transform in OpenCV

    As we know, wavelet transform is not an in-built function in OpenCV.  We need add wavelet library externally to use it in OpenCV. 

Procedure to install wavelet library in Linux:


1. This package contains two wavelet libraries- libwavelet2d.so.1.0 (shared) and libwavelet2s.a (static) compiled essentially from the same source code. Source code is available in the ’src’ folder.

2. You may need to link to header files that are included with their resepctive libraries. They are also available in the ’src’ folder.

3. You may want to install shared library in one of your existing paths to make compilation easier. You can create sym links once inside the folder(say /usr/local/lib) by using following commands

ln -sf libwavelet2d.so.1.0 libwavelet2d.so
ln -sf libwavelet2d.so.1.0 libwavelet2d.so.1
ldconfig

You will probably need superuser privileges to perform previous steps. If you don’t have su privilege then you can move libwavelet2d.so.1.0 to your work folder or where your source code is, create sym links as before and then put your folder in the path during runtime.

ln -sf libwavelet2d.so.1.0 libwavelet2d.so
ln -sf libwavelet2d.so.1.0 libwavelet2d.so.1
export LD_LIBRARY_PATH=.libwavelet2s.a 

Working with static library is pretty straightforward. You will only need to include wavelet2s.h in your program and specify the library (-lwavelet2s flag) , include path (-I<path to wavelet2s.h> flag) and library
path (-L<path to libwavelet2s.a> flag).

July 04, 2012

Access General Purpose I/O port on FriendlyARM

    To access General Purpose I/O port on FriendlyARM, follow the procedure given below.


Open terminal on FriendlyARM:

cd sys/class/gpio                   // go to gpio
echo 36 > export                  // enable pin 36 of i/o port
echo out > gpio36/direction  // out for output. It makes pin 36 of I/O port as output pin
echo 1 > gpio36/value          // 1 for high, 0 for low
echo 36 > unexport              //disable

Check by using DMM or by LED. Output voltage should 3.3V

June 10, 2012

Install OpenCV on ARM-Linux system


Prerequisite:

i. Host platform: Ubuntu 11.04 (Any lower version is also accepted)

ii. OpenCV: Download OpenCV library from http://www.sourceforge.net.
Download OpenCV 2.1 for Linux.

iii. CMake: Install CMake on your system. Do this with Synaptic Package
manager. Also install GUI it makes your work easier.

iv. Tool chain for building: Use already built tool chain provided with Friendly
ARM board. This saves us a lot of time as it is very time consuming to build a
tool chain for specific platform.

v. Target Board: Friendly ARM mini6410.

Procedure:

i. First untar the downloaded file in Home folder say OpenCV-2.1.

ii. Make a new folder in this folder as  'Build'. We will store built library files in
this folder.

iii. Open CMake GUI.

iv. Fill topmost fields as:
Where is source code : /path/to/folder/OpenCV-2.1
Where to build libraries: /path/to/folder/Build

v. Now press  'Configure' button at bottom. This will open a new dialogue box.
Choose  'Unix Makefiles' from drop-down menu and choose  'Specify options
for cross-compiling'. Fill out fields as explained below.

vi. In fields for C and C++ compiler put path for tool chain provided with
Friendly ARM tool chain.

vii. Press Finish button. You will return to main CMake window with some red
variables on red background. We need to configure these variables.

viii. Enable following variables from that list
        a) BUILD_PACKAGE
        b) BUILD_SHARED_LIBS
        c) OPENCV_BUILD_3RDPARTY-LIBS
        d) WITH_JPEG
        e) WITH_PNG
        f) WITH_V4L

ix. Now press  'Configure' again. Now you won‘t see any variable in red. (If you
still see it, press configure again and again until you see all variables with
white background ). After this press  'Generate'.

x. Now open the terminal. cd to Build folder. Type  'make' and hit the  'Enter'.
This starts building OpenCV library. Wait until it shows 100%. It takes a long
time.

xi. Once building is over, you will see some .so files in folder  'OpenCV-
2.1/build/lib'. Copy all these files in the  'lib' folder on your Friendly ARM
board.

March 29, 2012

Change language settings on FriendlyARM

      When you get FriendlyARM board, all the names are in chinese. It is really frustrating, isn't it? You just need to go to settings menu and click the blue icon in second row. That is the language setting. Just change the language to english and it is very easy to use AriendlyARM.

February 20, 2012

Install Linux on Friendly ARM

    For image processing on Friendly ARM, you can install either Linux or Windows. Linux 2.6.38 is the most commonly used version. In this post, I will discuss the steps to install Linux on Friendly ARM. It is a bit tedious process, but be patient. Once installed, you can directly run  OpenCV program on Friendly ARM. Follow the following steps.

Step 1: Build Linux kernel
Step 2: Copy that to SD card
Step 3: Boot from SD card


Step 1:
Build the Linux kernel with specific options so that we will be able to see pictures, access USB camera and other related functions.

Procedure:

1. Extract the Linux kernel and place extracted file in folder in Home directory  say  'Linux-2.6.38'. (You can find Linux kernel in DVD provided with Friendly ARM board or you can download it from net.)

2.Open the folder and look for file named as 'config_mini6410_XXX (where XXX
is the touch screen your board has). Rename this file as  '.config'.

3.Now open the Terminal. cd to Linux-2.6.38. Type  'make menuconfig' and press Enter.

4. You will see a new colorful interface as shown in following figure. We can
configure different kernel parameters here.

5. Now Enable the following options : Device Drivers—> Multimedia Support—>
Video for Linux

6. Device Drivers—> Multimedia Support—> Video Capture Adapters —-> V4L
USB devices—–>USB Video Class and GSPCA based Webcams

7. Device Drivers—-> USB Support —> USB Gadget Support—–>USB Webcam Gadget

8. By enabling means press  'Y' when corresponding option is highlighted. You will
see a " * "against it.

9. Exit from that menu. Make sure you press  'Y' when it asks you to save configuration.

10. Type  'make' and hit the Return. This starts compiling Linux kernel.


Step 2:

After building is complete you will see a file  'zImage' in arch/arm/boot folder.
Copy this Image on memory card that you use to run OS on the board.


Step 3:

Insert the card in Card slot on board and Power on the supply.
Linux should boot.